Skip to content

Commit facec17

Browse files
authored
[SYCL][HIP] Rename the ROCm plugin to HIP (#4418)
HIP is a better name in this case as it is the API the plugin is actually built on rather than ROCm which is more of a framework. As discussed this patch renames the ROCm plugin to HIP, it is thus very large but doesn't have any functional changes. I tested it on both AMD and NVIDIA with `check-sycl-hip` and `check-sycl-hip-on-device`, and the results were the same than before this patch with `check-sycl-rocm` and `check-sycl-rocm-on-device`.
1 parent 43c5433 commit facec17

35 files changed

+766
-769
lines changed

buildbot/configure.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def do_configure(args):
3030
libclc_gen_remangled_variants = 'OFF'
3131
sycl_build_pi_cuda = 'OFF'
3232
sycl_build_pi_esimd_cpu = 'OFF'
33-
sycl_build_pi_rocm = 'OFF'
34-
sycl_build_pi_rocm_platform = 'AMD'
33+
sycl_build_pi_hip = 'OFF'
34+
sycl_build_pi_hip_platform = 'AMD'
3535
sycl_werror = 'ON'
3636
llvm_enable_assertions = 'ON'
3737
llvm_enable_doxygen = 'OFF'
@@ -48,7 +48,7 @@ def do_configure(args):
4848
if args.enable_esimd_cpu_emulation:
4949
sycl_build_pi_esimd_cpu = 'ON'
5050

51-
if args.cuda or args.rocm:
51+
if args.cuda or args.hip:
5252
llvm_enable_projects += ';libclc'
5353

5454
if args.cuda:
@@ -57,20 +57,20 @@ def do_configure(args):
5757
libclc_gen_remangled_variants = 'ON'
5858
sycl_build_pi_cuda = 'ON'
5959

60-
if args.rocm:
61-
if args.rocm_platform == 'AMD':
60+
if args.hip:
61+
if args.hip_platform == 'AMD':
6262
llvm_targets_to_build += ';AMDGPU'
6363
libclc_targets_to_build += ';amdgcn--;amdgcn--amdhsa'
6464

65-
# The ROCm plugin for AMD uses lld for linking
65+
# The HIP plugin for AMD uses lld for linking
6666
llvm_enable_projects += ';lld'
67-
elif args.rocm_platform == 'NVIDIA' and not args.cuda:
67+
elif args.hip_platform == 'NVIDIA' and not args.cuda:
6868
llvm_targets_to_build += ';NVPTX'
6969
libclc_targets_to_build += ';nvptx64--;nvptx64--nvidiacl'
7070
libclc_gen_remangled_variants = 'ON'
7171

72-
sycl_build_pi_rocm_platform = args.rocm_platform
73-
sycl_build_pi_rocm = 'ON'
72+
sycl_build_pi_hip_platform = args.hip_platform
73+
sycl_build_pi_hip = 'ON'
7474

7575
if args.no_werror:
7676
sycl_werror = 'OFF'
@@ -107,8 +107,8 @@ def do_configure(args):
107107
"-DLIBCLC_TARGETS_TO_BUILD={}".format(libclc_targets_to_build),
108108
"-DLIBCLC_GENERATE_REMANGLED_VARIANTS={}".format(libclc_gen_remangled_variants),
109109
"-DSYCL_BUILD_PI_CUDA={}".format(sycl_build_pi_cuda),
110-
"-DSYCL_BUILD_PI_ROCM={}".format(sycl_build_pi_rocm),
111-
"-DSYCL_BUILD_PI_ROCM_PLATFORM={}".format(sycl_build_pi_rocm_platform),
110+
"-DSYCL_BUILD_PI_HIP={}".format(sycl_build_pi_hip),
111+
"-DSYCL_BUILD_PI_HIP_PLATFORM={}".format(sycl_build_pi_hip_platform),
112112
"-DLLVM_BUILD_TOOLS=ON",
113113
"-DSYCL_ENABLE_WERROR={}".format(sycl_werror),
114114
"-DCMAKE_INSTALL_PREFIX={}".format(install_dir),
@@ -178,8 +178,8 @@ def main():
178178
parser.add_argument("-t", "--build-type",
179179
metavar="BUILD_TYPE", default="Release", help="build type: Debug, Release")
180180
parser.add_argument("--cuda", action='store_true', help="switch from OpenCL to CUDA")
181-
parser.add_argument("--rocm", action='store_true', help="switch from OpenCL to ROCm")
182-
parser.add_argument("--rocm-platform", type=str, choices=['AMD', 'NVIDIA'], default='AMD', help="choose ROCm backend")
181+
parser.add_argument("--hip", action='store_true', help="switch from OpenCL to HIP")
182+
parser.add_argument("--hip-platform", type=str, choices=['AMD', 'NVIDIA'], default='AMD', help="choose hardware platform for HIP backend")
183183
parser.add_argument("--arm", action='store_true', help="build ARM support rather than x86")
184184
parser.add_argument("--enable-esimd-cpu-emulation", action='store_true', help="build with ESIMD_CPU emulation support")
185185
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")

sycl/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ install(DIRECTORY ${OpenCL_INCLUDE_DIR}/CL
9090
option(SYCL_BUILD_PI_CUDA
9191
"Enables the CUDA backend for the Plugin Interface" OFF)
9292

93-
option(SYCL_BUILD_PI_ROCM
94-
"Enables the ROCM backend for the Plugin Interface" OFF)
93+
option(SYCL_BUILD_PI_HIP
94+
"Enables the HIP backend for the Plugin Interface" OFF)
9595

9696
# Configure SYCL version macro
9797
set(sycl_inc_dir ${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -279,16 +279,16 @@ if(SYCL_BUILD_PI_CUDA)
279279
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libspirv-builtins pi_cuda)
280280
endif()
281281

282-
if(SYCL_BUILD_PI_ROCM)
282+
if(SYCL_BUILD_PI_HIP)
283283
# Ensure that libclc is enabled.
284284
list(FIND LLVM_ENABLE_PROJECTS libclc LIBCLC_FOUND)
285285
if( LIBCLC_FOUND EQUAL -1 )
286286
message(FATAL_ERROR
287-
"ROCM support requires adding \"libclc\" to the CMake argument \"LLVM_ENABLE_PROJECTS\"")
287+
"HIP support requires adding \"libclc\" to the CMake argument \"LLVM_ENABLE_PROJECTS\"")
288288
endif()
289289

290-
add_dependencies(sycl-toolchain libspirv-builtins pi_rocm)
291-
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libspirv-builtins pi_rocm)
290+
add_dependencies(sycl-toolchain libspirv-builtins pi_hip)
291+
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libspirv-builtins pi_hip)
292292
endif()
293293

