Repository navigation
Commit 1fcd773
[ET-VK] Modernize binary ops with split shaders and safe UBO indexing
Pull Request resolved: pytorch#18452
Modernize the binary op implementation to use current best practices:
- Split binary_op.glsl into binary_op_buffer.glsl and binary_op_texture.glsl
with separate YAML configs, eliminating #ifdef USING_BUFFER branching
- Rewrite the texture shader to use element-by-element processing with
TextureMetadata UBOs and indexing.glslh (replaces legacy push-constant sizes,
broadcasting_utils.h, indexing_utils.h, and MASK_PADDING mechanism)
- Unify comparison op variants — scalar comparisons (X < Y) work for both
buffer and texture in element-by-element mode, removing the need for separate
lessThan/greaterThan texture variants
- Merge C++ dispatch into a single add_binary_op_node() using graph.meta_ubo()
which auto-selects BufferMetadata or TextureMetadata
- Apply safe_idx/safe_set helpers to avoid Adreno 740 SPIR-V compiler crash
caused by dynamic UBO ivec4 indexing with specialization constants
- Add safe_set() to indexing.glslh as companion to existing safe_idx()
ghstack-source-id: 357266948
@exported-using-ghexport
Differential Revision: [D97959282](https://our.internmc.facebook.com/intern/diff/D97959282/)1 parent 4888851 commit 1fcd773
8 files changed
Lines changed: 350 additions & 375 deletions
File tree
- backends/vulkan
- runtime/graph/ops
- glsl
- impl
- test
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
0 commit comments