@@ -99,8 +99,8 @@ endif()
9999if (WITH_TORCH)
100100 find_package (Python COMPONENTS Interpreter REQUIRED )
101101
102- # Query torch paths directly instead of using `find_package(Torch)`,
103- # which pulls in Caffe2's cmake config and may fail on platforms with
102+ # Query ` torch` paths directly instead of using `find_package(Torch)`,
103+ # which pulls in Caffe2's CMake config and may fail on platforms with
104104 # non-standard CUDA toolchains.
105105 execute_process (
106106 COMMAND ${Python_EXECUTABLE} -c "from torch.utils.cpp_extension import include_paths; print(';'.join(include_paths()))"
@@ -124,9 +124,9 @@ if(WITH_TORCH)
124124 find_library (C10_LIB c10 HINTS ${_torch_lib_dirs} REQUIRED )
125125 set (TORCH_LIBRARIES ${TORCH_LIB} ${TORCH_CPU_LIB} ${C10_LIB} )
126126
127- # Query the CXX11 ABI setting torch was compiled with.
128- # Mismatched ABI causes linker errors (e.g. undefined reference to
129- # c10::Device::Device(std::string const&)).
127+ # Query the ` CXX11` ABI setting that ` torch` was compiled with.
128+ # A mismatch causes linker errors (e.g. undefined reference to
129+ # ` c10::Device::Device(std::string const&)` ).
130130 execute_process (
131131 COMMAND ${Python_EXECUTABLE} -c "import torch; print(int(torch.compiled_with_cxx11_abi()))"
132132 OUTPUT_VARIABLE TORCH_CXX11_ABI
@@ -173,23 +173,22 @@ if(WITH_ILUVATAR)
173173 else ()
174174 set (CMAKE_CUDA_COMPILER "clang++" CACHE STRING "Iluvatar CUDA compiler (clang++)" )
175175 endif ()
176- # `-x ivcore` must NOT be in CMAKE_CUDA_FLAGS — CMake passes those flags
176+ # `-x ivcore` must not be in ` CMAKE_CUDA_FLAGS` — CMake passes those flags
177177 # to both compile and link steps. During linking, `-x ivcore` causes
178- # clang++ to re-parse .o files as source code.
178+ # ` clang++` to re-parse `.o` files as source code.
179179 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" )
180180 set (CMAKE_CUDA_SEPARABLE_COMPILATION OFF CACHE BOOL "Disable RDC for Iluvatar" )
181181 set (CMAKE_CUDA_ARCHITECTURES OFF CACHE STRING "Iluvatar CUDA architectures (passed via CMAKE_CUDA_FLAGS)" )
182- # Disable CMake's automatic CUDA runtime linking — Iluvatar doesn't
183- # ship `libcudadevrt` which CMake's compiler test tries to link.
184- # We link the runtime manually via `find_package(CUDAToolkit)`.
182+ # Iluvatar does not ship `libcudadevrt`, which CMake's compiler test
183+ # tries to link. Disable automatic CUDA runtime linking and link
184+ # manually via `find_package(CUDAToolkit)` instead .
185185 set (CMAKE_CUDA_RUNTIME_LIBRARY NONE)
186186 message (STATUS "Iluvatar: CUDA compiler ${CMAKE_CUDA_COMPILER} , arch ${ILUVATAR_ARCH} " )
187187 enable_language (CUDA )
188188 find_package (CUDAToolkit REQUIRED )
189- # Add `-x ivcore` as compile-only flag (not during linking).
190- # Iluvatar's clang++ accepts both `-x ivcore` and `-x cuda` during
191- # compilation (warning on the latter), but `-x ivcore` in link flags
192- # causes .o files to be re-parsed as source.
189+ # Add `-x ivcore` as a compile-only flag so it is not passed during
190+ # linking, where it would cause `clang++` to re-parse `.o` files as
191+ # source.
193192 add_compile_options ($<$<COMPILE_LANGUAGE :CUDA >:-x $<SEMICOLON >ivcore >)
194193endif ()
195194
0 commit comments