Skip to content

Commit 113d1ca

Browse files
committed
[clang][openmp] - Ensure HIP_PLATFORM is set for hip_host_overlay
Fix __has_include check to look in hip directory. If an OpenMP program is using the HIP API (like hipMalloc), then ensure HIP_PLATFORM_* is set. This also avoids problems with OpenMP programs that do not use the HIP API as the header will not be used. Change-Id: Iac43fbef395f8ab91b9ae9744daed000d994d106
1 parent 39ffbda commit 113d1ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Headers/openmp_wrappers/hip_host_overlay.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
// arg is set to 0 to prevent dual setting of the HSA coarse-grain attribute.
1919
// Only the OpenMP runtime table tracking coarse-grain memory is updated.
2020

21-
#if defined(_OPENMP) && __has_include(<hip_runtime_api.h>)
22-
#include <hip_runtime_api.h>
21+
#if defined(_OPENMP) && __has_include(<hip/hip_runtime_api.h>) && (defined(__HIP_PLATFORM_AMD__) || defined(__HIP_PLATFORM_NVIDIA__))
22+
#include <hip/hip_runtime_api.h>
2323
#include <omp.h>
2424

2525
// Define Overlays for HIP host functions

0 commit comments

Comments
 (0)