Skip to content

Commit 465ac5d

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 f5f33b9 commit 465ac5d

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

CMakeLists.txt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ endif()
9999
if(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>)
194193
endif()
195194

src/CMakeLists.txt

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

182182
if(WITH_METAX OR WITH_MOORE)
183-
# Vendor compilers (mxcc/mcc) cannot compile vendor-forked torch
184-
# headers. Compile torch sources with the system C++ compiler instead.
183+
# Vendor compilers (`mxcc`/`mcc`) cannot compile vendor-forked `torch`
184+
# headers. Compile `torch` sources with the system C++ compiler instead.
185185
find_program(SYSTEM_CXX NAMES g++ c++)
186186

187187
if(NOT SYSTEM_CXX)
188-
message(FATAL_ERROR "Could not find system g++ for torch compilation.")
188+
message(FATAL_ERROR "Could not find system `g++` for `torch` compilation.")
189189
endif()
190190

191191
set(_torch_include_flags "")
192192
foreach(_dir ${TORCH_INCLUDE_DIRS})
193193
list(APPEND _torch_include_flags "-isystem" "${_dir}")
194194
endforeach()
195195

196-
# Vendor-specific defines required by forked torch headers.
196+
# Vendor-specific defines required by forked `torch` headers.
197197
set(_torch_extra_flags "")
198198
if(WITH_METAX)
199199
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)