Skip to content

[CuTeDSL] Fix prep_editable_install.py for split nvidia-cutlass-dsl wheels - #3417

Open
zkyue wants to merge 1 commit into
NVIDIA:mainfrom
zkyue:fix-prep-editable-split-wheel
Open

[CuTeDSL] Fix prep_editable_install.py for split nvidia-cutlass-dsl wheels#3417
zkyue wants to merge 1 commit into
NVIDIA:mainfrom
zkyue:fix-prep-editable-split-wheel

Conversation

@zkyue

@zkyue zkyue commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #3416.

Symptom

The CuTeDSL editable dev flow (python/CuTeDSL/prep_editable_install.py, then setup.sh --editable) produces an install that fails at import cutlass with ModuleNotFoundError: No module named 'cutlass._mlir'. The prep script prints "Setup completed successfully!" while its summary shows 0 lib files, 0 Python files copied.

Root cause

Since 4.4.0 the nvidia-cutlass-dsl wheel on PyPI is a ~10 KB metadata-only shim; the runtime libraries and python payload moved to nvidia-cutlass-dsl-libs-{base,core,cu12,cu13} wheels (declared via Requires-Dist, cu13 behind the cu13 extra), and the in-wheel payload directory was renamed python_packages/dsl_packages/. The script still runs pip download --no-deps nvidia-cutlass-dsl, so it gets only the shim, extracts nothing, and exits 0 anyway.

Fix

  • Detect a metadata-only top-level wheel by content; wheels that carry their own payload (<= 4.3.x) are handled exactly as before.
  • For split wheels, follow the Requires-Dist entries within the nvidia-cutlass-dsl-libs-* family transitively, restricted to one CUDA variant (--cu12 default / --cu13, matching setup.sh), and extract all of them.
  • Merge every bundled python_packages/cutlass / dsl_packages/cutlass tree (the payload now spans several wheels) instead of only the first match.
  • Raise a clear error (instead of reporting success) when no matching platform artifact exists or no runtime library / cutlass python payload was extracted.

Repro / verification

python -m venv v && . v/bin/activate && pip install -U pip
cd python/CuTeDSL
python prep_editable_install.py          # before: 0 files copied, exit 0; after: libcute_dsl_runtime.so + cutlass/_mlir vendored
CUTLASS_IR_BUILD_DIR=$PWD ./setup.sh --editable
python -c "import cutlass, cutlass.cute as cute; print(cutlass.__file__)"

Verified: 4.6.1 cu12 end-to-end (import + cute.compile of a trivial kernel, no GPU required), cu13 dependency resolution, unchanged behavior on the pre-split 4.3.5 wheel, and the new failure messages.

Related: #3204 attempted this earlier (now stale); this PR is confined to prep_editable_install.py, follows the shim's own Requires-Dist pins (so it keeps working when the companion set changes, e.g. the cu12/core additions in 4.6.x), and keeps the CUDA-variant choice consistent with setup.sh --cu12/--cu13.

…heels

Since 4.4.0 the nvidia-cutlass-dsl wheel on PyPI is a metadata-only shim;
the runtime libraries and python packages (cutlass/_mlir in particular)
moved to per-platform nvidia-cutlass-dsl-libs-{base,core,cu12,cu13} wheels
referenced via Requires-Dist, under dsl_packages/ instead of
python_packages/. prep_editable_install.py still downloaded only the
top-level wheel with --no-deps and extracted nothing, then reported
success, leaving editable installs failing at import time with
ModuleNotFoundError: No module named 'cutlass._mlir'.

Detect the metadata-only shim by inspecting its contents and follow its
Requires-Dist entries within the nvidia-cutlass-dsl-libs-* family
transitively, keeping only the requested CUDA variant among the cuNN
wheels (--cu12 default, --cu13 to match setup.sh); merge every bundled
cutlass payload directory found under python_packages/ or dsl_packages/
instead of only the first; raise a clear error instead of succeeding
when no runtime library or cutlass python payload was extracted.
Pre-split wheels (<= 4.3.x) carry their payload in the top-level wheel
and are handled exactly as before.

Signed-off-by: zky <51477259+zkyue@users.noreply.github.com>
@brandon-yujie-sun

Copy link
Copy Markdown
Collaborator

@zekunf-nv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CuTeDSL editable install broken: prep_editable_install.py extracts nothing from the split nvidia-cutlass-dsl wheels (>= 4.4.0)

2 participants