Cmake cuda extension with git submodule vendoring
Skill kjuhwa/skills-hub/skills/build-system/cmake-cuda-extension-with-git-submodule-vendoring
Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.
npx -y skills add kjuhwa/skills-hub --skill cmake-cuda-extension-with-git-submodule-vendoringAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Build a PyTorch CUDA extension with CMake, vendoring CUTLASS and fmt as git submodules, plus a pre-built-wheel fast path for CI via GitHub releases.
SKILL.md
2.7 KB, 533 tokens by cl100k_base, as published. Nobody here has run it
CMake CUDA Extension With Git-Submodule Vendoring
What / Why
CUTLASS / CUTE / fmt are tightly coupled to kernel code — version skew = silent miscompiles. Vendoring via git submodule pins exact commits and avoids every user becoming a CUTLASS debugger. A CMake build keeps the CUDA compilation flags centralized. For CI, a DG_FORCE_BUILD env switch lets users download a pre-built wheel from GitHub releases when a matching Python × PyTorch × CUDA tag exists, skipping the 15-minute local compile.
Procedure
- Add submodules.
git submodule add https://github.com/nvidia/cutlass.git third-party/cutlass git submodule add https://github.com/fmtlib/fmt.git third-party/fmt - Pin exact commits via
git submodule update --init --recursiveininstall.sh. Lock CUTLASS to a known-good tag. setup.pybranching.- If
DG_FORCE_BUILDunset AND matching wheel exists at the releases URL: download, extract, install. - Else: call into CMake via
CUDAExtension/torch.utils.cpp_extension.BuildExtension.
- If
CMakeLists.txtessentials.include_dirs += third-party/cutlass/include,third-party/cutlass/include/cute,third-party/fmt/include,deep_gemm/include.libraries += cudart nvrtc.- Flags:
-std=c++20 -O3 -fPIC, PyTorch C++11 ABI alignment flag, CUDA arch list fromtorch.utils.cpp_extension.CUDA_ARCHITECTURES.
develop.shsymlinks the include tree for in-place development;install.shis the end-user wrapper.
Key design points
- Pre-built wheel path is a cache, not a different code path. The same sources build the wheel and a local build — just shorter.
- Header-only vendoring (CUTLASS, fmt) avoids static-lib ABI issues. If you need a compiled third-party lib, vendor source and build under your CMake, don't link externally.
- Keep CUDA arch selection dynamic (from PyTorch), not hardcoded — users run SM80-SM100.
References
setup.py— wheel fast path + build invocation.CMakeLists.txt— compile flags and include wiring.install.sh/develop.sh— user-facing entry points.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.