[BugFix][Carver] Parse lettered SM arch strings in check_sm_version (#2891)
* [BugFix][Carver] Parse lettered SM arch strings in check_sm_version
check_sm_version gated on str.isdigit(), so any arch carrying the trailing
feature-set letter that nvcc and CUTLASS use for Hopper and newer, sm_90a,
sm_100a, sm_103a, fell through to the -1 sentinel instead of parsing to 90,
100 or 103.
Those lettered strings are the real value of target.attrs["arch"], not a
hypothetical one: contrib/nvcc.py already does .rstrip("af") on the same
attribute, contrib/nvrtc.py documents "90a" as valid, and
carver/roller/policy/tensorcore.py compares compute_capability against
"sm_90a" directly. So one path handled the suffix and this one did not.
The -1 then silently corrupted capability dispatch. sm_version feeds
is_volta_arch, is_ampere_arch, is_ada_arch, is_hopper_arch and
has_mma_support, and matmul_analysis compares the same value against 70,
80 and 90. With -1 a real Hopper target failed every one of those checks,
so it was treated as pre-sm_70 and quietly lost its arch-specific
pipeline, block-reduce and MMA dispatch. No error was raised.
Parse the leading digits instead of requiring an all-digit string, keeping
-1 only for genuinely non-CUDA input such as a HIP gfx942 target. The bare
numeric form that was already accepted stays accepted.
matmul_analysis carried a second copy of the identical body, so fixing one
place would have left the other wrong. It now imports the shared helper.
Fixes #2852
* [Bugfix] Anchor the sm_ prefix in the arch pattern
str.replace removed every occurrence, so a malformed value like sm_sm_90
parsed as 90 instead of returning the -1 sentinel. Matching the optional
prefix inside the pattern keeps one source of truth for the grammar and
leaves no way for a second prefix to be stripped away. A
Aditya Singh committed
12dbf3e9d30d84b5c27d7b8b672c268457f7eb27
Parent: 2722488
Committed by GitHub <noreply@github.com>
on 8/7/2026, 7:18:16 AM