294294
# TODO : Remove 'if (NOT MSVC)' when CM_EMU supports Windows

sycl/doc/GetStartedGuide.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ and a wide range of compute accelerators such as GPU and FPGA.
99
- [Build DPC++ toolchain](#build-dpc-toolchain)
1010
- [Build DPC++ toolchain with libc++ library](#build-dpc-toolchain-with-libc-library)
1111
- [Build DPC++ toolchain with support for NVIDIA CUDA](#build-dpc-toolchain-with-support-for-nvidia-cuda)
12-
- [Build DPC++ toolchain with support for AMD ROCm](#build-dpc-toolchain-with-support-for-amd-rocm)
13-
- [Build DPC++ toolchain with support for NVIDIA ROCm](#build-dpc-toolchain-with-support-for-nvidia-rocm)
12+
- [Build DPC++ toolchain with support for HIP AMD](#build-dpc-toolchain-with-support-for-hip-amd)
13+
- [Build DPC++ toolchain with support for HIP NVIDIA](#build-dpc-toolchain-with-support-for-hip-nvidia)
1414
- [Build DPC++ toolchain with support for ESIMD CPU Emulation](#build-dpc-toolchain-with-support-for-esimd-cpu)
1515
- [Build Doxygen documentation](#build-doxygen-documentation)
1616
- [Deployment](#deployment)
@@ -30,7 +30,7 @@ and a wide range of compute accelerators such as GPU and FPGA.
3030
- [C++ standard](#c-standard)
3131
- [Known Issues and Limitations](#known-issues-and-limitations)
3232
- [CUDA back-end limitations](#cuda-back-end-limitations)
33-
- [ROCm back-end limitations](#rocm-back-end-limitations)
33+
- [HIP back-end limitations](#hip-back-end-limitations)
3434
- [Find More](#find-more)
3535

3636
## Prerequisites
@@ -108,8 +108,8 @@ flags can be found by launching the script with `--help`):
108108
* `--system-ocl` -> Don't download OpenCL headers and library via CMake but use the system ones
109109
* `--no-werror` -> Don't treat warnings as errors when compiling llvm
110110
* `--cuda` -> use the cuda backend (see [Nvidia CUDA](#build-dpc-toolchain-with-support-for-nvidia-cuda))
111-
* `--rocm` -> use the rocm backend (see [AMD ROCm](#build-dpc-toolchain-with-support-for-amd-rocm))
112-
* `--rocm-platform` -> select the platform used by the rocm backend, `AMD` or `NVIDIA` (see [AMD ROCm](#build-dpc-toolchain-with-support-for-amd-rocm) or see [NVIDIA ROCm](#build-dpc-toolchain-with-support-for-nvidia-rocm))
111+
* `--hip` -> use the HIP backend (see [HIP](#build-dpc-toolchain-with-support-for-hip-amd))
112+
* `--hip-platform` -> select the platform used by the hip backend, `AMD` or `NVIDIA` (see [HIP AMD](#build-dpc-toolchain-with-support-for-hip-amd) or see [HIP NVIDIA](#build-dpc-toolchain-with-support-for-hip-nvidia))
113113
* '--enable-esimd-cpu-emulation' -> enable ESIMD CPU emulation (see [ESIMD CPU emulation](#build-dpc-toolchain-with-support-for-esimd-cpu))
114114
* `--shared-libs` -> Build shared libraries
115115
* `-t` -> Build type (debug or release)
@@ -161,11 +161,12 @@ a Titan RTX GPU (SM 71), but it should work on any GPU compatible with SM 50 or
161161
above. The default SM for the NVIDIA CUDA backend is 5.0. Users can specify
162162
lower values, but some features may not be supported.
163163

164-
### Build DPC++ toolchain with support for AMD ROCm
165-
There is experimental support for DPC++ for ROCm devices.
164+
### Build DPC++ toolchain with support for HIP AMD
166165

167-
To enable support for ROCm devices, follow the instructions for the Linux
168-
DPC++ toolchain, but add the `--rocm` flag to `configure.py`
166+
There is experimental support for DPC++ for HIP devices.
167+
168+
To enable support for HIP devices, follow the instructions for the Linux
169+
DPC++ toolchain, but add the `--hip` flag to `configure.py`
169170

170171
Enabling this flag requires an installation of
171172
ROCm 4.2.0 on the system, refer to
@@ -176,31 +177,31 @@ Currently, the only combination tested is Ubuntu 18.04 with ROCm 4.2.0 using a V
176177
[LLD](https://llvm.org/docs/AMDGPUUsage.html) is necessary for the AMD GPU compilation chain.
177178
The AMDGPU backend generates a standard ELF [ELF] relocatable code object that can be linked by lld to
178179
produce a standard ELF shared code object which can be loaded and executed on an AMDGPU target.
179-
So if you want to support AMD ROCm, you should also build the lld project.
180+
So if you want to support HIP AMD, you should also build the lld project.
180181
[LLD Build Guide](https://lld.llvm.org/)
181182

182183
The following CMake variables can be updated to change where CMake is looking
183-
for the ROCm installation:
184+
for the HIP installation:
184185

185-
* `SYCL_BUILD_PI_ROCM_INCLUDE_DIR`: Path to HIP include directory (default
186+
* `SYCL_BUILD_PI_HIP_INCLUDE_DIR`: Path to HIP include directory (default
186187
`/opt/rocm/hip/include`).
187-
* `SYCL_BUILD_PI_ROCM_HSA_INCLUDE_DIR`: Path to HSA include directory (default
188+
* `SYCL_BUILD_PI_HIP_HSA_INCLUDE_DIR`: Path to HSA include directory (default
188189
`/opt/rocm/hsa/include`).
189-
* `SYCL_BUILD_PI_ROCM_AMD_LIBRARY`: Path to HIP runtime library (default
190+
* `SYCL_BUILD_PI_HIP_AMD_LIBRARY`: Path to HIP runtime library (default
190191
`/opt/rocm/hip/lib/libamdhip64.so`).
191192

192-
### Build DPC++ toolchain with support for NVIDIA ROCm
193+
### Build DPC++ toolchain with support for HIP NVIDIA
193194

194-
There is experimental support for DPC++ for using ROCm on NVIDIA devices.
195+
There is experimental support for DPC++ for using HIP on NVIDIA devices.
195196

196197
This is a compatibility feature and the [CUDA backend](#build-dpc-toolchain-with-support-for-nvidia-cuda)
197198
should be preferred to run on NVIDIA GPUs.
198199

199-
To enable support for NVIDIA ROCm devices, follow the instructions for the Linux
200-
DPC++ toolchain, but add the `--rocm` and `--rocm-platform NVIDIA` flags to
200+
To enable support for HIP NVIDIA devices, follow the instructions for the Linux
201+
DPC++ toolchain, but add the `--hip` and `--hip-platform NVIDIA` flags to
201202
`configure.py`.
202203

203-
Enabling this flag requires ROCm to be installed, more specifically
204+
Enabling this flag requires HIP to be installed, more specifically
204205
[HIP NVCC](https://rocmdocs.amd.com/en/latest/Installation_Guide/HIP-Installation.html#nvidia-platform),
205206
as well as CUDA to be installed, see
206207
[NVIDIA CUDA Installation Guide for Linux](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html).
@@ -468,7 +469,7 @@ skipped.
468469
If CUDA support has been built, it is tested only if there are CUDA devices
469470
available.
470471
471-
If testing with ROCm for AMD make sure to specify the GPU being used
472+
If testing with HIP for AMD make sure to specify the GPU being used
472473
by adding `-Xsycl-target-backend=amdgcn-amd-amdhsa
473474
--offload-arch=<target>` to the CMake variable
474475
`SYCL_CLANG_EXTRA_FLAGS`.
@@ -589,14 +590,14 @@ and run following command:
589590
clang++ -fsycl simple-sycl-app.cpp -o simple-sycl-app.exe
590591
```
591592
592-
When building for CUDA or NVIDIA ROCm, use the CUDA target triple as follows:
593+
When building for CUDA or HIP NVIDIA, use the CUDA target triple as follows:
593594
594595
```bash
595596
clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda \
596597
simple-sycl-app.cpp -o simple-sycl-app-cuda.exe
597598
```
598599
599-
When building for ROCm, use the ROCm target triple and specify the
600+
When building for HIP AMD, use the AMD target triple and specify the
600601
target architecture with `-Xsycl-target-backend --offload-arch=<arch>`
601602
as follows:
602603
@@ -638,8 +639,8 @@ execution, so SYCL runtime will use `default_selector` logic to select one
638639
of accelerators available in the system or SYCL host device.
639640
In this case, the behavior of the `default_selector` can be altered
640641
using the `SYCL_BE` environment variable, setting `PI_CUDA` forces
641-
the usage of the CUDA backend (if available), `PI_ROCM` forces
642-
the usage of the ROCm backend (if available), `PI_OPENCL` will
642+
the usage of the CUDA backend (if available), `PI_HIP` forces
643+
the usage of the HIP backend (if available), `PI_OPENCL` will
643644
force the usage of the OpenCL backend.
644645
645646
```bash
@@ -783,15 +784,15 @@ which contains all the symbols required.
783784
* The NVIDIA OpenCL headers conflict with the OpenCL headers required for this
784785
project and may cause compilation issues on some platforms
785786
786-
### ROCm back-end limitations
787+
### HIP back-end limitations
787788
788789
* For supported Operating Systems, please refer to the [Supported Operating Systems](https://github.com/RadeonOpenCompute/ROCm#supported-operating-systems)
789790
* The only combination tested is Ubuntu 18.04 with ROCm 4.2 using a Vega20 gfx906.
790791
* Judging from the current [test](https://github.com/zjin-lcf/oneAPI-DirectProgramming) results,
791-
there is still a lot of room for improvement in ROCm back-end support. The current problems include three aspects.
792+
there is still a lot of room for improvement in HIP back-end support. The current problems include three aspects.
792793
The first one is at compile time: the `barrier` and `atomic` keywords are not supported.
793-
The second is at runtime: when calling `hipMemcpyDtoHAsync` ROCm API, the program will cause an exception if the input data size is too large.
794-
The third is calculation accuracy: the ROCm backend has obvious errors in the calculation results of some float type operators
794+
The second is at runtime: when calling `hipMemcpyDtoHAsync` HIP API, the program will cause an exception if the input data size is too large.
795+
The third is calculation accuracy: the HIP backend has obvious errors in the calculation results of some float type operators
795796
796797
## Find More
797798

sycl/include/CL/sycl/backend_types.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ enum class backend : char {
2727
cuda = 3,
2828
all = 4,
2929
esimd_cpu = 5,
30-
rocm = 6,
30+
hip = 6,
3131
};
3232

3333
template <backend Backend, typename SYCLObjectT> struct interop;
@@ -58,8 +58,8 @@ inline std::ostream &operator<<(std::ostream &Out, backend be) {
5858
case backend::esimd_cpu:
5959
Out << "esimd_cpu";
6060
break;
61-
case backend::rocm:
62-
Out << "rocm";
61+
case backend::hip:
62+
Out << "hip";
6363
break;
6464
case backend::all:
6565
Out << "all";

sycl/include/CL/sycl/detail/hip_definitions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//==------------ hip_definitions.hpp - SYCL ROCM backend ------------------==//
1+
//==------------ hip_definitions.hpp - SYCL HIP backend -------------------==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

sycl/include/CL/sycl/detail/pi.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ bool trace(TraceLevel level);
6666
#define __SYCL_LEVEL_ZERO_PLUGIN_NAME "pi_level_zero.dll"
6767
#define __SYCL_CUDA_PLUGIN_NAME "pi_cuda.dll"
6868
#define __SYCL_ESIMD_CPU_PLUGIN_NAME "pi_esimd_cpu.dll"
69-
#define __SYCL_ROCM_PLUGIN_NAME "libpi_rocm.dll"
69+
#define __SYCL_HIP_PLUGIN_NAME "libpi_hip.dll"
7070
#else
7171
#define __SYCL_OPENCL_PLUGIN_NAME "libpi_opencl.so"
7272
#define __SYCL_LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.so"
7373
#define __SYCL_CUDA_PLUGIN_NAME "libpi_cuda.so"
7474
#define __SYCL_ESIMD_CPU_PLUGIN_NAME "libpi_esimd_cpu.so"
75-
#define __SYCL_ROCM_PLUGIN_NAME "libpi_rocm.so"
75+
#define __SYCL_HIP_PLUGIN_NAME "libpi_hip.so"
7676
#endif
7777

7878
// Report error and no return (keeps compiler happy about no return statements).

sycl/plugins/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ if(SYCL_BUILD_PI_CUDA)
88
add_subdirectory(cuda)
99
endif()
1010

11-
if(SYCL_BUILD_PI_ROCM)
12-
add_subdirectory(rocm)
11+
if(SYCL_BUILD_PI_HIP)
12+
add_subdirectory(hip)
1313
endif()
1414

1515
add_subdirectory(opencl)

sycl/plugins/hip/CMakeLists.txt

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Set default PI HIP platform to AMD
2+
set(SYCL_BUILD_PI_HIP_PLATFORM "AMD" CACHE STRING "PI HIP platform, AMD or NVIDIA")
3+
4+
message(STATUS "Including the PI API HIP backend for ${SYCL_BUILD_PI_HIP_PLATFORM}.")
5+
6+
# Set default HIP include dirs
7+
set(SYCL_BUILD_PI_HIP_INCLUDE_DIR "/opt/rocm/hip/include" CACHE STRING "HIP include dir")
8+
set(SYCL_BUILD_PI_HIP_HSA_INCLUDE_DIR "/opt/rocm/hsa/include" CACHE STRING "HSA include dir")
9+
set(HIP_HEADERS "${SYCL_BUILD_PI_HIP_INCLUDE_DIR};${SYCL_BUILD_PI_HIP_HSA_INCLUDE_DIR}")
10+
11+
# Create pi_hip library
12+
add_library(pi_hip SHARED
13+
"${sycl_inc_dir}/CL/sycl/detail/pi.h"
14+
"${sycl_inc_dir}/CL/sycl/detail/pi.hpp"
15+
"pi_hip.hpp"
16+
"pi_hip.cpp"
17+
)
18+
add_dependencies(sycl-toolchain pi_hip)
19+
set_target_properties(pi_hip PROPERTIES LINKER_LANGUAGE CXX)
20+
target_link_libraries(pi_hip PUBLIC OpenCL-Headers)
21+
22+
# Setup include directories
23+
target_include_directories(pi_hip
24+
PRIVATE
25+
${sycl_inc_dir}
26+
${sycl_plugin_dir}
27+
)
28+
29+
if("${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "AMD")
30+
# Import HIP runtime library
31+
set(SYCL_BUILD_PI_HIP_AMD_LIBRARY "/opt/rocm/hip/lib/libamdhip64.so" CACHE STRING "HIP AMD runtime library")
32+
add_library(rocmdrv SHARED IMPORTED GLOBAL)
33+
34+
set_target_properties(
35+
rocmdrv PROPERTIES
36+
IMPORTED_LOCATION ${SYCL_BUILD_PI_HIP_AMD_LIBRARY}
37+
INTERFACE_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
38+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
39+
)
40+
target_link_libraries(pi_hip PUBLIC rocmdrv)
41+
42+
# Set HIP define to select AMD platform
43+
target_compile_definitions(pi_hip PRIVATE __HIP_PLATFORM_AMD__)
44+
45+
# Make sure lld is built as part of the toolchain
46+
add_dependencies(sycl-toolchain lld)
47+
elseif("${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "NVIDIA")
48+
# Import CUDA libraries
49+
find_package(CUDA REQUIRED)
50+
list(APPEND HIP_HEADERS ${CUDA_INCLUDE_DIRS})
51+
52+
# cudadrv may be defined by the CUDA plugin
53+
if(NOT TARGET cudadrv)
54+
add_library(cudadrv SHARED IMPORTED GLOBAL)
55+
set_target_properties(
56+
cudadrv PROPERTIES
57+
IMPORTED_LOCATION ${CUDA_CUDA_LIBRARY}
58+
INTERFACE_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
59+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
60+
)
61+
endif()
62+
63+
add_library(cudart SHARED IMPORTED GLOBAL)
64+
set_target_properties(
65+
cudart PROPERTIES
66+
IMPORTED_LOCATION ${CUDA_CUDART_LIBRARY}
67+
INTERFACE_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
68+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
69+
)
70+
target_link_libraries(pi_hip PUBLIC cudadrv cudart)
71+
72+
# Set HIP define to select NVIDIA platform
73+
target_compile_definitions(pi_hip PRIVATE __HIP_PLATFORM_NVIDIA__)
74+
else()
75+
message(FATAL_ERROR "Unspecified PI HIP platform please set SYCL_BUILD_PI_HIP_PLATFORM to 'AMD' or 'NVIDIA'")
76+
endif()
77+
78+
add_common_options(pi_hip)
79+
80+
install(TARGETS pi_hip
81+
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT pi_hip
82+
RUNTIME DESTINATION "bin" COMPONENT pi_hip
83+
)

0 commit comments

Comments
 (0)