Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
34a52a8
feat(profiling): add NVTX instrumentation with baseline nsys captures
xiaoerlang0359-debug Sep 12, 2026
1ed5238
chore: ignore local build dirs and drop the unused DeepGEMM gitlink
xiaoerlang0359-debug Sep 13, 2026
5c101fb
chore(scripts): download example assets from hf-mirror
xiaoerlang0359-debug Sep 13, 2026
fe5591a
perf(cuda): serve bf16 weights from Adam-fused shadow copies
xiaoerlang0359-debug Sep 13, 2026
5754c7e
perf(cuda): vectorize Adam memory access
xiaoerlang0359-debug Sep 13, 2026
c07805a
docs: record kernel optimization analysis and bf16 reference results
xiaoerlang0359-debug Sep 13, 2026
f09ca48
perf(cuda): reduce CrossEntropy loss on-device to remove D2H sync
xiaoerlang0359-debug Sep 15, 2026
3bbdd76
perf(cuda): drop dead Fill(0) before full-coverage transform kernels
xiaoerlang0359-debug Sep 15, 2026
9c1947f
perf(cuda): specialize Fill(0) to cudaMemsetAsync off the launch path
xiaoerlang0359-debug Sep 16, 2026
c2b2de3
perf(cuda): pass SliceForward metadata by value via kernel parameter …
xiaoerlang0359-debug Sep 16, 2026
384dfc5
perf(cuda): drop dead grad_a Fill(0) in binary broadcast backward
xiaoerlang0359-debug Sep 16, 2026
5a50c0c
perf(cuda): fuse RMSNorm into single forward/backward kernels
xiaoerlang0359-debug Sep 19, 2026
6a0b178
perf(cuda): update only hit rows in embedding backward and Adam
xiaoerlang0359-debug Sep 20, 2026
117be73
style: run clang-format and translate the remaining comments to English
xiaoerlang0359-debug Sep 20, 2026
e152c84
chore: ignore nsys/out profiling artifacts
xiaoerlang0359-debug Sep 20, 2026
ee39356
docs: add the nsys timeline figure embedded by the kernel report
xiaoerlang0359-debug Sep 20, 2026
694c953
docs: split the detailed nsys timeline out of the kernel report
xiaoerlang0359-debug Sep 20, 2026
178ce0c
docs: restructure the kernel report and add the timeline figures
xiaoerlang0359-debug Sep 20, 2026
fd7d522
fix(cuda): align the mixed binary backward with the logical warp refa…
xiaoerlang0359-debug Sep 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
build/
build_new/
build_cast/
build_adam/
.cache/
.vscode/
nsys/out/

*.log
*.report.rank*
Expand Down
31 changes: 30 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.28)

option(USE_CUDA "Support NVIDIA CUDA" OFF)
option(PROFILE_MODE "ENABLE PROFILE MODE" OFF)
option(NVTX_MODE "Emit NVTX ranges for nsys timeline analysis (requires USE_CUDA; adds no CUDA synchronization)" OFF)
option(USE_OMP "Use OpenMP as backend for Eigen" ON)
option(USE_NCCL "Build project for distributed running on CUDA using NCCL" ON)
option(BUILD_TEST "Build InfiniTrain tests" OFF)
Expand Down Expand Up @@ -65,6 +66,15 @@ if(PROFILE_MODE)
add_compile_definitions(PROFILE_MODE=1)
endif()

if(NVTX_MODE)
if(NOT USE_CUDA)
message(FATAL_ERROR "NVTX_MODE=ON requires USE_CUDA=ON: <nvtx3/nvToolsExt.h> ships with the CUDA toolkit.")
endif()
# Unlike PROFILE_MODE this does not serialize the pipeline, so the two can be
# enabled independently; NVTX_MODE alone is the one to use for timing work.
add_compile_definitions(NVTX_MODE=1)
endif()

# ------------------------------------------------------------------------------
# Sources
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -104,24 +114,42 @@ endif()

if(USE_CUDA)
add_compile_definitions(USE_CUDA=1)

# Must be set before enable_language(CUDA): CMake's built-in default (52) is
# rejected by nvcc 13.x, whose minimum supported architecture is compute_75.
# 75=Turing, 80=Ampere, 90=Hopper, 120=Blackwell GeForce (RTX 50 series).
# Pass -DCMAKE_CUDA_ARCHITECTURES=120 for a faster build targeting one GPU.
if(NOT CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "75;80;90;120")
endif()

enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
include_directories(${CUDAToolkit_INCLUDE_DIRS})

if(NVTX_MODE)
# nvtx3 is header-only and needs no library (libnvToolsExt.so was dropped in
# CUDA 13); the injection library is resolved by dlopen at runtime. Fail at
# configure time rather than halfway through compiling 24 CUDA sources.
find_path(NVTX3_INCLUDE_DIR nvtx3/nvToolsExt.h HINTS ${CUDAToolkit_INCLUDE_DIRS} REQUIRED)
message(STATUS "NVTX_MODE enabled, nvtx3 headers found in: ${NVTX3_INCLUDE_DIR}")
endif()

# CUDA compilation options
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-extended-lambda --expt-relaxed-constexpr")

# Only compile CUDA kernels / cuda sources here (your original used src/*.cu)
file(GLOB_RECURSE CUDA_KERNELS ${PROJECT_SOURCE_DIR}/infini_train/src/*.cu)

add_library(infini_train_cuda_kernels STATIC ${CUDA_KERNELS})
set_target_properties(infini_train_cuda_kernels PROPERTIES CUDA_ARCHITECTURES "75;80;90")
set_target_properties(infini_train_cuda_kernels PROPERTIES CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}")

target_link_libraries(infini_train_cuda_kernels
PUBLIC
glog
CUDA::cudart
CUDA::cublas
CUDA::cublasLt
CUDA::cuda_driver
)

Expand Down Expand Up @@ -162,6 +190,7 @@ if(USE_CUDA)
PUBLIC
CUDA::cudart
CUDA::cublas
CUDA::cublasLt
CUDA::cuda_driver
)

Expand Down
Loading