Commit 230de70
ssjia
[ET-VK] Plumb subgroup property queries + VK_EXT_subgroup_size_control
Adds infrastructure for querying GPU subgroup capabilities and pinning required subgroup size at pipeline creation time, sourced from the existing `SUBGROUP_SIZE` yaml template parameter. This is the foundation for writing subgroup-using shaders (e.g. cooperative GEMV variants) that remain portable across GPUs with different subgroup widths (Adreno=64, Mali=16, NVIDIA=32, etc.).
`PhysicalDevice` now chains `VkPhysicalDeviceSubgroupProperties` and `VkPhysicalDeviceSubgroupSizeControlProperties` into `vkGetPhysicalDeviceProperties2`, plus `VkPhysicalDeviceSubgroupSizeControlFeatures` into `vkGetPhysicalDeviceFeatures2`. The `Adapter` exposes accessors for subgroup_size, supported subgroup ops/stages, [min,max] subgroup size range, and whether the driver supports per-pipeline required subgroup size for the COMPUTE stage. `VK_EXT_subgroup_size_control` is added to the requested extension list and the size-control features are chained into device-create pNext when supported.
`ComputePipeline::Descriptor` gains a `required_subgroup_size` field that, when nonzero, chains `VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT` into pipeline creation (both the on-demand `retrieve` path and the batch `create_pipelines` path). The pipeline cache key includes the field so pipelines compiled for different subgroup widths cache independently. `ShaderInfo` carries the same field so it can be plumbed from shader yaml through to the pipeline descriptor.
The existing `SUBGROUP_SIZE` yaml template parameter is now the single source of truth: `gen_vulkan_spv.py` substitutes it into GLSL as before AND emits it as `ShaderInfo::required_subgroup_size`. At dispatch, `vkapi::resolve_required_subgroup_size` validates the value is within the adapter's `[min, max]` range and throws `ShaderNotSupportedError` if the extension is unsupported or the value is out of range, surfacing a clear failure rather than silently miscompiling a shader whose algorithm depends on the pinned subgroup width.
No shader yamls are modified by this change; subsequent commits opt their shaders into the pinning by declaring `SUBGROUP_SIZE` in their yamls.
Differential Revision: [D104456803](https://our.internmc.facebook.com/intern/diff/D104456803/)
[ghstack-poisoned]1 parent 7debf5c commit 230de70
13 files changed
Lines changed: 405 additions & 21 deletions
File tree
- backends/vulkan/runtime
- api
- graph
- vk_api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
155 | | - | |
| 158 | + | |
| 159 | + | |
156 | 160 | | |
157 | 161 | | |
158 | 162 | | |
| |||
315 | 319 | | |
316 | 320 | | |
317 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
318 | 325 | | |
319 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
320 | 330 | | |
321 | 331 | | |
322 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
284 | 285 | | |
285 | | - | |
| 286 | + | |
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
| |||
341 | 342 | | |
342 | 343 | | |
343 | 344 | | |
| 345 | + | |
344 | 346 | | |
345 | 347 | | |
346 | 348 | | |
| |||
357 | 359 | | |
358 | 360 | | |
359 | 361 | | |
| 362 | + | |
360 | 363 | | |
361 | 364 | | |
362 | 365 | | |
| |||
785 | 788 | | |
786 | 789 | | |
787 | 790 | | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
788 | 795 | | |
789 | 796 | | |
790 | 797 | | |
| |||
797 | 804 | | |
798 | 805 | | |
799 | 806 | | |
800 | | - | |
| 807 | + | |
801 | 808 | | |
802 | 809 | | |
803 | 810 | | |
| |||
813 | 820 | | |
814 | 821 | | |
815 | 822 | | |
816 | | - | |
| 823 | + | |
817 | 824 | | |
818 | 825 | | |
819 | 826 | | |
| |||
842 | 849 | | |
843 | 850 | | |
844 | 851 | | |
845 | | - | |
| 852 | + | |
| 853 | + | |
846 | 854 | | |
847 | 855 | | |
848 | 856 | | |
| |||
1026 | 1034 | | |
1027 | 1035 | | |
1028 | 1036 | | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1029 | 1058 | | |
1030 | 1059 | | |
1031 | 1060 | | |
| |||
1184 | 1213 | | |
1185 | 1214 | | |
1186 | 1215 | | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
1187 | 1222 | | |
1188 | 1223 | | |
1189 | 1224 | | |
| |||
1208 | 1243 | | |
1209 | 1244 | | |
1210 | 1245 | | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
1211 | 1257 | | |
1212 | 1258 | | |
1213 | 1259 | | |
| |||
1281 | 1327 | | |
1282 | 1328 | | |
1283 | 1329 | | |
| 1330 | + | |
| 1331 | + | |
1284 | 1332 | | |
1285 | 1333 | | |
1286 | 1334 | | |
| |||
1378 | 1426 | | |
1379 | 1427 | | |
1380 | 1428 | | |
| 1429 | + | |
1381 | 1430 | | |
1382 | 1431 | | |
1383 | 1432 | | |
| |||
1406 | 1455 | | |
1407 | 1456 | | |
1408 | 1457 | | |
1409 | | - | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
1410 | 1461 | | |
1411 | 1462 | | |
1412 | 1463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
828 | 837 | | |
829 | 838 | | |
830 | 839 | | |
831 | | - | |
| 840 | + | |
| 841 | + | |
832 | 842 | | |
833 | 843 | | |
834 | 844 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
| |||
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
202 | 218 | | |
203 | 219 | | |
204 | 220 | | |
| |||
405 | 421 | | |
406 | 422 | | |
407 | 423 | | |
408 | | - | |
| 424 | + | |
409 | 425 | | |
410 | 426 | | |
411 | 427 | | |
| |||
452 | 468 | | |
453 | 469 | | |
454 | 470 | | |
455 | | - | |
| 471 | + | |
456 | 472 | | |
457 | 473 | | |
458 | 474 | | |
459 | 475 | | |
460 | 476 | | |
461 | 477 | | |
462 | 478 | | |
463 | | - | |
464 | | - | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
465 | 502 | | |
466 | 503 | | |
467 | 504 | | |
| |||
614 | 651 | | |
615 | 652 | | |
616 | 653 | | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
617 | 673 | | |
618 | 674 | | |
0 commit comments