Open
Conversation
Weight-only FP4 E2M1 quantized matmul (W4A16) with group-wise FP16 scales, the kernel powering low-precision LLM inference on Hopper and Blackwell. Two FP4 values are packed per uint8 byte; each contiguous block of group_size weights along K shares one scale. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restructures the challenge so a submission directly verifies AutoKernel's FP4 matmul claim (Table 5 of the paper): both operands are packed FP4 E2M1 with E4M3 per-block scales and a per-tensor FP32 alpha, matching the NVFP4 layout used by CUTLASS and qutlass. Previous revision was W4A16 weight-only quant, which cannot reach the TF/s regime the paper reports because x was still FP16. Key changes: - Both x and w are packed FP4 uint8 (nibbles); block size = 16. - Scales are raw E4M3 bytes (torch.float8_e4m3fn bit patterns). - Reference is a pure FP32 dequant + matmul oracle. - Performance shape (M=2048, N=18432, K=3072) taken verbatim from the Triton vs CUTLASS row in Table 5 so TF/s is directly comparable. - Tolerances loosened to atol=0.1, rtol=0.05 to admit FP16 accumulation used by tensor-core paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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.
Summary
86_fp4_matmul: weight-only FP4 E2M1 quantized matmul (W4A16) with group-wise FP16 scales, the kernel powering low-precision LLM inference on Hopper/Blackwell.group_sizeweights along K shares one FP16 scale.M=2048, N=8192, K=3072, group_size=32mirrors a row from the AutoKernel paper's FP4 matmul results table.Test plan
pre-commit run --all-fileson new files: black, isort, flake8, clang-format, mojo format all passchallenge.pyimports cleanly; all 6 required methods presentreference_implverified numerically on the example:y = [[1,2,-1,0],[1,2,-1,0]]matches the HTML examplescripts/run_challenge.py --language cuda --action runon Tesla T4🤖 Generated with Claude Code