Skip to content

Fix sm100 gemm wrong static constexpr that breaks compilation on Windows #2167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SystemPanic
Copy link

constexpr was incorrectly added to the function definition only for this architecture, breaking the compilation of Cutlass on Windows.

@hwu36
Copy link
Collaborator

hwu36 commented Mar 18, 2025

@d-k-b

Copy link

This PR has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates. This PR will be labeled inactive-90d if there is no activity in the next 60 days.

Signed-off-by: Javier <25750030+SystemPanic@users.noreply.github.com>
@@ -523,7 +523,7 @@ using std::is_trivially_copyable;

#endif

#if (201703L <=__cplusplus)
#if defined(_MSC_VER) || (201703L <=__cplusplus)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like a symptom of another issue. What error did you see here?

Copy link
Author

Choose a reason for hiding this comment

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

@d-k-b If defined(_MSC_VER) is not included, is_unsigned_v is missing.

For example, with the latest MSVC 2022 with CL 19.43.34810, it raises the following error:

include/cutlass/exmy_base.h(404): error: namespace "cutlass::platform" has no member "is_unsigned_v"
    static_assert(cutlass::platform::is_unsigned_v<Storage>, "Use an unsigned integer for StorageType");

Related: https://learn.microsoft.com/es-es/cpp/build/reference/zc-cplusplus?view=msvc-170

If -Xcompiler=/Zc:__cplusplus is added to NVCC, version is detected correctly without including defined(_MSC_VER)

I don't have the time to fully check if including defined(_MSC_VER) in this place is problematic when compiling Cutlass with a standard lower than C++17, in my limited tests, it's not.

If it's the case, tell me and I remove it from the PR.

Copy link
Collaborator

@d-k-b d-k-b Jun 3, 2025

Choose a reason for hiding this comment

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

The CUTLASS CMake code applies the __cplusplus flag to MSVC compilation automatically. Is the error being seen with a build outside of CMake? I'd prefer we revert this change for this PR and then if it's needed for some scenario we handle it in a separate request.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")

Suggested change
#if defined(_MSC_VER) || (201703L <=__cplusplus)
#if (201703L <= __cplusplus)

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I see where the problem is.

vLLM it's being built with CMake, but it's not adding CUTLASS in the standard way, so the MSVC specific flags

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
are not being applied at all.

Commit reverted.

This reverts commit 2e8cfc1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants