Repository navigation
Commit 2b1b987
authored
[ET-VK] Improve
Refactor `PackedDimInfo` to use explicit block sizes instead of boolean flags.
This makes the packing semantics clearer and more flexible:
- Replace `packed_dim_padded` (bool) with `packed_dim_block_size` (int32_t)
- Replace `outer_packed_dim_padded` (bool) with `outer_packed_dim_block_size` (int32_t)
- Remove `is_block_packed` - now derived from `outer_packed_dim_block_size > 1`
- Add `block_numel` field (product of the two block sizes) for convenience
- Add `block_transposed` field to allow swapping the stride ordering of packed_dim
and outer_packed_dim (outer_packed_dim gets lowest stride when true)
- Ensure `outer_packed_dim` is always distinct from `packed_dim`
- Add `operator<<` overload for printing `PackedDimInfo` via `std::cout`
The block size values now explicitly represent the alignment requirements:
- Contiguous buffer: block_size = 1 (no padding)
- Standard texture: block_size = 4 (4 values per texel)
- Int8 non-block-packed texture: packed_dim_block_size = 16
- Int8 block-packed texture: both block sizes = 4 (4x4 = 16 values)
Also adds helper functions `to_outer_packed_dim()`, `to_packed_dim_block_size()`,
`to_outer_packed_dim_block_size()`, and `is_block_transposed_layout()` to
StorageUtils.h, and updates `calculate_dim_order()` and `calculate_strides()` to
account for both packed dimensions and the block_transposed flag.
Differential Revision: [D91281386](https://our.internmc.facebook.com/intern/diff/D91281386/)PackedDimInfo semantics (pytorch#16857)1 parent ed97214 commit 2b1b987
6 files changed
Lines changed: 470 additions & 200 deletions
File tree
- backends/vulkan
- runtime
- api/containers
- graph/ops/glsl
- utils
- test
0 commit comments