Skip to content

Handle compute capability with letter at end#20

Open
sempervictus wants to merge 1 commit into
Narsil:mainfrom
sempervictus:bug/nv_computecap_has_letters
Open

Handle compute capability with letter at end#20
sempervictus wants to merge 1 commit into
Narsil:mainfrom
sempervictus:bug/nv_computecap_has_letters

Conversation

@sempervictus
Copy link
Copy Markdown

@sempervictus sempervictus commented Jan 26, 2026

Cutlass needs to know about SM120a to properly build certain code such sa block-scaled MMA and FP4 related components ( NVIDIA/cutlass#2820
pytorch/pytorch#172807
).

Attempt to remedy this by allowing the parser to detect the digits of the compute cap returned by smi or taken from the env when the default parse fails by dropping the last char of the parsed string. Record the provided cap in the environment variable target to pass it downstream but retain the usize datatype for this library for now.

Cutlass needs to know about SM120a to properly build certain code
such sa block-scaled MMA and FP4 relates components (
NVIDIA/cutlass#2820
pytorch/pytorch#172807
).

Attempt to remedy this by allowing the parser to detect the digits
of the compute cap returned by smi or taken from the env when the
default parse fails by dropping the last char of the parsed string.
Record the provided cap in the environment variable target to pass
it downstream but retain the usize datatype for this library for
now.
Comment thread src/lib.rs
compute_cap_str
.parse::<usize>()
.expect("Could not parse code")
match compute_cap_str.parse::<usize>() {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just parse into its own type ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that would be the proper fix, I did a quick grep for users and didn't quite have time to validate interface sanity for such a change so threw this up as a quickie "fix"

jagan-nuvai added a commit to Nuvai/cuda-bindgen that referenced this pull request Mar 28, 2026
…ffix caps

- Add multi-gencode / fat binary support (CUDA_COMPUTE_CAPS env, compute_caps() builder)
- build_lib uses -gencode flags for multiple architectures, build_ptx targets lowest CC
- Builder is now Clone; build_lib/build_ptx take &self for reuse (build lib then ptx)
- Add CUDA_HOME env var, versioned /usr/local/cuda-* paths, more Windows paths
- Handle letter-suffixed compute caps (e.g. 120a for Blackwell SM_120a)
- Add Windows MSVC nvcc flags (#[cfg(windows)] -Xcompiler /Zc:preprocessor -DNOGDI)
- build_lib returns Result instead of panicking
- cuda_root() now follows builder pattern (returns Self)
- Remove spurious #[allow(unused)] on include_options
- Add cargo:rerun-if-env-changed for all CUDA env vars

Addresses upstream: Narsil#11 (multi compute_cap), Narsil#5 (reusable builder),
Narsil#15 (env vars/paths), Narsil#20 (letter caps), Narsil#21 (Windows MSVC),
Narsil#1 (error handling), Narsil#9 (format expect)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants