Skip to content

Remove cuda kernels nothing calls - #62

Merged
CanReader merged 1 commit into
masterfrom
fix/remove-dead-cuda-kernels
Oct 30, 2026
Merged

CanReader merged 1 commit into
masterfrom
fix/remove-dead-cuda-kernels

Conversation

@CanReader

Copy link
Copy Markdown
Owner
  • remove cuda kernels nothing calls

What this changes

Deletes 26 kernels from kernels.cu (about 850 lines) along with their header declarations, ffi.rs entries and CPU stubs. kernels.cu goes from 1872 to 1024 lines.

Why

23 of them had no ffi.rs declaration, no stub and no Rust caller: the standalone loss, SGD/Adam step, pooling, batch norm, conv2d, dropout, gather, where, arange, copy and attention kernels. The ops they would serve already run through other paths (im2col for conv, ordinary ops for the rest). argmax and argmax_axis were declared but never used, and argmax only worked for a power-of-two n up to 1024. fill was also unused. scaled_dot_product_attention ignored causal and mask.

Dead code in a published crate is just a place for bugs to hide, so it goes. CLAUDE.md says ffi.rs has one entry per symbol in kernels.cu, and this brings the two back in line.

How it was verified

  • cargo test passes
  • cargo clippy --all-targets -- -D warnings is clean
  • Ran cuda_parity on a GPU
  • Trained an example in --release
  • No GPU here, CUDA side not runtime tested

cargo test --release --features cuda passes on an RTX 4050, cuda_parity included (16 cases).

Checklist

  • Every new or changed backward rule has a gradcheck case
  • Every new kernel has a cuda_parity case
  • tensor/ops and autograd/ops still mirror each other
  • Public items have /// docs

@CanReader
CanReader merged commit 9597ceb into master Oct 30, 2026
12 checks passed
@CanReader
CanReader deleted the fix/remove-dead-cuda-kernels branch October 30, 2026 09:25
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