cuda-cutlass-fmha-incremental-rebuild
Skill22k starsChanged 3 months agoMITView on GitHub
Use when rebuilding ONNX Runtime CUDA after editing CUTLASS fused-MHA headers (onnxruntime/contrib_ops/cuda/bert/cutlass_fmha/*.h such as kernel_forward.h or fmha_launch_template.h), or when a header edit "passed" an incremental build but test behavior did not change. Explains the nvcc depfile gotcha that produces stale Memory-Efficient-Attention (MEA) kernels and binaries, and how to force a correct recompile. Also covers disk-space frugality on shared GPU dev boxes.
Trending
Quiet since October.about the whole repository
Who's talking about microsoft/onnxruntime
- A Hacker News story“ONNX Runtime merges WebGPU backend”Hacker News · Apr 24, 2023 · 178 points
- immich-app/immich“feat(ml): introduce support of onnxruntime-rocm for AMD GPU”GitHub · Jul 12, 2024 · 28 reactions
- Unstructured-IO/unstructured“feat/numpy_2”GitHub · Oct 1, 2024 · 17 reactions
- microsoft/vcpkg“[onnxruntime] new ports for microsoft/onnxruntime v1.23.2”GitHub · Feb 19, 2024 · 17 reactions
- huggingface/transformers.js“Can GPU acceleration be used when using this library in a node.js environment?”GitHub · Feb 7, 2024 · 17 reactions
The biggest 5 of 39 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 39
Talked about on GitHub, Hacker News, Bluesky and the web (39 times).
On GitHub · 32
- Jul 12, 2024feat(ml): introduce support of onnxruntime-rocm for AMD GPU — immich-app/immich28 reactions · 58 comments
- Oct 1, 2024feat/numpy_2 — Unstructured-IO/unstructured17 reactions · 10 comments
- Feb 19, 2024[onnxruntime] new ports for microsoft/onnxruntime v1.23.2 — microsoft/vcpkg17 reactions · 80 comments
- Feb 7, 2024Can GPU acceleration be used when using this library in a node.js environment? — huggingface/transformers.js17 reactions · 6 comments
- Jan 21, 2024FAQ/GUIDE: I've figured out why CUDA isn't available in Insightface! — cubiq/ComfyUI_IPAdapter_plus17 reactions · 14 comments
27 more on GitHub
- Jan 8, 2020[request] some of most relevant c++ libraries in github (by number of stars) — conan-io/conan-center-index16 reactions · 132 comments
- Jun 18, 2024feat: add support for custom ai models | Pipeline API RFC — supabase/edge-runtime14 reactions · 18 comments
- Mar 16, 2021Add support for anchor tags — lycheeverse/lychee13 reactions · 39 comments
- May 14, 2024wanted: microsoft/onnxruntime — bazelbuild/bazel-central-registry11 reactions · 3 comments
- Mar 6, 2021[request] onnxruntime/1.7.1 — conan-io/conan-center-index11 reactions · 11 comments
- Nov 13, 2025Getting wrong .NET version — actions/setup-dotnet10 reactions · 18 comments
- May 8, 2025Enable Android 16 KB page size support — microsoft/onnxruntime-extensions9 reactions · 14 comments
- Apr 11, 2024Expose onnxruntime session options (intra_op_num_threads) — deepinsight/insightface9 reactions
- Sep 16, 2020Exporting the pytorch grid_sample operator to ONNX opset version 9 is not supported — pytorch/pytorch7 reactions · 1 comment
- Dec 29, 2023wasm does not work on node right now with multiple threads — huggingface/transformers.js6 reactions · 3 comments
- Mar 22, 2022Define layer normalization as a function — onnx/onnx6 reactions
- Dec 2, 2020[onnxruntime] Add new port — microsoft/vcpkg6 reactions · 28 comments
- Jul 28, 2026(partially) fix #23462: configure onnxruntime to stop VRAM usage from growing — immich-app/immich5 reactions · 4 comments
- Jul 23, 2024windows 10 installation tutorial (win10 安装教程) — warmshao/FasterLivePortrait5 reactions · 1 comment
- Nov 30, 2023[ROCm] TunableOp — pytorch/pytorch5 reactions · 31 comments
- Apr 15, 2025[DO NOT SUBMIT] Model cache POC — shiyi9801/chromium4 reactions · 2 comments
- Nov 19, 2024GafferML — GafferHQ/gaffer4 reactions · 3 comments
- Apr 15, 2026Add support for q1, q1f16, q2, q2f16 data types — huggingface/transformers.js3 reactions · 1 comment
- Dec 26, 2025onnx and onnxruntime bump versions (fixed onnx dependency with shared=True) — conan-io/conan-center-index3 reactions
- Nov 4, 2025python3Packages.rapidocr-onnxruntime: fix aarch64-linux build — NixOS/nixpkgs3 reactions · 7 comments
- Feb 26, 2025introduce "--webnn-ort-ov-gpu-precision" to specify gpu precision — shiyi9801/chromium3 reactions · 1 comment
- Feb 4, 2025Add: WASM Emscripten example — pykeio/ort3 reactions · 33 comments
- Feb 1, 2025Object mask — darktable-org/darktable3 reactions · 5 comments
- Sep 23, 2024C, C++, and Python API for Adapters (Multi-LoRA and others) — microsoft/onnxruntime-genai3 reactions
- Dec 12, 2023relax protobuf restriction — microsoft/onnxconverter-common3 reactions · 12 comments
- Apr 1, 2023onnxruntime: add 1.14.1 — conan-io/conan-center-index3 reactions · 36 comments
- Jan 14, 2022Add Col2Im operator — onnx/onnx3 reactions · 21 comments
On Hacker News · 5
- Apr 24, 2023ONNX Runtime merges WebGPU backend178 points · 35 comments
- Jan 19, 2020ONNX Runtime: cross-platform, high performance scoring engine for ML models8 points · 1 comment
- Sep 26, 2025ONNX Runtime v1.23.0 Released4 points
- Dec 11, 2020ONNX Runtime v1.6.0 Release1 point
- Oct 31, 2019Microsoft collects telemetry in onnxruntime Python module1 point
On Bluesky · 1
- Aug 22, 2026📦 microsoft / onnxruntime ⭐ 21,420 (+5) 🗒 C++ ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator — @github-trending.bsky.social1 likes and repost
On the web · 1
- Oct 21, 2026microsoft/onnxruntime - GitHub Explorer — ghe.derekchia.com
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- code-reviewSkill
- contrib-op-shape-inference-memory-safetySkill
- cuda-attention-kernel-patternsSkill
- onnx-opset-bump-checklistSkill
- ort-buildSkill
- ort-ciSkill
- ort-lintSkill
- ort-release-notesSkill
- ort-testSkill
- ort-transformers-gpu-pytestSkill
- python-kwargs-setattr-securitySkill
- webgpu-local-testingSkill
- workspace-estimation-shared-headerSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
Before rebuilding after editing any cutlass_fmha/*.h header:
- Distinctive: line 66
Check the right artifact for your link mode:
- Very specific: line 83
If the .so (and the fmha_sm*.cu.o) timestamps are older than (or equal to) the header edit, the build was stale — touch the .cu files and …
- Distinctive: line 104
Before a big rebuild, check free space and clean only clearly-stale, regenerable build directories (old dated experiment dirs).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Incremental rebuilds silently use STALE CUTLASS fused-MHA kernels
The general false-green principles (stale binary, wrong-artifact mtime) are summarised in the
ort-testskill's "False-green taxonomy". This skill is the CUDA/CUTLASS-specific detail.
The gotcha (verification-integrity bug)
nvcc-generated depfiles do not track the CUTLASS fused-MHA headers under
onnxruntime/contrib_ops/cuda/bert/cutlass_fmha/ (e.g. kernel_forward.h,
fmha_launch_template.h). These headers are #included by the fmha_sm*.cu
translation units, but the build system does not record that dependency.
Consequence: after you edit one of those headers, an incremental build.sh:
- does not recompile
fmha_sm*.cu, - reports
[100%] Built target ...and exits 0, - leaves the recompiled artifacts — the
fmha_sm*.cu.oobjects and thelibonnxruntime_providers_cuda.sothey link into — unchanged (samemtimeas the pre-edit build).
(Do not use the gtest test-exe mtime as the stale symptom: in the shared-provider
build the exe dlopens the .so and is not relinked, so its mtime stays old even
after a correct rebuild — see "How to confirm" below. The reliable diagnostic signal
is the fmha_sm*.cu.o / .so mtime.)
So your "successful" rebuild is running the old kernel. Tests that should now pass (or fail) reflect the previous code, not your edit. This silently invalidates any FAIL→PASS / PASS→FAIL verification.
The fix — force recompile the .cu units
Before rebuilding after editing any cutlass_fmha/*.h header:
touch onnxruntime/contrib_ops/cuda/bert/cutlass_fmha/*.cuThen run the normal build command. This forces the fmha_sm*.cu translation units
(and downstream binaries) to recompile against your header change.
How to confirm the rebuild was real (don't trust "[100%] Built")
Confirm that the artifact which actually links the recompiled fmha_sm*.cu.o
is newer than your header edit.
⚠️ Do NOT just check the test EXE mtime — it can falsely flag a good build as
stale. In the shared-provider build configuration (the default here), the CUDA
execution provider is a shared module: the recompiled fmha_sm*.cu.o link into
libonnxruntime_providers_cuda.so, and the onnxruntime_provider_test executable
dlopens that .so — it is not relinked. So after a correct rebuild the
test exe mtime stays old while the .so advances. Checking the exe alone
would wrongly conclude the build was stale.
Check the right artifact for your link mode:
- Shared-provider build (default): the
.sothat links the recompiled.o—build/<dir>/<cfg>/libonnxruntime_providers_cuda.so - Statically-linked provider: the test exe itself (
onnxruntime_provider_test)
Safest check — stat both the recompiled object and the .so, and confirm BOTH
are newer than the header edit:
stat -c '%y %n' onnxruntime/contrib_ops/cuda/bert/cutlass_fmha/kernel_forward.h
# in your build dir, e.g. build/Debug_quickbuild/Debug/:
stat -c '%y %n' libonnxruntime_providers_cuda.so
# and the actual recompiled object (path varies by build dir):
find . -name 'fmha_sm80.cu.o' -exec stat -c '%y %n' {} +If the .so (and the fmha_sm*.cu.o) timestamps are older than (or equal to) the
header edit, the build was stale — touch the .cu files and rebuild. The most
reliable signal of all is behavioral: a test that was failing now passes (a stale
binary cannot flip its result).
Related: pick the right test binary
This is the CUDA/CUTLASS instance of false-green mode 1 (zero-match / wrong binary) —
see the ort-test skill's "False-green taxonomy" for the general principle. In short:
attention/MEA/Flash boundary gtests (e.g. FlashStructuralEmptyRows*,
Attention_Causal_NonPadKVSeqLen_MEA_*) live in onnxruntime_provider_test, which CI
runs; onnxruntime_test_all does not contain them and gives a false green. Verify the
MEA/Flash boundary fix against onnxruntime_provider_test.
Related: disk frugality on shared GPU dev boxes
Full ORT CUDA builds are large (test binaries ~1 GB each; a build dir can reach
tens of GB). On a shared box, /home filling to 100% makes builds fail in
non-obvious places — e.g. git submodule sync reporting No space left on device
or a config.lock error, not an obvious "disk full" at the compile step.
Before a big rebuild, check free space and clean only clearly-stale, regenerable build directories (old dated experiment dirs). Never delete another agent's active build dir or anything ambiguous:
df -h /home
du -sh build/* | sort -hDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

