Skip to content

perf: reduce redundant CUDA initialization and synchronization - #190

Open
chen2021673 wants to merge 2 commits into
masterfrom
remove_fill
Open

perf: reduce redundant CUDA initialization and synchronization#190
chen2021673 wants to merge 2 commits into
masterfrom
remove_fill

Conversation

@chen2021673

@chen2021673 chen2021673 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • defer loss host synchronization until after backward in GPT-2, Llama3, MNIST, and pipeline training
  • skip zero initialization where CUDA kernels or cuBLAS fully overwrite output tensors
  • add numerical CPU and CUDA coverage for the affected operators

Test

image image

Comment thread tests/autograd/test_autograd_linear_forward.cc Outdated
Comment thread tests/autograd/test_autograd_normalization_backward.cc Outdated
Comment thread tests/autograd/test_autograd_reduction_backward.cc Outdated
Comment thread example/gpt2/main.cc
- defer loss host synchronization until after backward across training paths
- skip zero fills when CUDA kernels or cuBLAS fully overwrite outputs
- retain and document initialization required by partial-write paths
- add CPU and CUDA numerical tests for affected operators
Comment thread tests/common/test_utils.h

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件里的几个比较函数的使用场景分别是什么呢?(主要是带/不带 Near 的函数),建议注释说明一下,我看测例里对于浮点数的比较,两种函数都有使用。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants