You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
message(FATAL_ERROR"`WITH_NVIDIA`, `WITH_ILUVATAR`, `WITH_METAX`, `WITH_MOORE`, and `WITH_ASCEND` are mutually exclusive. Build one GPU backend at a time.")
290
+
message(FATAL_ERROR"`WITH_NVIDIA`, `WITH_ILUVATAR`, `WITH_HYGON`, `WITH_METAX`, `WITH_MOORE`, and `WITH_ASCEND` are mutually exclusive. Build one GPU backend at a time.")
236
291
endif()
237
292
238
293
if(WITH_NVIDIA)
@@ -261,6 +316,70 @@ if(WITH_ILUVATAR)
261
316
find_package(CUDAToolkitREQUIRED)
262
317
endif()
263
318
319
+
if(WITH_HYGON)
320
+
add_compile_definitions(WITH_HYGON=1)
321
+
set(DTK_ROOT $ENV{DTK_ROOT})
322
+
if(NOT DTK_ROOT)
323
+
set(DTK_ROOT "${_DEFAULT_HYGON_DTK_ROOT}")
324
+
endif()
325
+
if(NOTEXISTS"${DTK_ROOT}")
326
+
message(FATAL_ERROR"`WITH_HYGON` is `ON` but `DTK_ROOT` (`${DTK_ROOT}`) does not exist.")
message(FATAL_ERROR"`WITH_HYGON` is `ON` but no DTK `nvcc` was found under `${DTK_ROOT}`. Checked `${DTK_ROOT}/cuda/bin/nvcc`, `${DTK_ROOT}/cuda/cuda/bin/nvcc`, and `${DTK_ROOT}/cuda/cuda-*/bin/nvcc`.")
353
+
endif()
354
+
355
+
set(CMAKE_CUDA_COMPILER "${HYGON_CUDA_ROOT}/bin/nvcc"CACHEFILEPATH"Hygon CUDA compiler (DTK nvcc)")
356
+
set(CUDAToolkit_ROOT "${HYGON_CUDA_ROOT}"CACHEPATH"Hygon CUDA toolkit root")
357
+
set(CMAKE_CUDA_ARCHITECTURES OFFCACHESTRING"Disable default CUDA arch flags for Hygon"FORCE)
358
+
set(CMAKE_CUDA_FLAGS "-std=c++17 -fPIC -arch=${HYGON_ARCH} -Wno-return-type -Wno-error=unused-private-field"CACHESTRING"Hygon CUDA flags")
359
+
set(CMAKE_CUDA_SEPARABLE_COMPILATION OFFCACHEBOOL"Disable RDC for Hygon")
360
+
361
+
# DTK's nvcc wrapper derives its toolkit root from `CUDA_PATH`.
362
+
set(ENV{CUDA_PATH} "${HYGON_CUDA_ROOT}")
363
+
set(ENV{CUDA_HOME} "${HYGON_CUDA_ROOT}")
364
+
365
+
# DTK's nvcc wrapper may invoke `nvcc` by name during compiler checks.
Copy file name to clipboardExpand all lines: README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# InfiniOps
2
2
3
-
InfiniOps is a high-performance, cross-platform operator library supporting multiple backends: CPU, Nvidia, MetaX, Iluvatar, Moore, Cambricon, and more.
3
+
InfiniOps is a high-performance, cross-platform operator library supporting multiple backends: CPU, Nvidia, MetaX, Iluvatar, Hygon, Moore, Cambricon, and more.
|`-DWITH_NVIDIA=[ON\|OFF]`| Compile the Nvidia implementation | OFF |
32
32
|`-DWITH_METAX=[ON\|OFF]`| Compile the MetaX implementation | OFF |
33
33
|`-DWITH_ILUVATAR=[ON\|OFF]`| Compile the Iluvatar implementation | OFF |
34
+
|`-DWITH_HYGON=[ON\|OFF]`| Compile the Hygon implementation | OFF |
34
35
|`-DWITH_MOORE=[ON\|OFF]`| Compile the Moore implementation | OFF |
35
36
|`-DWITH_CAMBRICON=[ON\|OFF]`| Compile the Cambricon implementation | OFF |
37
+
|`-DWITH_ASCEND=[ON\|OFF]`| Compile the Ascend implementation | OFF |
36
38
|`-DAUTO_DETECT_DEVICES=[ON\|OFF]`| Auto-detect available platforms | ON |
37
39
38
40
If no accelerator options are provided and auto-detection finds nothing, `WITH_CPU` is enabled by default.
39
41
42
+
For Hygon builds, set `DTK_ROOT` to the DTK installation root if it is not installed at `/opt/dtk`. You can override the default DCU arch with `-DHYGON_ARCH=<arch>` when configuring CMake.
43
+
40
44
## Contributing
41
45
42
46
See [CONTRIBUTING.md](CONTRIBUTING.md) for code style, commit conventions, PR workflow, development guide, and troubleshooting.
0 commit comments