Skip to content

Optimize embedding backward with atomic scatter - #17

Merged
feitreim merged 1 commit into
mainfrom
feat/milestone-7e6-embedding-backward
Jul 17, 2026
Merged

feitreim merged 1 commit into
mainfrom
feat/milestone-7e6-embedding-backward

Conversation

@feitreim

Copy link
Copy Markdown
Owner

Summary

  • replace the O(V·D·N) embedding-gradient token scan in the integrated model with an O(N·D) fp32 atomic scatter
  • retain the naive kernel as the correctness oracle and add repeated-token GPU parity coverage
  • record the milestone 7e6 B200 same-process profile and mark it complete in SPEC.md

Performance

B200, B=8, T=512, N=4096, 182.7M profile configuration:

Metric Baseline Candidate Improvement
backward.embedding 214.2722 ms 0.0269 ms ~7,966×
Full training step 341.5937 ms 127.3249 ms 2.68× / -62.7%

Validation

  • cargo test --workspace — 31 tests passed
  • cargo fmt --manifest-path gpu/llama-ops/Cargo.toml -- --check
  • cargo fmt --manifest-path gpu/llama-model/Cargo.toml -- --check
  • ./run.sh llama-ops on B200 — CUDA build and forward/backward parity passed
  • BASELINE_REF=d27188c9784c2f99c1cbe27244b46929d451bcb1 ./run.sh llama-model profile on B200 — same-process profile completed
  • git diff --check

@feitreim
feitreim merged commit c85cb2f into main Jul 17, 2026
@feitreim
feitreim deleted the feat/milestone-7e6-embedding-backward branch July 17, 2026 16:49
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.

1 participant