fix(hip): do not leak the windows.h min/max macros from public headers #44
All Vouch review confidence checks passed
Residual risk 0.07 = Change Risk (0.34) × (1 − Review Confidence (0.78)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.34 · 103 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.65 · 2 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.278
Real PR Conversation Timeline
5 items
<!-- rocm-security-gh:pr-findings:v1 -->
<details>
<summary><b>Security scan found no critical or high findings on lines changed by this pull request</b></summary>
View the security scan run for complete reports.
_“New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta._
</details>
lgtm thanks!
Approved
Approved these changes.
stanleytsang-amd
psamfass
Description
On Windows,
include/cuda/std/__thread/threading_support_win32.hincludes<windows.h>withoutNOMINMAX. The Windows SDK then defines the function-like macrosmin(a, b)andmax(a, b). libhipcxx's own protection (_CCCL_PUSH_MACROS/__cccl/prologue.h) is included after<windows.h>and only saves and undefines macros that are already defined, so the macros are restored as defined at the end and leak into whatever header the user includes next.Any broad libhipcxx include that reaches this file (
<cuda/std/atomic>,<cuda/barrier>,<cuda/memory_resource>, ...) can therefore break unrelated code that usesstd::min(...)orstd::numeric_limits<T>::max(). A concrete case is hipCUB 3.1: itsutil_env.hppincludes<cuda/memory_resource>, which reachesthreading_support_win32.h, and the following rocPRIM headers then fail to parse on Windows.Fix
Define
NOMINMAXonly around the<windows.h>include and restore the includer's ownNOMINMAXstate afterwards:threading_support_win32.h(the actual leak).cuda/__driver/driver_api.hfor consistency (not active on HIP, so not part of this failure).Testing
test/libcudacxx/libcxx/macros/windows_no_minmax_leak.compile.pass.cpp. It#undefsNOMINMAX(the lit config passes-DNOMINMAXon Windows, which hid this problem in the existing tests), includes<cuda/std/atomic>,<cuda/std/latch>and<cuda/std/semaphore>, and#errors ifmin/maxare defined afterwards or ifNOMINMAXis left defined.windows.hthat mimics the SDK behaviour (definesmin/maxunlessNOMINMAX), forcing_CCCL_HAS_THREAD_API_WIN32: the original header leaks the macros, the fixed header does not.Checklist