Repository navigation
feat(cuda): add ldmatrix integer dequantization - #139
Merged
Merged
Conversation
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
jinzhen-lin
added this pull request to stack #140
October 12, 2026 17:42
Co-authored-by: Codex (GPT-6) <codex@openai.com> Signed-off-by: jinzhen.ljz <jinzhen.ljz@antgroup.com>
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.
Stacked on #137.
CUDA 13.4 adds an
ldmatrixinstruction that dequantizes INT4 to INT8 while loading data from shared memory. This PR adds full support for this operation in W4A8 GEMM. Thanks to @LilySu for pointing it out in Ptx94 ldmatrix s8 s4 dense w4a8 #85.Analysis and hardware testing revealed broader support than the PTX documentation describes: all architectures supporting
ldmatrix(SM75+) can execute the conversion through patched SASS, and the instruction also supports INT2-to-INT4 conversion. This PR reusespatch_cubin, compilingldmatrix.sync.aligned.m8n8.{x2,x4}.trans.shared.b16placeholders and then patching the generated SASS. This enables W4A8 and W2A4 conversion on supported hardware, including with CUDA versions before 13.4. Native PTX is used for INT4-to-INT8 on SM90+ with CUDA 13.4+.Adds
HUMMING_DISABLE_PATCH_CUBIN=1to disable patched instructions and undocumented hardware formats, including Blackwell E3M4/E0M3 support. Integer dequantization falls back to software when native PTX is unavailable; documented native instructions remain enabled.N = K = 8192, per-token activation × per-channel weight, default heuristics. Values are speedups over software dequantization, measured with alternating CUDA graph runs.
W4A8
W2A4