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
feat(hygon-add): add Hygon backend support for Add
- Add `WITH_HYGON` build support and a Hygon `Add` backend that reuses the shared CUDA implementation.
- Detect DTK `nvcc` from the Hygon toolkit layout and auto-detect the GPU arch from `rocminfo`.
- Treat Hygon as a CUDA-like backend in shared data type, cast, and kernel helper headers.
- Skip the Hygon `gemm` example for now and ignore `build-*` temporary directories.
- Verified with `pip install -e .[dev]` and `pytest tests/test_add.py`.
message(FATAL_ERROR"`WITH_NVIDIA`, `WITH_ILUVATAR`, `WITH_METAX`, and `WITH_MOORE` are mutually exclusive. Build one GPU backend at a time.")
97
+
message(FATAL_ERROR"`WITH_NVIDIA`, `WITH_ILUVATAR`, `WITH_HYGON`, `WITH_METAX`, and `WITH_MOORE` are mutually exclusive. Build one GPU backend at a time.")
88
98
endif()
89
99
90
100
if(WITH_NVIDIA)
@@ -111,6 +121,64 @@ if(WITH_ILUVATAR)
111
121
find_package(CUDAToolkitREQUIRED)
112
122
endif()
113
123
124
+
if(WITH_HYGON)
125
+
add_compile_definitions(WITH_HYGON=1)
126
+
set(DTK_ROOT $ENV{DTK_ROOT})
127
+
if(NOT DTK_ROOT)
128
+
set(DTK_ROOT "${_DEFAULT_HYGON_DTK_ROOT}")
129
+
endif()
130
+
if(NOTEXISTS"${DTK_ROOT}")
131
+
message(FATAL_ERROR"`WITH_HYGON` is `ON` but `DTK_ROOT` (`${DTK_ROOT}`) does not exist.")
message(FATAL_ERROR"`WITH_HYGON` is `ON` but `${HYGON_CUDA_ROOT}/bin/nvcc` was not found. Checked `${DTK_ROOT}/cuda/bin/nvcc` and `${DTK_ROOT}/cuda/cuda/bin/nvcc`.")
161
+
endif()
162
+
163
+
set(CMAKE_CUDA_COMPILER "${HYGON_CUDA_ROOT}/bin/nvcc"CACHEFILEPATH"Hygon CUDA compiler (DTK nvcc)")
164
+
set(CUDAToolkit_ROOT "${HYGON_CUDA_ROOT}"CACHEPATH"Hygon CUDA toolkit root")
165
+
set(CMAKE_CUDA_ARCHITECTURES OFFCACHESTRING"Disable default CUDA arch flags for Hygon"FORCE)
166
+
set(CMAKE_CUDA_FLAGS "-std=c++17 -fPIC -arch=${HYGON_ARCH} -Wno-return-type -Wno-error=unused-private-field"CACHESTRING"Hygon CUDA flags")
167
+
set(CMAKE_CUDA_SEPARABLE_COMPILATION OFFCACHEBOOL"Disable RDC for Hygon")
168
+
169
+
# DTK's nvcc wrapper may invoke `nvcc` by name during compiler checks.
0 commit comments