Commit 3d27ea8
ssjia
Update on "[ET-VK] Layout-flexible impl of quantized binary"
This refactors the quantized binary add operator to support all PackedInt8 memory layouts (4W, 4C, 4W4C, 4H4W, 4C1W) instead of being hardcoded to 4W4C. The shader is rewritten to use the block indexing framework (BlockConfig, block_int8x4_load/store) and BufferMetadata for layout-agnostic tensor access, replacing the previous linear dispatch that assumed 4W4C ordering.
Key changes:
- Renames shader from binary_q8ta_q8ta_q8to to q8ta_binary, and op from add_q8ta_q8ta_q8to to q8ta_add
- Shader now uses contiguous_block_idx_to_tensor4d_idx_with_block_config for dispatch and generated load/store functions for layout-flexible int8x4 access
- C++ dispatch uses pick_linear_global_wg_with_block_config and passes BufferMetadata UBOs for output and both inputs, plus hashed_layout specialization constants
- Moves the test operator into a separate TestQ8taBinary.cpp file that parameterizes on GPUMemoryLayout, testing all 5 layouts
- Updates op_registry to accept PACKED_INT8_BUFFER (all layouts) instead of just PACKED_INT8_4W4C_BUFFER
This diff was authored with Claude.
Differential Revision: [D93000170](https://our.internmc.facebook.com/intern/diff/D93000170/)
[ghstack-poisoned]File tree
5 files changed
+54
-0
lines changed- backends/vulkan
- partitioner
- runtime/api/containers
5 files changed
+54
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| |||
239 | 243 | | |
240 | 244 | | |
241 | 245 | | |
| 246 | + | |
242 | 247 | | |
243 | 248 | | |
244 | 249 | | |
| |||
253 | 258 | | |
254 | 259 | | |
255 | 260 | | |
| 261 | + | |
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
| |||
635 | 641 | | |
636 | 642 | | |
637 | 643 | | |
| 644 | + | |
638 | 645 | | |
639 | 646 | | |
640 | 647 | | |
| |||
656 | 663 | | |
657 | 664 | | |
658 | 665 | | |
| 666 | + | |
659 | 667 | | |
660 | 668 | | |
661 | 669 | | |
| |||
851 | 859 | | |
852 | 860 | | |
853 | 861 | | |
| 862 | + | |
854 | 863 | | |
855 | 864 | | |
856 | 865 | | |
| |||
874 | 883 | | |
875 | 884 | | |
876 | 885 | | |
| 886 | + | |
877 | 887 | | |
878 | 888 | | |
879 | 889 | | |
| |||
888 | 898 | | |
889 | 899 | | |
890 | 900 | | |
| 901 | + | |
891 | 902 | | |
892 | 903 | | |
893 | 904 | | |
| |||
897 | 908 | | |
898 | 909 | | |
899 | 910 | | |
| 911 | + | |
900 | 912 | | |
901 | 913 | | |
902 | 914 | | |
| |||
911 | 923 | | |
912 | 924 | | |
913 | 925 | | |
| 926 | + | |
914 | 927 | | |
915 | 928 | | |
916 | 929 | | |
| |||
925 | 938 | | |
926 | 939 | | |
927 | 940 | | |
| 941 | + | |
928 | 942 | | |
929 | 943 | | |
930 | 944 | | |
| |||
939 | 953 | | |
940 | 954 | | |
941 | 955 | | |
| 956 | + | |
942 | 957 | | |
943 | 958 | | |
944 | 959 | | |
| |||
978 | 993 | | |
979 | 994 | | |
980 | 995 | | |
| 996 | + | |
981 | 997 | | |
982 | 998 | | |
983 | 999 | | |
| |||
1006 | 1022 | | |
1007 | 1023 | | |
1008 | 1024 | | |
| 1025 | + | |
1009 | 1026 | | |
1010 | 1027 | | |
1011 | 1028 | | |
| |||
1020 | 1037 | | |
1021 | 1038 | | |
1022 | 1039 | | |
| 1040 | + | |
1023 | 1041 | | |
1024 | 1042 | | |
1025 | 1043 | | |
| |||
1034 | 1052 | | |
1035 | 1053 | | |
1036 | 1054 | | |
| 1055 | + | |
1037 | 1056 | | |
1038 | 1057 | | |
1039 | 1058 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
269 | 273 | | |
270 | 274 | | |
271 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
| |||
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
112 | 122 | | |
113 | 123 | | |
114 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
471 | 487 | | |
472 | 488 | | |
473 | 489 | | |
| |||
0 commit comments