You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5744fff
Browse filesBrowse the repository at this point in the historyBrowse files
[ET-VK] Add hashed_layout parameter to indexing.glslh texture functions
Pull Request resolved: pytorch#18449
The Adreno GPU driver miscompiles dynamic vector component access patterns
(`v[runtime_index]`) in GLSL shaders. This manifests as SIGSEGV crashes on
Adreno 740 and silent data corruption on Adreno 750 when accessing vector
components using a UBO-derived index (e.g. `tidx.data[meta.packed_dim]`).
This diff updates `texture_pos_to_tensor4d_idx_simple`,
`tensor4d_idx_to_texel_pos_simple`, and
`tensor4d_idx_to_texture_element_idx_simple` to accept a `hashed_layout`
parameter (typically a spec constant). The packed_dim is extracted from the
hashed layout and used in if/else chains with literal swizzles instead of
dynamic vector indexing, which the driver handles correctly.
Legacy 2-arg overloads are provided for shaders that don't yet have a
hashed_layout spec constant. These delegate to the 3-arg versions using
`meta.packed_dim << 16` to construct the layout at runtime. While this
doesn't enable compile-time branch elimination, the if/else pattern still
avoids the driver bug.
Shaders that already have hashed_layout spec constants (arange, full, expand,
repeat, pad, block_load, block_store) are updated to use the 3-arg versions.
ghstack-source-id: 357266950
@exported-using-ghexport
Differential Revision: [D97959286](https://our.internmc.facebook.com/intern/diff/D97959286/)
0 commit comments