Commit 0c0e540
ssjia
[ET-VK] Fix pack_fp_linear_weight for devices without VK_KHR_16bit_storage
The `pack_fp_linear_weight` prepack shader crashes on devices that lack
`VK_KHR_16bit_storage` support because the half-precision variant reads from a
`float16_t[]` staging buffer, which requires that extension.
This applies the same two-dtype pattern used by `nchw_to_image` and
`conv2d_dw_prepack_weights`: a new `BUF_DTYPE` shader parameter allows the
staging buffer to use float32 (`[half, float]` combo) while the packed output
remains half-precision. The runtime selects the correct variant via
`get_staging_dtype_for()`, which returns `kFloat` when the device lacks fp16
buffer support.
All three call sites that construct the `pack_fp_linear_weight` shader name
(Linear.cpp, Conv1dPW.cpp, Conv2dPW.cpp) are updated to append the staging
dtype suffix.
Authored with Claude.
Differential Revision: [D99133993](https://our.internmc.facebook.com/intern/diff/D99133993/)
ghstack-source-id: 361148853
Pull Request resolved: #186421 parent ad235f8 commit 0c0e540
5 files changed
Lines changed: 17 additions & 10 deletions
File tree
- backends/vulkan/runtime/graph/ops
- glsl
- impl
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
0 commit comments