You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
I can’t reproduce the prefill performance on the RTX 3090 #5
bench_pp_tg.py is a quick correctness check, it does 1 warmup + 1 timed run, which isn't enough to warm cuBLAS on the prefill path. Run final_bench.py instead: it does 10 warmup + 20 timed runs averaged and also uses a proper manual past_key_values loop for the HF baseline. That's how we got the 37,800 prefill and 108 t/s HF decode numbers.
We're updating the README to point there by default.
Thanks, I tried running final_bench.py, but the perf numbers didn’t really change, even after locking power and clocks with sudo nvidia-smi -pl 400 && sudo nvidia-smi -lgc 2100.
I might try running it in a container to see if I can reproduce the issue.
Hi, I have the same issue reported here in that I have been unable to replicate the reported results.
I forked the repo and created this PR with a Dockerfile and instructions on how to build/run it (see comments in the Dockerfile). I am hoping there is some small error in my configuration that will explain why the execution speeds are slower than reported.
I spent the last 24 hours trying to get luce-megakernel working on Debian 13, and then switched to docker when it seemed that CUDA 13.2 (which I had installed on my Debian 13 host) was causing problems with luce-megakernel.
My hope is to get to a containerized version of luce-megakernel so anyone can easily replicate the results on an RTX 3090.
Note: the container image is ~20GB 🙂
Please let me know if there is anything I can do to help get this working.
I hit what looks like the same bug while porting this to RTX 5080 / sm_120a on CUDA 12.8 + PyTorch 2.10+cu128 (same stack you're on). Prefill was 4x slower than expected and the fingerprint matched what you're seeing: our megakernel prefill (cuBLAS) and the PyTorch HF baseline landed on nearly identical tok/s, which happens when both paths share a single slow GEMM dispatcher.
30-second diagnostic — add this to a test script or drop into bench_pp_tg.py around one prefill call:
magma_sgemmEx_kernel<float, __nv_bfloat16, __nv_bfloat16> → cuBLAS fell back to the CUDA-core path, ~10x slower than tensor cores. This is the trap.
cutlass_80_tensorop_bf16_s16816gemm_* → actual tensor cores; slowdown is elsewhere (DVFS, thermal, driver).
If it's magma: I have a drop-in fix in dknos/luce-megakernel#1. It replaces cublas_bf16_gemm with a call to at::mm_out, which uses the CUTLASS tensor-core kernels torch already ships in libtorch. Zero new link deps since torch_bindings.cpp already pulls in libtorch. On sm_120a it gave a 1.85x sustained prefill speedup (pp302: 87ms → 47ms); on sm_86 the effect could be larger since the pre-fix is even slower relative to the theoretical ceiling.
Things I ruled out along the way that didn't help, in case you try them:
CUBLAS_GEMM_DEFAULT_TENSOR_OP (algo 99, deprecated in 12.8, silently maps to DEFAULT)
CUBLAS_COMPUTE_32F_FAST_16BF compute type hint
32MB cublasSetWorkspace
Full cuBLASLt with cublasLtMatmulAlgoGetHeuristic — same dispatcher, same magma fallback
Please drop the profiler output here if you run it — if it's not magma we've at least ruled out one thing and can narrow the search.
Thanks @dknos, really appreciate the deep dive. We're heads-down on another part of the repo right now and can't give the prefill path proper attention for a bit. The 37k number most likely came from an experiment branch that we didn't merge and needs retesting.
If you want, open a PR with the at::mm_out swap and we'll pick it up on our RTX 3090 when we're back on this code. Huge thanks for the work.
on 29th Apr 2026 i built on windows using latest code. but performance is no much better than llama.cpp (i my smoke test).
i've put my logs in folk branch
Prefill performance of the qwen3.5 megakernel are a little bit better better of llamacpp (20k tok/s compared 18k tok/s). On the decode side there is no competition. Closing the issue with updated performances in the readme.
Activity
davide221 commentedon Apr 10, 2026
Hey, thanks for trying it out!
bench_pp_tg.py is a quick correctness check, it does 1 warmup + 1 timed run, which isn't enough to warm cuBLAS on the prefill path. Run final_bench.py instead: it does 10 warmup + 20 timed runs averaged and also uses a proper manual past_key_values loop for the HF baseline. That's how we got the 37,800 prefill and 108 t/s HF decode numbers.
We're updating the README to point there by default.
chfwinter commentedon Apr 10, 2026
Thanks, I tried running final_bench.py, but the perf numbers didn’t really change, even after locking power and clocks with
sudo nvidia-smi -pl 400 && sudo nvidia-smi -lgc 2100.I might try running it in a container to see if I can reproduce the issue.
ateamlunchbox commentedon Apr 14, 2026
Hi, I have the same issue reported here in that I have been unable to replicate the reported results.
I forked the repo and created this PR with a
Dockerfileand instructions on how to build/run it (see comments in theDockerfile). I am hoping there is some small error in my configuration that will explain why the execution speeds are slower than reported.I spent the last 24 hours trying to get
luce-megakernelworking on Debian 13, and then switched todockerwhen it seemed that CUDA 13.2 (which I had installed on my Debian 13 host) was causing problems withluce-megakernel.My hope is to get to a containerized version of
luce-megakernelso anyone can easily replicate the results on an RTX 3090.Note: the container image is ~20GB 🙂
Please let me know if there is anything I can do to help get this working.
dknos commentedon Apr 17, 2026
I hit what looks like the same bug while porting this to RTX 5080 / sm_120a on CUDA 12.8 + PyTorch 2.10+cu128 (same stack you're on). Prefill was 4x slower than expected and the fingerprint matched what you're seeing: our megakernel prefill (cuBLAS) and the PyTorch HF baseline landed on nearly identical tok/s, which happens when both paths share a single slow GEMM dispatcher.
30-second diagnostic — add this to a test script or drop into
bench_pp_tg.pyaround one prefill call:Then grep the kernel names:
magma_sgemmEx_kernel<float, __nv_bfloat16, __nv_bfloat16>→ cuBLAS fell back to the CUDA-core path, ~10x slower than tensor cores. This is the trap.cutlass_80_tensorop_bf16_s16816gemm_*→ actual tensor cores; slowdown is elsewhere (DVFS, thermal, driver).If it's magma: I have a drop-in fix in dknos/luce-megakernel#1. It replaces
cublas_bf16_gemmwith a call toat::mm_out, which uses the CUTLASS tensor-core kernels torch already ships in libtorch. Zero new link deps sincetorch_bindings.cppalready pulls in libtorch. On sm_120a it gave a 1.85x sustained prefill speedup (pp302: 87ms → 47ms); on sm_86 the effect could be larger since the pre-fix is even slower relative to the theoretical ceiling.Things I ruled out along the way that didn't help, in case you try them:
CUBLAS_GEMM_DEFAULT_TENSOR_OP(algo 99, deprecated in 12.8, silently maps to DEFAULT)CUBLAS_COMPUTE_32F_FAST_16BFcompute type hintcublasSetWorkspacecublasLtMatmulAlgoGetHeuristic— same dispatcher, same magma fallbackPlease drop the profiler output here if you run it — if it's not magma we've at least ruled out one thing and can narrow the search.
davide221 commentedon Apr 21, 2026
Thanks @dknos, really appreciate the deep dive. We're heads-down on another part of the repo right now and can't give the prefill path proper attention for a bit. The 37k number most likely came from an experiment branch that we didn't merge and needs retesting.
If you want, open a PR with the at::mm_out swap and we'll pick it up on our RTX 3090 when we're back on this code. Huge thanks for the work.
megakernel: add Phase 0+1 instrumentation, parity corpus, and WMMA scope
Merge pull request #57 from dusterbloom/feat/megakernel-dn-phase2-wmm…
LeiYangGH commentedon Apr 30, 2026
on 29th Apr 2026 i built on windows using latest code. but performance is no much better than llama.cpp (i my smoke test).
i've put my logs in folk branch
chore(deps): bump llama.cpp to luce-dflash tip (ce3919b4a)
davide221 commentedon May 4, 2026
Prefill performance of the qwen3.5 megakernel are a little bit better better of llamacpp (20k tok/s compared 18k tok/s). On the decode side there is no competition. Closing the issue with updated performances in the readme.
megakernel: add Phase 0+1 instrumentation, parity corpus, and WMMA scope
Merge pull request Luce-Org#57 from dusterbloom/feat/megakernel-dn-ph…
chore(deps): bump llama.cpp to luce-dflash tip (ce3919b4a)
harness: typed metrics parser with Optional[float] for missing fields…
fix(p2): cubic P2 batch — pin actions, sanitize tags, mirror shell wr…