@@ -105,8 +105,8 @@ endif()
105105if (WITH_TORCH)
106106 find_package (Python COMPONENTS Interpreter REQUIRED )
107107
108- # Query torch paths directly instead of using `find_package(Torch)`,
109- # which pulls in Caffe2's cmake config and may fail on platforms with
108+ # Query ` torch` paths directly instead of using `find_package(Torch)`,
109+ # which pulls in Caffe2's CMake config and may fail on platforms with
110110 # non-standard CUDA toolchains.
111111 execute_process (
112112 COMMAND ${Python_EXECUTABLE} -c "from torch.utils.cpp_extension import include_paths; print(';'.join(include_paths()))"
@@ -130,9 +130,9 @@ if(WITH_TORCH)
130130 find_library (C10_LIB c10 HINTS ${_torch_lib_dirs} REQUIRED )
131131 set (TORCH_LIBRARIES ${TORCH_LIB} ${TORCH_CPU_LIB} ${C10_LIB} )
132132
133- # Query the CXX11 ABI setting torch was compiled with.
134- # Mismatched ABI causes linker errors (e.g. undefined reference to
135- # c10::Device::Device(std::string const&)).
133+ # Query the ` CXX11` ABI setting that ` torch` was compiled with.
134+ # A mismatch causes linker errors (e.g. undefined reference to
135+ # ` c10::Device::Device(std::string const&)` ).
136136 execute_process (
137137 COMMAND ${Python_EXECUTABLE} -c "import torch; print(int(torch.compiled_with_cxx11_abi()))"
138138 OUTPUT_VARIABLE TORCH_CXX11_ABI
@@ -179,23 +179,22 @@ if(WITH_ILUVATAR)
179179 else ()
180180 set (CMAKE_CUDA_COMPILER "clang++" CACHE STRING "Iluvatar CUDA compiler (clang++)" )
181181 endif ()
182- # `-x ivcore` must NOT be in CMAKE_CUDA_FLAGS — CMake passes those flags
182+ # `-x ivcore` must not be in ` CMAKE_CUDA_FLAGS` — CMake passes those flags
183183 # to both compile and link steps. During linking, `-x ivcore` causes
184- # clang++ to re-parse .o files as source code.
184+ # ` clang++` to re-parse `.o` files as source code.
185185 set (CMAKE_CUDA_FLAGS "--cuda-gpu-arch=${ILUVATAR_ARCH} -fPIC -Wno-error=unused-variable -Wno-error=unused-private-field -Wno-unused-variable" CACHE STRING "Iluvatar CUDA flags" )
186186 set (CMAKE_CUDA_SEPARABLE_COMPILATION OFF CACHE BOOL "Disable RDC for Iluvatar" )
187187 set (CMAKE_CUDA_ARCHITECTURES OFF CACHE STRING "Iluvatar CUDA architectures (passed via CMAKE_CUDA_FLAGS)" )
188- # Disable CMake's automatic CUDA runtime linking — Iluvatar doesn't
189- # ship `libcudadevrt` which CMake's compiler test tries to link.
190- # We link the runtime manually via `find_package(CUDAToolkit)`.
188+ # Iluvatar does not ship `libcudadevrt`, which CMake's compiler test
189+ # tries to link. Disable automatic CUDA runtime linking and link
190+ # manually via `find_package(CUDAToolkit)` instead .
191191 set (CMAKE_CUDA_RUNTIME_LIBRARY NONE)
192192 message (STATUS "Iluvatar: CUDA compiler ${CMAKE_CUDA_COMPILER} , arch ${ILUVATAR_ARCH} " )
193193 enable_language (CUDA )
194194 find_package (CUDAToolkit REQUIRED )
195- # Add `-x ivcore` as compile-only flag (not during linking).
196- # Iluvatar's clang++ accepts both `-x ivcore` and `-x cuda` during
197- # compilation (warning on the latter), but `-x ivcore` in link flags
198- # causes .o files to be re-parsed as source.
195+ # Add `-x ivcore` as a compile-only flag so it is not passed during
196+ # linking, where it would cause `clang++` to re-parse `.o` files as
197+ # source.
199198 add_compile_options ($<$<COMPILE_LANGUAGE :CUDA >:-x $<SEMICOLON >ivcore >)
200199endif ()
201200
0 commit comments