Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

pushpull: export pull/push/count/grad_backward (CUDA side) - #32

Merged
balbasty merged 2 commits into
mainfrom
claude/pushpull-grid-backward
Jul 31, 2026
Merged

pushpull: export pull/push/count/grad_backward (CUDA side)#32
balbasty merged 2 commits into
mainfrom
claude/pushpull-grid-backward

Conversation

@balbasty

Copy link
Copy Markdown
Contributor

Part of the stack for fastfields-torch#16 (backpropagate through the pushpull sampling grid).

Stacked PR. Base is claude/cuda-pushpull-dynamic-spline, not main. The impl pin points at fastfields-cuda-impl#22, also unmerged — re-bump both once the parents land.

What

Mirrors the cpu-lib export one-for-one: same public signatures, same DISPATCH_PP matrix, same accumulate/overwrite contract, abs exposed only on grad_backward. Calls the new CUHOST launchers in cuda-impl and forwards the CUDA stream.

Why a separate module

Like cpu-lib, the adjoints get their own pushpull_backward.cpp (sharing the new private pushpull_dispatch.h with pushpull.cpp) so the second copy of the instantiation matrix is a separate, parallelisable translation unit.

That matters more here than on the CPU side: pushpull is already this build's heaviest module and ptxasmemory, not just wall time, is the binding constraint — exactly why reg_field/reg_field_rls were split in #28/#30. Folding the adjoints into pushpull.cpp would have put both copies of the matrix into one ptxas job, which is the failure mode that split was introduced to avoid.

Verification

Compile+link only — no GPU in CI. The math is validated on the CPU side against the shared kernels (cpu-lib#49: 6381 finite-difference checks, 0 failures); this file is validated by nvcc accepting it.

Measured locally with nvcc 12.0:

policytime
all-Dynamic25 s
default BOUNDFLAGS/SPLINEFLAGS (the CI legs)3 m 40 s

I have not run the full make across every CI matrix leg locally (this sandbox has 4 cores / 15 GB and gets reclaimed on idle), so the peak ptxas memory of the new module under the fully static leg is the one number a reviewer may want to confirm in CI.

Workstream: claude-jitfields-to-fastfields

🤖 Generated with Claude Code


Generated by Claude Code

Mirrors the cpu-lib export one-for-one: same public signatures, same
DISPATCH_PP matrix, same accumulate/overwrite contract, `abs` exposed only on
`grad_backward`. Calls the new CUHOST launchers in cuda-impl and forwards the
CUDA stream.
Like cpu-lib, the adjoints get their own module (`pushpull_backward.cpp`,
sharing the new private `pushpull_dispatch.h` with `pushpull.cpp`) so the
second copy of the instantiation matrix is a separate, parallelisable
translation unit. That matters more here than on the CPU side: `pushpull` is
already this build's heaviest module and ptxas *memory*, not just wall time,
is the binding constraint -- exactly why reg_field/reg_field_rls were split
(fastfields-cuda-lib#28/#30). Folding the adjoints into pushpull.cpp would
have put both copies in one ptxas job.
Compile+link only -- there is no GPU in CI, so the math is validated on the
CPU side (fastfields-cpu-lib/tests/test_pushpull_backward.cpp, 6381
finite-difference checks against the *shared* kernels) and this file is
validated by nvcc accepting it. Measured with nvcc 12.0:
all-Dynamic policy 25s
default BOUNDFLAGS/SPLINEFLAGS (the CI legs) 3m40s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AjQcY78NgbagPSbPJRr6Z

@balbastybalbasty left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

good to go

Base automatically changed from claude/cuda-pushpull-dynamic-spline to mainJuly 31, 2026 22:06
…flict
Both main (via cuda-impl#21's merge, 1e7a38d) and this branch (via
cuda-impl#22's merge, 81079a8) independently re-pinned impl since
their common ancestor. 81079a8 is a descendant of 1e7a38d (#22 was
built on top of #21's merged state), so it is the correct resolution.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AjQcY78NgbagPSbPJRr6Z
@balbasty
balbasty merged commit 3be8587 into mainJul 31, 2026
1 check passed
@balbasty
balbasty deleted the claude/pushpull-grid-backward branch July 31, 2026 23:38
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@balbasty@claude