Skip to content

Fix preprocessor guard in gloo/cuda.h for HIP/ROCm builds (#507)#507

Closed
dolpm wants to merge 1 commit into
pytorch:mainfrom
dolpm:export-D106397943
Closed

Fix preprocessor guard in gloo/cuda.h for HIP/ROCm builds (#507)#507
dolpm wants to merge 1 commit into
pytorch:mainfrom
dolpm:export-D106397943

Conversation

@dolpm
Copy link
Copy Markdown

@dolpm dolpm commented May 26, 2026

Summary:

#506

Change #if !GLOO_USE_CUDA to #if !GLOO_USE_CUDA && !GLOO_USE_ROCM so the guard checks whether the either macro is defined and non-zero. The old form fails when GLOO_USE_CUDA is defined to 0 (e.g., in a ROCm-only CMake build via #cmakedefine01), because !0 evaluates to true and triggers the #error even though the configuration header was properly generated.

Reviewed By: d4l3k

Differential Revision: D106397943

@meta-cla meta-cla Bot added the CLA Signed label May 26, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 26, 2026

@dolpm has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106397943.

@meta-codesync meta-codesync Bot changed the title Fix preprocessor guard in gloo/cuda.h for HIP/ROCm builds Fix preprocessor guard in gloo/cuda.h for HIP/ROCm builds (#507) May 26, 2026
dolpm added a commit to dolpm/gloo that referenced this pull request May 26, 2026
)

Summary:

pytorch#506

Change `#if !GLOO_USE_CUDA` to `#if !defined(GLOO_USE_CUDA)` so the guard checks whether the config macro was defined at all, rather than checking its value. The old form fails when `GLOO_USE_CUDA` is defined to `0` (e.g., in a ROCm-only CMake build via `#cmakedefine01`), because `!0` evaluates to true and triggers the `#error` even though the configuration header was properly generated.

Reviewed By: d4l3k

Differential Revision: D106397943
@dolpm dolpm force-pushed the export-D106397943 branch from 806fd98 to e1a5493 Compare May 26, 2026 18:54
)

Summary:

pytorch#506

Change `#if !GLOO_USE_CUDA` to `#if !GLOO_USE_CUDA && !GLOO_USE_ROCM` so the guard checks whether the either macro is defined and non-zero. The old form fails when `GLOO_USE_CUDA` is defined to `0` (e.g., in a ROCm-only CMake build via `#cmakedefine01`), because `!0` evaluates to true and triggers the `#error` even though the configuration header was properly generated.

Reviewed By: d4l3k

Differential Revision: D106397943
@dolpm dolpm force-pushed the export-D106397943 branch from e1a5493 to 4aa6fc2 Compare May 26, 2026 18:55
@dolpm dolpm closed this May 28, 2026
@dolpm dolpm deleted the export-D106397943 branch May 28, 2026 04:14
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.

Undefined GLOO_USE_ROCM error together with HIP

2 participants