Repository navigation
vulkan: chunked GATED_DELTA_NET implementation - #30207
Conversation
|
I didn't have time to dig into the code today. I ran test-backend-ops and the perf is improved. codex suggested using V=32, and I get another almost 2x speedup from that. |
|
@0cc4m are you still pursuing this? If not, I'd be willing to take it over, I'd like to get it done one way or another. |
bfc0405 to
254ea47
Compare
|
We can finish this PR, sure. I'll look into your V=32 suggestion. |
|
I saw a performance improvement from V=32 when larger sizes wouldn't fill the GPU, added that in a way similar to split-k with a decision based on core count. I also generalized the CMM1 shader further to theoretically allow other GPUs, please check. |
|
I ran into a couple issues. There are failures in the unit tests in the CM2 path. It's fixed by this change: It also looks like some cases will use more than 48KB of shared memory, which is unsupported. |
969cc73 to
2d06dd9
Compare
|
New benchmark data. Note Strix Halo 8060S scan kernel data is lower because I found that it is very latency-sensitive and the VRAM carveout performs significantly better here. Now data is run without the carveout to exclude this effect (which is also the configuration I use). Nvidia performance is increased from @jeffbolznv's kernel. I think the branch should be ready.
|
|
@ggml-org/ggml-cuda Some of the new GDN tests are failing: https://github.com/ggml-org/llama.cpp/actions/runs/44696435737/job/136154180822#step:6:29650 PTAL |
|
The |
|
Maybe some of it isn't needed, but you should probably still fix supports_op to refuse cases which assert in your implementation. |
Yes, I don't know whether we formalized this somewhere but my opinion is that it is the responsibility of a backend to either return false for |
|
Yes, but we shouldn't add tests which are not required. The rollback in the chunked kernel is not required, I guess the test cases are for those. It just adds extra CI time for which there is no actual use-case. |
|
I'm completely fine with removing tests again, I am just of the opinion that from a ggml (rather than llama.cpp perspective) we should always make sure that |
|
@jeffbolznv built the tests, I'd wait for his opinion. |
|
I opened #32660 to heal the CI in the short term. |
|
Thanks for fixing. IMO if ggml.c allows something, it's fair game to have backend tests. Agents want to fill the test gaps they see, I think this is a good thing. The kind of annoying thing is that test-backend-ops changes no longer trigger all builds in CI. It's a tradeoff, catching these things after submission is not perfect but seems to be working OK so far. |
* vulkan: add cm2 chunked GATED_DELTA_NET shader * fix shmem bank conflict bottleneck * optimize further * add coopmat maintenance1 variant * optimize for RDNA4 * add gmem version RDNA4 * optimize for Ampere * fix nvidia shmem overuse * fix cm2 validation errors * improve cm2 perf * improve cm1 perf * clean up * enable by default * show cm maintenance1 marker in device info * properly check for cm_m1 features * add tests * add v32 mode, improve chunked condition * allow other subgroup sizes * vulkan: specialize the GDN CM2 workgroup size Assisted-by: Codex * vulkan: coopmat2 GDN implementation * work around Nvidia shader compiler crash * remove shared shader cm2 code --------- Co-authored-by: Jeff Bolz <[email protected]>
…d delta net prefill Brings upstream's Inkling 2 Mini support (inkling2 and inkling2_loop, ggml-org#32694, ggml-org#32429, and the inkling2v projector) and 70 other commits. One conflict: upstream's Vulkan gated delta net gained a chunked coopmat prefill (ggml-org#30207) and packed state rows, and the push constants gained s_off. The resolution keeps the fork's snapshot fusion on the scan: one push-constant struct, upstream's fields first and the snapshot destination after them, so the coopmat shaders read a prefix; the scan keeps its snapshot buffer binding and takes upstream's row_index. The coopmat choice moves to ggml_vk_gdn_use_cm, which the dispatch and the fusion share: the coopmat prefill writes the state into its own output, so the fusion declines when it runs the op (single state, ubatches of 4096 tokens or more on RDNA3).
* vulkan: add cm2 chunked GATED_DELTA_NET shader * fix shmem bank conflict bottleneck * optimize further * add coopmat maintenance1 variant * optimize for RDNA4 * add gmem version RDNA4 * optimize for Ampere * fix nvidia shmem overuse * fix cm2 validation errors * improve cm2 perf * improve cm1 perf * clean up * enable by default * show cm maintenance1 marker in device info * properly check for cm_m1 features * add tests * add v32 mode, improve chunked condition * allow other subgroup sizes * vulkan: specialize the GDN CM2 workgroup size Assisted-by: Codex * vulkan: coopmat2 GDN implementation * work around Nvidia shader compiler crash * remove shared shader cm2 code --------- Co-authored-by: Jeff Bolz <[email protected]>
* vulkan: add cm2 chunked GATED_DELTA_NET shader * fix shmem bank conflict bottleneck * optimize further * add coopmat maintenance1 variant * optimize for RDNA4 * add gmem version RDNA4 * optimize for Ampere * fix nvidia shmem overuse * fix cm2 validation errors * improve cm2 perf * improve cm1 perf * clean up * enable by default * show cm maintenance1 marker in device info * properly check for cm_m1 features * add tests * add v32 mode, improve chunked condition * allow other subgroup sizes * vulkan: specialize the GDN CM2 workgroup size Assisted-by: Codex * vulkan: coopmat2 GDN implementation * work around Nvidia shader compiler crash * remove shared shader cm2 code --------- Co-authored-by: Jeff Bolz <[email protected]>




Overview
This is a Vulkan port of the CUDA chunked kernel in #29353 to NV_coopmat2 and KHR_coopmat_maintenance1. The perf delta is much smaller than on CUDA, because I am missing some tuning options that CUDA has and because the Vulkan scan kernel is significantly better than CUDA's. This may not be worth the complexity, but I want to open it as draft to get some feedback from @jeffbolznv. It is a significant op-level speedup, but not on the model-level yet.
On the AMD side it requires radv built from upstream for maintenance1 support, since no released version supports it yet.
Requirements