Commit e9cb41b
committed
[ExecuTorch][WebGPU] Route exact prefill shapes to the BK64 GEMM
Pull Request resolved: #21130
Llama prefill drives the ordinary quantized-linear projections at a small set
of fixed batch-row counts, and the generic Steel schedule leaves throughput on
the table for them. This adds a frozen BK64 Steel quantized-GEMM route for the
exact accepted Llama ordinary-projection shapes at live M128, M508, and M512,
selected only when the capability and dynamic-route guards all pass. M511 and
other prefill sizes stay on the generic Steel schedule and M1 stays on bicol
decode, so the route fails closed outside its accepted shapes. Mirrors Vulkan
xplat/executorch/backends/vulkan/runtime/graph/ops/glsl/q4gsw_linear_gemm__w_4x8.glsl
(the 4-bit grouped-symmetric-weight GEMM), specialized here for the BK64 tile.
Key changes:
- runtime/ops/quantized_linear/q4gsw_steel_bk64.wgsl (+ generated header): the
BK64-tiled q4gsw prefill GEMM kernel.
- QuantizedLinear.cpp, WebGPUUtils.h: exact-shape predicate, capability guard,
and dynamic re-entry into and out of the BK64 route.
ghstack-source-id: 411961445
@exported-using-ghexport
Differential Revision: [D113171739](https://our.internmc.facebook.com/intern/diff/D113171739/)1 parent c09b197 commit e9cb41b
15 files changed
Lines changed: 1064 additions & 169 deletions
File tree
- backends/webgpu
- runtime
- ops/quantized_linear
- test
- native
- ops/dynamic_shape
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
103 | 125 | | |
104 | 126 | | |
105 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1325 | 1325 | | |
1326 | 1326 | | |
1327 | 1327 | | |
1328 | | - | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
1329 | 1334 | | |
1330 | | - | |
| 1335 | + | |
1331 | 1336 | | |
1332 | 1337 | | |
1333 | 1338 | | |
1334 | 1339 | | |
1335 | 1340 | | |
1336 | 1341 | | |
1337 | 1342 | | |
1338 | | - | |
| 1343 | + | |
1339 | 1344 | | |
1340 | | - | |
| 1345 | + | |
1341 | 1346 | | |
1342 | 1347 | | |
1343 | 1348 | | |
1344 | 1349 | | |
1345 | | - | |
| 1350 | + | |
1346 | 1351 | | |
1347 | 1352 | | |
1348 | 1353 | | |
| |||
1670 | 1675 | | |
1671 | 1676 | | |
1672 | 1677 | | |
1673 | | - | |
1674 | | - | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1675 | 1681 | | |
1676 | 1682 | | |
1677 | 1683 | | |
| |||
1681 | 1687 | | |
1682 | 1688 | | |
1683 | 1689 | | |
1684 | | - | |
1685 | | - | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
1686 | 1693 | | |
1687 | 1694 | | |
1688 | 1695 | | |
| |||
1696 | 1703 | | |
1697 | 1704 | | |
1698 | 1705 | | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
| 1706 | + | |
1702 | 1707 | | |
1703 | 1708 | | |
1704 | 1709 | | |
| |||
1729 | 1734 | | |
1730 | 1735 | | |
1731 | 1736 | | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
1736 | | - | |
1737 | | - | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
1738 | 1743 | | |
1739 | 1744 | | |
1740 | 1745 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
150 | | - | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
757 | 758 | | |
758 | 759 | | |
759 | 760 | | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
760 | 768 | | |
761 | 769 | | |
762 | 770 | | |
| |||
0 commit comments