Skip to content

Commit 9c04549

Browse files
committed
style: fix comments to comply with CONTRIBUTING.md
Use backtick-fenced Markdown syntax for identifiers in comments and error messages, and ensure comments are complete sentences.
1 parent 32e16e8 commit 9c04549

3 files changed

Lines changed: 19 additions & 20 deletions

File tree

CMakeLists.txt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ endif()
105105
if(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>)
200199
endif()
201200

src/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,20 +226,20 @@ if(WITH_TORCH)
226226
target_include_directories(infiniops PUBLIC ${TORCH_INCLUDE_DIRS})
227227

228228
if(WITH_METAX OR WITH_MOORE)
229-
# Vendor compilers (mxcc/mcc) cannot compile vendor-forked torch
230-
# headers. Compile torch sources with the system C++ compiler instead.
229+
# Vendor compilers (`mxcc`/`mcc`) cannot compile vendor-forked `torch`
230+
# headers. Compile `torch` sources with the system C++ compiler instead.
231231
find_program(SYSTEM_CXX NAMES g++ c++)
232232

233233
if(NOT SYSTEM_CXX)
234-
message(FATAL_ERROR "Could not find system g++ for torch compilation.")
234+
message(FATAL_ERROR "Could not find system `g++` for `torch` compilation.")
235235
endif()
236236

237237
set(_torch_include_flags "")
238238
foreach(_dir ${TORCH_INCLUDE_DIRS})
239239
list(APPEND _torch_include_flags "-isystem" "${_dir}")
240240
endforeach()
241241

242-
# Vendor-specific defines required by forked torch headers.
242+
# Vendor-specific defines required by forked `torch` headers.
243243
set(_torch_extra_flags "")
244244
if(WITH_METAX)
245245
list(APPEND _torch_extra_flags "-DUSE_MACA=1")

src/torch/tensor_.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ inline at::ScalarType ToAtenDtype(DataType dtype) {
3434
case DataType::kUInt32:
3535
[[fallthrough]];
3636
case DataType::kUInt64:
37-
assert(false && "Unsigned integer types require PyTorch 2.4 or later.");
37+
assert(false && "unsigned integer types require PyTorch 2.4 or later");
3838
return at::kFloat;
3939
#endif
4040
case DataType::kFloat16:
@@ -46,7 +46,7 @@ inline at::ScalarType ToAtenDtype(DataType dtype) {
4646
case DataType::kFloat64:
4747
return at::kDouble;
4848
default:
49-
assert(false && "Unsupported dtype for ATen conversion.");
49+
assert(false && "unsupported dtype for ATen conversion");
5050
return at::kFloat;
5151
}
5252
}

0 commit comments

Comments
 (0)