Skip to content

Fix MSVC CUDA build: is_unsigned_v not available in cutlass::platform#3229

Open
TxsharDev wants to merge 1 commit into
NVIDIA:mainfrom
TxsharDev:fix/msvc-is-unsigned-v-exmy-base
Open

Fix MSVC CUDA build: is_unsigned_v not available in cutlass::platform#3229
TxsharDev wants to merge 1 commit into
NVIDIA:mainfrom
TxsharDev:fix/msvc-is-unsigned-v-exmy-base

Conversation

@TxsharDev
Copy link
Copy Markdown

@TxsharDev TxsharDev commented May 12, 2026

Problem

Building any project that includes cutlass/exmy_base.h on Windows with MSVC + CUDA fails with:

cutlass/exmy_base.h(404): error: namespace "cutlass::platform" has no member "is_unsigned_v"

Hit this building flash-attention against PyTorch 2.10+ on Windows (CUDA 12.8, MSVC 14.43).

Root cause

is_integral_v and is_unsigned_v in platform.h are imported from the STL inside a #if (201703L <= __cplusplus) guard. On MSVC, __cplusplus is not set to 201703L without /Zc:__cplusplus, so the imports never fire. But CUTLASS_CXX17_OR_LATER (which correctly checks _MSVC_LANG via CUTLASS_CPLUSPLUS) evaluates to 1, enabling code that uses these traits. Symbol used but never declared.

Fix

  • platform.h: Define is_integral_v and is_unsigned_v as constexpr bool variable templates using ::value, removing the fragile __cplusplus guard entirely. Also import is_unsigned unconditionally (matching is_arithmetic, is_void, etc. which are already unconditional in the same file).
  • No changes to exmy_base.h - fixing platform.h makes the existing code work as intended.
  • Unit test: Added platform_traits.cpp to verify both traits are available and correct.

Verified

Built flash-attention 2.8.3 from source on Windows with this fix applied — MSVC 14.43, CUDA 12.8, PyTorch 2.11, Python 3.12. Clean build, all kernels compile.

@TxsharDev TxsharDev force-pushed the fix/msvc-is-unsigned-v-exmy-base branch from 9bf30ce to ebfa4c3 Compare May 12, 2026 19:09
is_integral_v and is_unsigned_v in platform.h were imported from the
STL inside a #if (201703L <= __cplusplus) guard. On MSVC, __cplusplus
is not set to 201703L without /Zc:__cplusplus, so the imports never
fire -- but CUTLASS_CXX17_OR_LATER correctly evaluates to 1 via
_MSVC_LANG, enabling code that uses these traits. Result: symbol used
but never declared.

Breaks Windows CUDA builds of downstream projects (e.g. flash-attention
with PyTorch >= 2.10).

Fix: define is_integral_v and is_unsigned_v as constexpr bool variable
templates using ::value, removing the fragile __cplusplus guard. Also
import is_unsigned unconditionally (matching is_arithmetic, is_void,
etc. which are already unconditional). Add unit test.
@TxsharDev TxsharDev force-pushed the fix/msvc-is-unsigned-v-exmy-base branch from ebfa4c3 to d70be29 Compare May 12, 2026 21:14
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.

1 participant