[ET-VK][export] Update tensor representation sync logic to allow for flexibility in memory layouts#17564
Open
SS-JIA wants to merge 6 commits intogh/SS-JIA/438/basefrom
Open
[ET-VK][export] Update tensor representation sync logic to allow for flexibility in memory layouts#17564SS-JIA wants to merge 6 commits intogh/SS-JIA/438/basefrom
SS-JIA wants to merge 6 commits intogh/SS-JIA/438/basefrom
Conversation
…flexibility in memory layouts The tag_memory_meta_pass determines which storage type and memory layout to use for each tensor in the graph. Previously, OpRepSets enforced that "synced" tensors (e.g. all inputs to a binary op) use the exact same storage type AND memory layout by collapsing them into a single shared TensorRepSet. This was overly restrictive for quantized operators like q8ta_add, where inputs and outputs must share the same packed dimension but are allowed to use different memory layouts (e.g. input A uses PACKED_INT8_4W4C, input B uses PACKED_INT8_4C1W, output uses PACKED_INT8_4C1W). This diff introduces PackedDimInfo, a Python-side mirror of the C++ PackedDimInfo struct in Tensor.h, which captures the packed dimension and block size for each memory layout. The sync logic is rewritten so that synced tensors are constrained to have "compatible" packed dim info (same packed_dim and packed_dim_block_size) rather than identical memory layouts. This is achieved through three new TensorRepSet methods: has_same_packed_dim_info_set checks exact PDI equality, has_compatible_packed_dim_info_set checks superset containment, and filter_for_compatible_packed_dim_infos narrows a repset to only layouts with compatible PDIs. The OpRepSets initialization now stores individual repsets per arg/output instead of collapsing synced groups into a single object, and constraint propagation uses packed-dim filtering. The tag_memory_meta_pass is simplified to always call constrain_op_out_repset since the new OpRepSets sync logic handles propagation internally. Also renames make_filtered_tensor_repset to filter_invalid_reprs for clarity and adds comprehensive unit tests for TensorRepSet, TensorRepSetList, OpRepSets, and TensorReprList. Authored with Claude. Differential Revision: [D93768636](https://our.internmc.facebook.com/intern/diff/D93768636/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17564
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 161 PendingAs of commit 093b4cc with merge base 9a58ce8 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Feb 19, 2026
This PR needs a
|
manuelcandales
approved these changes
Feb 19, 2026
added 5 commits
February 20, 2026 15:58
… allow for flexibility in memory layouts" The tag_memory_meta_pass determines which storage type and memory layout to use for each tensor in the graph. Previously, OpRepSets enforced that "synced" tensors (e.g. all inputs to a binary op) use the exact same storage type AND memory layout by collapsing them into a single shared TensorRepSet. This was overly restrictive for quantized operators like q8ta_add, where inputs and outputs must share the same packed dimension but are allowed to use different memory layouts (e.g. input A uses PACKED_INT8_4W4C, input B uses PACKED_INT8_4C1W, output uses PACKED_INT8_4C1W). This diff introduces PackedDimInfo, a Python-side mirror of the C++ PackedDimInfo struct in Tensor.h, which captures the packed dimension and block size for each memory layout. The sync logic is rewritten so that synced tensors are constrained to have "compatible" packed dim info (same packed_dim and packed_dim_block_size) rather than identical memory layouts. This is achieved through three new TensorRepSet methods: has_same_packed_dim_info_set checks exact PDI equality, has_compatible_packed_dim_info_set checks superset containment, and filter_for_compatible_packed_dim_infos narrows a repset to only layouts with compatible PDIs. The OpRepSets initialization now stores individual repsets per arg/output instead of collapsing synced groups into a single object, and constraint propagation uses packed-dim filtering. The tag_memory_meta_pass is simplified to always call constrain_op_out_repset since the new OpRepSets sync logic handles propagation internally. Also renames make_filtered_tensor_repset to filter_invalid_reprs for clarity and adds comprehensive unit tests for TensorRepSet, TensorRepSetList, OpRepSets, and TensorReprList. Authored with Claude. Differential Revision: [D93768636](https://our.internmc.facebook.com/intern/diff/D93768636/) [ghstack-poisoned]
… allow for flexibility in memory layouts" The tag_memory_meta_pass determines which storage type and memory layout to use for each tensor in the graph. Previously, OpRepSets enforced that "synced" tensors (e.g. all inputs to a binary op) use the exact same storage type AND memory layout by collapsing them into a single shared TensorRepSet. This was overly restrictive for quantized operators like q8ta_add, where inputs and outputs must share the same packed dimension but are allowed to use different memory layouts (e.g. input A uses PACKED_INT8_4W4C, input B uses PACKED_INT8_4C1W, output uses PACKED_INT8_4C1W). This diff introduces PackedDimInfo, a Python-side mirror of the C++ PackedDimInfo struct in Tensor.h, which captures the packed dimension and block size for each memory layout. The sync logic is rewritten so that synced tensors are constrained to have "compatible" packed dim info (same packed_dim and packed_dim_block_size) rather than identical memory layouts. This is achieved through three new TensorRepSet methods: has_same_packed_dim_info_set checks exact PDI equality, has_compatible_packed_dim_info_set checks superset containment, and filter_for_compatible_packed_dim_infos narrows a repset to only layouts with compatible PDIs. The OpRepSets initialization now stores individual repsets per arg/output instead of collapsing synced groups into a single object, and constraint propagation uses packed-dim filtering. The tag_memory_meta_pass is simplified to always call constrain_op_out_repset since the new OpRepSets sync logic handles propagation internally. Also renames make_filtered_tensor_repset to filter_invalid_reprs for clarity and adds comprehensive unit tests for TensorRepSet, TensorRepSetList, OpRepSets, and TensorReprList. Authored with Claude. Differential Revision: [D93768636](https://our.internmc.facebook.com/intern/diff/D93768636/) [ghstack-poisoned]
… allow for flexibility in memory layouts" The tag_memory_meta_pass determines which storage type and memory layout to use for each tensor in the graph. Previously, OpRepSets enforced that "synced" tensors (e.g. all inputs to a binary op) use the exact same storage type AND memory layout by collapsing them into a single shared TensorRepSet. This was overly restrictive for quantized operators like q8ta_add, where inputs and outputs must share the same packed dimension but are allowed to use different memory layouts (e.g. input A uses PACKED_INT8_4W4C, input B uses PACKED_INT8_4C1W, output uses PACKED_INT8_4C1W). This diff introduces PackedDimInfo, a Python-side mirror of the C++ PackedDimInfo struct in Tensor.h, which captures the packed dimension and block size for each memory layout. The sync logic is rewritten so that synced tensors are constrained to have "compatible" packed dim info (same packed_dim and packed_dim_block_size) rather than identical memory layouts. This is achieved through three new TensorRepSet methods: has_same_packed_dim_info_set checks exact PDI equality, has_compatible_packed_dim_info_set checks superset containment, and filter_for_compatible_packed_dim_infos narrows a repset to only layouts with compatible PDIs. The OpRepSets initialization now stores individual repsets per arg/output instead of collapsing synced groups into a single object, and constraint propagation uses packed-dim filtering. The tag_memory_meta_pass is simplified to always call constrain_op_out_repset since the new OpRepSets sync logic handles propagation internally. Also renames make_filtered_tensor_repset to filter_invalid_reprs for clarity and adds comprehensive unit tests for TensorRepSet, TensorRepSetList, OpRepSets, and TensorReprList. Authored with Claude. Differential Revision: [D93768636](https://our.internmc.facebook.com/intern/diff/D93768636/) [ghstack-poisoned]
… allow for flexibility in memory layouts" The tag_memory_meta_pass determines which storage type and memory layout to use for each tensor in the graph. Previously, OpRepSets enforced that "synced" tensors (e.g. all inputs to a binary op) use the exact same storage type AND memory layout by collapsing them into a single shared TensorRepSet. This was overly restrictive for quantized operators like q8ta_add, where inputs and outputs must share the same packed dimension but are allowed to use different memory layouts (e.g. input A uses PACKED_INT8_4W4C, input B uses PACKED_INT8_4C1W, output uses PACKED_INT8_4C1W). This diff introduces PackedDimInfo, a Python-side mirror of the C++ PackedDimInfo struct in Tensor.h, which captures the packed dimension and block size for each memory layout. The sync logic is rewritten so that synced tensors are constrained to have "compatible" packed dim info (same packed_dim and packed_dim_block_size) rather than identical memory layouts. This is achieved through three new TensorRepSet methods: has_same_packed_dim_info_set checks exact PDI equality, has_compatible_packed_dim_info_set checks superset containment, and filter_for_compatible_packed_dim_infos narrows a repset to only layouts with compatible PDIs. The OpRepSets initialization now stores individual repsets per arg/output instead of collapsing synced groups into a single object, and constraint propagation uses packed-dim filtering. The tag_memory_meta_pass is simplified to always call constrain_op_out_repset since the new OpRepSets sync logic handles propagation internally. Also renames make_filtered_tensor_repset to filter_invalid_reprs for clarity and adds comprehensive unit tests for TensorRepSet, TensorRepSetList, OpRepSets, and TensorReprList. Authored with Claude. Differential Revision: [D93768636](https://our.internmc.facebook.com/intern/diff/D93768636/) [ghstack-poisoned]
… allow for flexibility in memory layouts" The tag_memory_meta_pass determines which storage type and memory layout to use for each tensor in the graph. Previously, OpRepSets enforced that "synced" tensors (e.g. all inputs to a binary op) use the exact same storage type AND memory layout by collapsing them into a single shared TensorRepSet. This was overly restrictive for quantized operators like q8ta_add, where inputs and outputs must share the same packed dimension but are allowed to use different memory layouts (e.g. input A uses PACKED_INT8_4W4C, input B uses PACKED_INT8_4C1W, output uses PACKED_INT8_4C1W). This diff introduces PackedDimInfo, a Python-side mirror of the C++ PackedDimInfo struct in Tensor.h, which captures the packed dimension and block size for each memory layout. The sync logic is rewritten so that synced tensors are constrained to have "compatible" packed dim info (same packed_dim and packed_dim_block_size) rather than identical memory layouts. This is achieved through three new TensorRepSet methods: has_same_packed_dim_info_set checks exact PDI equality, has_compatible_packed_dim_info_set checks superset containment, and filter_for_compatible_packed_dim_infos narrows a repset to only layouts with compatible PDIs. The OpRepSets initialization now stores individual repsets per arg/output instead of collapsing synced groups into a single object, and constraint propagation uses packed-dim filtering. The tag_memory_meta_pass is simplified to always call constrain_op_out_repset since the new OpRepSets sync logic handles propagation internally. Also renames make_filtered_tensor_repset to filter_invalid_reprs for clarity and adds comprehensive unit tests for TensorRepSet, TensorRepSetList, OpRepSets, and TensorReprList. Authored with Claude. Differential Revision: [D93768636](https://our.internmc.facebook.com/intern/diff/D93768636/) [ghstack-poisoned]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
The tag_memory_meta_pass determines which storage type and memory layout to use for each tensor in the graph. Previously, OpRepSets enforced that "synced" tensors (e.g. all inputs to a binary op) use the exact same storage type AND memory layout by collapsing them into a single shared TensorRepSet. This was overly restrictive for quantized operators like q8ta_add, where inputs and outputs must share the same packed dimension but are allowed to use different memory layouts (e.g. input A uses PACKED_INT8_4W4C, input B uses PACKED_INT8_4C1W, output uses PACKED_INT8_4C1W).
This diff introduces PackedDimInfo, a Python-side mirror of the C++ PackedDimInfo struct in Tensor.h, which captures the packed dimension and block size for each memory layout. The sync logic is rewritten so that synced tensors are constrained to have "compatible" packed dim info (same packed_dim and packed_dim_block_size) rather than identical memory layouts. This is achieved through three new TensorRepSet methods: has_same_packed_dim_info_set checks exact PDI equality, has_compatible_packed_dim_info_set checks superset containment, and filter_for_compatible_packed_dim_infos narrows a repset to only layouts with compatible PDIs.
The OpRepSets initialization now stores individual repsets per arg/output instead of collapsing synced groups into a single object, and constraint propagation uses packed-dim filtering. The tag_memory_meta_pass is simplified to always call constrain_op_out_repset since the new OpRepSets sync logic handles propagation internally.
Also renames make_filtered_tensor_repset to filter_invalid_reprs for clarity and adds comprehensive unit tests for TensorRepSet, TensorRepSetList, OpRepSets, and TensorReprList.
Authored with Claude.
Differential Revision: D93768636