GLM-DSA: much better PP long context performance (CUDA)#2109
Merged
Conversation
Contributor
|
at the risk of going off-topic, @Skelectric could you share your ik config? My system is very similar (2x 9B14, 1x R6KP) --decode speed is similar for my q4/q4/q6 quant but your prefill is significantly better. I see 315t/s down to 227t/s @ 100K. maybe you have the 600W version? mine, for this PR: |
|
@usrlocalben Its a 600W model power limited to 400W. |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR implements a much more efficient sparse attention computation for GLM-DSA on CUDA with two caveats
mla = 1is requuiredf16K-cache is requiredNo new op or command line options are added. Instead, when the CUDA FA is invoked and the computation can be done in the better way (i.e., there is a
top_ktensor, the above requirements are met, and the context>= 4*n_top_k), the newly added functionggml_cuda_dsa_attn_extinstead of the standard FA is used.The original idea was to integrate the
top_kselection directly into the FA kernel. But, after getting confused multiple times and not arriving at a working version, I ended up putting together an implementation that iterates over the batch tokens in chunks (with the only reason for chunking being to restrict the size of the intermediate compute buffers to a reasonable maximum - about 220 MiB for GLM-DSA (nearly) independent of batch size).At a context of 100k tokens I observe a ~2.7X better PP compared to the not yet merged PR #2103.
Below are
sweep-benchresults for GLM-5.2-Q4_K_M on a 13x3090+Ryzen-3995WX system (GPUs are limited to 200W). u-batch size is 2048, 26 layers are offloaded to the GPUs. The dip in the black curve is strange, possibly a power management issue.