[PR #373] [CLOSED] HIP: build with Visual Studio 2026's C++ library (MSVC 14.51+) #2603

Closed
opened 2026-11-04 02:01:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/373
Author: @BlueKingMuch
Created: 10/1/2026
Status: ❌ Closed

Base: main ← Head: win-vs2026


📝 Commits (10+)

  • 2575cb1 C-3: the prompt path's GDN short conv tiled over tokens
  • df6980d E-2: prefetch the i-quant expert rows ahead of the AVX-512 decode; an opt-in gather decode
  • cf68b00 D-5: the prompt path's expert stream is issued by its own host thread
  • cb91f2a serve: keep image parts in tool/assistant messages
  • 456011e Layer split limits: docs/MULTI_GPU.md and bench/results/2026-09-29-layer-split-limits
  • f0bbe97 E-4 (prompt side): the draft layer's pass over a prompt chunk without a host sync per group
  • efddd74 E-6: a verify layer whose routed experts are all in VRAM needs nothing from the host
  • 66f4341 D-2: the prompt path's GDN recurrence split over value columns, the output norm in its own kernel
  • 0abcd5b E-6: the device plan opt-in (STRATA_VERIFY_DEVICE_PLAN=1)
  • 57fa1fd serve: routing traces from the live server (--dump-routing under --serve)

📊 Changes

2 files changed (+22 additions, -0 deletions)

View changed files

📝 cmake/hip_backend.cmake (+8 -0)
➕ include/strata/hip_compat/windows/cmath (+14 -0)

📄 Description

With the HIP SDK 7.2 and the C++ library of Visual Studio 2026 18.6 or newer (MSVC 14.51+), every HIP compile on Windows fails, CMake's identification of the HIP compiler included, so the Windows HIP engine (#356) does not get past the configure:

__device__ function 'isgreater' cannot overload __host__ __device__ function 'isgreater'

Since MSVC 14.51 the Microsoft STL declares isgreater, isless & co. constexpr when the compiler is clang (microsoft/STL#5717). The HIP SDK 7.2's clang includes <cmath> before its own __device__ math declarations, so those constexpr functions are already implicitly __host__ __device__ when clang's __device__ overloads arrive, and the two collide. clang with llvm/llvm-project#201563 includes its declarations first; llama.cpp ran into the same error (ggml-org/llama.cpp#22570).

What changes

  • include/strata/hip_compat/windows/cmath is found for <cmath> ahead of the Visual Studio headers. It includes clang's __clang_cuda_math_forward_declares.h (HIP compiles only, not hipRTC), then the real <cmath> with #include_next: the order llvm/llvm-project#201563 gives clang itself.
  • cmake/hip_backend.cmake puts that folder on CMAKE_HIP_FLAGS before enable_language(HIP), on Windows only, so CMake's compiler checks get it too.

With an older MSVC the order makes no difference (its comparisons are not constexpr), and a clang that has the fix includes the declarations first by itself; their header has an include guard, so it is read once either way. Linux and CUDA builds never see the folder.

Tested

Windows 11, Visual Studio 2026 Build Tools (MSVC 14.51), HIP SDK 7.2 (clang 21), CMake 4.0.1, RX 6800. Without the folder the configure stops at the HIP compiler's identification with the error above (that compile is CMake's own test file, so it does not depend on Strata's sources; seen here on 0.1.30 with #247's Windows build). With it, 0.1.31 with #356 and #311 configures, builds and runs.

Not tested with MSVC 14.50 or older. Going by the STL's changelog and sources, those declare these comparisons inline, not constexpr, so they should not need this, and the reordering does nothing there.

🤖 Generated with Claude Code

https://claude.ai/code/session_015Ld5YDzuKW1hgMVwwgRZDP


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/373 **Author:** [@BlueKingMuch](https://github.com/BlueKingMuch) **Created:** 10/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `win-vs2026` --- ### 📝 Commits (10+) - [`2575cb1`](https://github.com/Niko1221/Strata/commit/2575cb1636d906d195bf56f95b9527098a1fbd99) C-3: the prompt path's GDN short conv tiled over tokens - [`df6980d`](https://github.com/Niko1221/Strata/commit/df6980d43f1c499d2929006d89249a079920b223) E-2: prefetch the i-quant expert rows ahead of the AVX-512 decode; an opt-in gather decode - [`cf68b00`](https://github.com/Niko1221/Strata/commit/cf68b004c25f3ec60997d780422ce92e0e959f23) D-5: the prompt path's expert stream is issued by its own host thread - [`cb91f2a`](https://github.com/Niko1221/Strata/commit/cb91f2ad5039a27c4bf775d9bfe6ddfdb98bd5c1) serve: keep image parts in tool/assistant messages - [`456011e`](https://github.com/Niko1221/Strata/commit/456011edebed4b2b36d51d4b76b703c4ae687e5c) Layer split limits: docs/MULTI_GPU.md and bench/results/2026-09-29-layer-split-limits - [`f0bbe97`](https://github.com/Niko1221/Strata/commit/f0bbe978ec4fab037dda7cb7288ff8fcd604025b) E-4 (prompt side): the draft layer's pass over a prompt chunk without a host sync per group - [`efddd74`](https://github.com/Niko1221/Strata/commit/efddd7488092137c64300a22509a4c23337e33da) E-6: a verify layer whose routed experts are all in VRAM needs nothing from the host - [`66f4341`](https://github.com/Niko1221/Strata/commit/66f4341e6c50c5436037e4a1bc47f5ff9fb2cd47) D-2: the prompt path's GDN recurrence split over value columns, the output norm in its own kernel - [`0abcd5b`](https://github.com/Niko1221/Strata/commit/0abcd5b3c7652c685ea9e52636751bcf6b22a6ed) E-6: the device plan opt-in (STRATA_VERIFY_DEVICE_PLAN=1) - [`57fa1fd`](https://github.com/Niko1221/Strata/commit/57fa1fde2503d1e382abb870695d4835118c883a) serve: routing traces from the live server (--dump-routing under --serve) ### 📊 Changes **2 files changed** (+22 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmake/hip_backend.cmake` (+8 -0) ➕ `include/strata/hip_compat/windows/cmath` (+14 -0) </details> ### 📄 Description With the HIP SDK 7.2 and the C++ library of Visual Studio 2026 18.6 or newer (MSVC 14.51+), every HIP compile on Windows fails, CMake's identification of the HIP compiler included, so the Windows HIP engine (#356) does not get past the configure: ``` __device__ function 'isgreater' cannot overload __host__ __device__ function 'isgreater' ``` Since MSVC 14.51 the Microsoft STL declares `isgreater`, `isless` & co. `constexpr` when the compiler is clang (microsoft/STL#5717). The HIP SDK 7.2's clang includes `<cmath>` before its own `__device__` math declarations, so those `constexpr` functions are already implicitly `__host__ __device__` when clang's `__device__` overloads arrive, and the two collide. clang with llvm/llvm-project#201563 includes its declarations first; llama.cpp ran into the same error (ggml-org/llama.cpp#22570). ## What changes - `include/strata/hip_compat/windows/cmath` is found for `<cmath>` ahead of the Visual Studio headers. It includes clang's `__clang_cuda_math_forward_declares.h` (HIP compiles only, not hipRTC), then the real `<cmath>` with `#include_next`: the order llvm/llvm-project#201563 gives clang itself. - `cmake/hip_backend.cmake` puts that folder on `CMAKE_HIP_FLAGS` before `enable_language(HIP)`, on Windows only, so CMake's compiler checks get it too. With an older MSVC the order makes no difference (its comparisons are not `constexpr`), and a clang that has the fix includes the declarations first by itself; their header has an include guard, so it is read once either way. Linux and CUDA builds never see the folder. ## Tested Windows 11, Visual Studio 2026 Build Tools (MSVC 14.51), HIP SDK 7.2 (clang 21), CMake 4.0.1, RX 6800. Without the folder the configure stops at the HIP compiler's identification with the error above (that compile is CMake's own test file, so it does not depend on Strata's sources; seen here on 0.1.30 with #247's Windows build). With it, 0.1.31 with #356 and #311 configures, builds and runs. Not tested with MSVC 14.50 or older. Going by the STL's changelog and sources, those declare these comparisons `inline`, not `constexpr`, so they should not need this, and the reordering does nothing there. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015Ld5YDzuKW1hgMVwwgRZDP --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:41 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2603
No description provided.