[GH-ISSUE #575] Windows HIP Release build can retain empty optimization flags after a failed first configure #236

Closed
opened 2026-10-29 21:23:03 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @sakugetu on GitHub (Oct 27, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/575

Summary

On native Windows with the HIP backend, a failed initial CMake configure left CMAKE_HIP_FLAGS_RELEASE empty. After the SDK problem was repaired, the same build directory produced a working Release executable, but its HIP kernels were compiled without optimization. C++ still used -O3 -DNDEBUG, so checking only the build type or C++ flags missed it.

This matches the failure described and fixed in upstream Strata PR #376. Maya's cmake/hip_backend.cmake at the tested commit calls enable_language(HIP) without the empty per-configuration flags repair.

Environment

  • Maya v1.1.31, commit c4be54416a4f30a837c2fae91816dc9550d68b61
  • Radeon 8060S / gfx1151, 128 GB unified memory, 96 GB assigned to graphics
  • Native Windows 11 Pro 25H2, build 26200.9711
  • GPU driver 32.0.31007.5012; Visual Studio Build Tools 2022
  • AMD ROCm SDK 7.14.1 wheels
  • DeepSeek-V4.1-Flash-1017 Maya-XS

Failure sequence and evidence

  1. The original configure failed HIP compiler identification because clang_rt.builtins.lib was missing from the generated SDK layout.
  2. The library layout was repaired and the build completed.
  3. The existing cache still contained:
    • CMAKE_BUILD_TYPE=Release
    • CMAKE_CXX_FLAGS_RELEASE=-O3 -DNDEBUG
    • CMAKE_HIP_FLAGS_RELEASE= (empty)
  4. The actual ds4_model.cu object rule in build.ninja had the ROCm paths, architecture, language standard and compatibility includes, but no -O2/-O3 flag.
  5. Compiler command inspection confirmed the unoptimized HIP build. After the repair below, host and device compilation both had -O3.

The SDK-link repair had already stopped the crashes, but generation remained extremely slow: two tiny requests took about 25 seconds to first output, and a 100-token prompt produced no output within a 300-second client limit.

Local repair and measured result

A separate source/build directory at the same fixed Maya commit was built with an explicit:

-DCMAKE_HIP_FLAGS_RELEASE="-O3 -DNDEBUG"

No fast-math flag was added. DS4_LT=0 was kept for the optimized comparison; that switch alone had not resolved the delay. There were no driver, page-file or OS changes.

  • Two tiny-prompt diagnostic TTFT measurements: 25.05 / 24.41 seconds before the optimized build, 0.95 / 0.88 seconds after.
  • The representative 100-token prompt, previously still without output at the 300-second limit, reached its first output in 3.66 seconds after the rebuild.
  • A subsequent 20-prompt suite plus two repeat requests completed 22/22. At 32K configured context, thinking and DSpark off, sequential requests: short-prompt median TTFT 1.80 seconds and engine-reported decode 13.1 tok/s; 8,192-token input median TTFT 40.25 seconds and decode 13.8 tok/s.

These are diagnostic/local measurements, not the official --bench protocol. The very small outputs are not a reliable throughput benchmark. The runtime SDK layout was repaired before the optimization test, so its crash fix should not be conflated with this build-flags fix.

Suggested fix

Consider carrying over Strata #376's handling after enable_language(HIP): restore empty per-configuration HIP flags from CMake's corresponding initialized defaults, preserving non-empty user overrides. A configure-time warning or build diagnostic showing the effective HIP Release flags would also help.

The related source locations in this tested version are:

Strata #376 contains a minimal failed-configure/reconfigure reproducer on Windows and Linux. Here, the initial failure was missing SDK builtins, not VS 2026's headers. I have not tested NVIDIA or later Maya commits.

Originally created by @sakugetu on GitHub (Oct 27, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/575 ## Summary On native Windows with the HIP backend, a failed initial CMake configure left `CMAKE_HIP_FLAGS_RELEASE` empty. After the SDK problem was repaired, the same build directory produced a working Release executable, but its HIP kernels were compiled without optimization. C++ still used `-O3 -DNDEBUG`, so checking only the build type or C++ flags missed it. This matches the failure described and fixed in upstream Strata PR [#376](https://github.com/Niko1221/Strata/pull/376). Maya's `cmake/hip_backend.cmake` at the tested commit calls `enable_language(HIP)` without the empty per-configuration flags repair. ## Environment - Maya v1.1.31, commit `c4be54416a4f30a837c2fae91816dc9550d68b61` - Radeon 8060S / `gfx1151`, 128 GB unified memory, 96 GB assigned to graphics - Native Windows 11 Pro 25H2, build 26200.9711 - GPU driver 32.0.31007.5012; Visual Studio Build Tools 2022 - AMD ROCm SDK 7.14.1 wheels - DeepSeek-V4.1-Flash-1017 Maya-XS ## Failure sequence and evidence 1. The original configure failed HIP compiler identification because `clang_rt.builtins.lib` was missing from the generated SDK layout. 2. The library layout was repaired and the build completed. 3. The existing cache still contained: - `CMAKE_BUILD_TYPE=Release` - `CMAKE_CXX_FLAGS_RELEASE=-O3 -DNDEBUG` - `CMAKE_HIP_FLAGS_RELEASE=` (empty) 4. The actual `ds4_model.cu` object rule in `build.ninja` had the ROCm paths, architecture, language standard and compatibility includes, but **no `-O2`/`-O3` flag**. 5. Compiler command inspection confirmed the unoptimized HIP build. After the repair below, host and device compilation both had `-O3`. The SDK-link repair had already stopped the crashes, but generation remained extremely slow: two tiny requests took about 25 seconds to first output, and a 100-token prompt produced no output within a 300-second client limit. ## Local repair and measured result A separate source/build directory at the same fixed Maya commit was built with an explicit: ```text -DCMAKE_HIP_FLAGS_RELEASE="-O3 -DNDEBUG" ``` No fast-math flag was added. `DS4_LT=0` was kept for the optimized comparison; that switch alone had not resolved the delay. There were no driver, page-file or OS changes. - Two tiny-prompt diagnostic TTFT measurements: 25.05 / 24.41 seconds before the optimized build, 0.95 / 0.88 seconds after. - The representative 100-token prompt, previously still without output at the 300-second limit, reached its first output in 3.66 seconds after the rebuild. - A subsequent 20-prompt suite plus two repeat requests completed 22/22. At 32K configured context, thinking and DSpark off, sequential requests: short-prompt median TTFT 1.80 seconds and engine-reported decode 13.1 tok/s; 8,192-token input median TTFT 40.25 seconds and decode 13.8 tok/s. These are diagnostic/local measurements, not the official `--bench` protocol. The very small outputs are not a reliable throughput benchmark. The runtime SDK layout was repaired before the optimization test, so its crash fix should not be conflated with this build-flags fix. ## Suggested fix Consider carrying over Strata #376's handling after `enable_language(HIP)`: restore empty per-configuration HIP flags from CMake's corresponding initialized defaults, preserving non-empty user overrides. A configure-time warning or build diagnostic showing the effective HIP Release flags would also help. The related source locations in this tested version are: - [cmake/hip_backend.cmake](https://github.com/mw00/project-maya/blob/c4be54416a4f30a837c2fae91816dc9550d68b61/cmake/hip_backend.cmake) - [maya.py: compile_engine_hip](https://github.com/mw00/project-maya/blob/c4be54416a4f30a837c2fae91816dc9550d68b61/maya.py#L1751-L1798) Strata #376 contains a minimal failed-configure/reconfigure reproducer on Windows and Linux. Here, the initial failure was missing SDK builtins, not VS 2026's headers. I have not tested NVIDIA or later Maya commits.
Author
Owner

@mw00 commented on GitHub (Oct 28, 2026):

Fixed in v1.1.36: if a failed first configure left the HIP Release flags empty, the build now sets -O3 -DNDEBUG itself, so the kernels are never built unoptimised. Thank you @sakugetu for finding it and for the clear steps.

Released in v1.1.36: https://github.com/mw00/project-maya/releases/tag/v1.1.36

<!-- gh-comment-id:6480776675 --> @mw00 commented on GitHub (Oct 28, 2026): Fixed in v1.1.36: if a failed first configure left the HIP Release flags empty, the build now sets `-O3 -DNDEBUG` itself, so the kernels are never built unoptimised. Thank you @sakugetu for finding it and for the clear steps. Released in **v1.1.36**: https://github.com/mw00/project-maya/releases/tag/v1.1.36
Sign in to join this conversation.
No labels
pull-request
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
mw00/project-maya#236
No description provided.