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

refactor(pushpull): delete 5,554 lines of unreachable legacy pushpull kernels - #36

Merged
balbasty merged 1 commit into
claude/fastfields-teeny-refactor-js42idfrom
claude/pushpull-dead-code-deletion
Aug 1, 2026
Merged

refactor(pushpull): delete 5,554 lines of unreachable legacy pushpull kernels#36
balbasty merged 1 commit into
claude/fastfields-teeny-refactor-js42idfrom
claude/pushpull-dead-code-deletion

Conversation

@balbasty

Copy link
Copy Markdown
Collaborator

What

The teeny-based single-voxel path (pushpull/teeny.h, vox::pull/push/count/grad) is now the only pushpull implementation the impl layers use. Everything else under pushpull/ was left behind by that migration and is unreachable from every live dispatch path. This PR removes it.

filelines removedwhat
pushpull/nd.h-489whole file
pushpull/3d.h-1814whole file
pushpull/2d.h-1229whole file
pushpull/1d.h-1180the Spline<Z>/<L>/<Q>/<C> (Nearest/Linear/Quadratic/Cubic) partial specialisations only
pushpull/utils.h-842PushPull1D/2D/3D, PushPullSelect/PushPull, the InFOV<> block + FF_EXTRAPOLATE_TINY, PushPullAnyUtils, PushPullUtils<Z|L|Q|C>
pushpull.h-2umbrella now includes only pushpull/1d.h
CLAUDE.md+2/-1layout note updated
total-5,554 (kernel code)

Kept (still reachable): Config, the primary Kernels declaration, the generic Kernels<Config<one, Spline<I>, Bound<B>, ABS>> in 1d.h, and PushPullMaybe / SplineBufSize / the generic PushPullUtils<S,B,ABS> in utils.h.

Verification methodology

Re-derived from scratch, symbol by symbol, over fastfields-kernels, -cpu-impl, -cpu-lib, -cuda-impl, -cuda-lib, -lib and -bind-py (sources and tests):

  1. Include graph.pushpull/{1d,2d,3d,nd}.h and pushpull/utils.h are reachable only through the pushpull.h umbrella, and the only #include "../pushpull.h" in the entire tree is distance/spline.h. nd.h is not included even by the umbrella — and it specialises a type PushPullConfig that does not exist anywhere in the tree, so it could not compile if it were.

  2. Instantiation sites. The only instantiation of pushpull::Kernels anywhere is distance/spline.h:38:

    usingPP = pushpull::Kernels<pushpull::Config<1, Spline<S>, Bound<B>>>;

    D == 1 is hard-coded → Kernels<Config<two,…>> / <three,…> / the nd form can never be instantiated.

  3. Which S/B? Every caller of that — cpu-impl/distance_spline.h and cuda-impl/distance_spline.h, driven by cpu-lib/distance.cpp and cuda-lib/distance.cpp_dt_spline_{table,brent,gaussnewton} — instantiates with spline_t::Dynamic, bound_t::Dynamic. Dynamic matches neither Z/L/Q/C nor a static bound, so overload resolution always picks the genericSpline<I>/Bound<B> specialisation. The static-order specialisations in 1d.h (and correspondingly PushPullUtils<Z|L|Q|C>) were unreachable. The generic one already handles a static S/B correctly (I == Dynamic ? runtime : I), so no behaviour is lost — only an unused compile-time fast path.

  4. The live pushpull ops don't touch this code at all.pushpull::pull/push/count/grad (cpu-impl/pushpull.h, cuda-impl/pushpull.h), dispatched by cpu-lib/pushpull.cpp, cuda-lib/pushpull.cpp and fastfields-lib/pushpull.cpp, route exclusively to kernels/pushpull/teeny.h; they never name Kernels, Config or PushPull*.

  5. Residual-reference sweep.grep for PushPull1D, PushPull2D, PushPull3D, PushPullSelect, PushPullAnyUtils, PushPullUtils<Z|L|Q|C>, InFOV, PushPullConfig and the pushpull/{2d,3d,nd}.h include paths across all seven repos: zero remaining references after the deletion (the only surviving InFOV / FF_EXTRAPOLATE_TINY hits are teeny.h's own macro and one comment).

  6. No test depended on deleted code.tests/test_pushpull.cpp goes through the lib API → teeny.h. tests/test_distance_spline.cpp goes through dt_spline_* → the generic 1d Kernels, which is kept and still covered (704 checks).

Test results

make -C fastfields-cpu-lib clean test on the same base commit, before and after:

testbeforeafter
test_distance2352 / 02352 / 0
test_distance_mesh4622 / 04622 / 0
test_distance_spline704 / 0704 / 0
test_posdef5092 / 05092 / 0
test_pushpull326 / 0326 / 0
test_reg_field465 / 4 *465 / 4 *
test_reg_flow854 / 16 *854 / 16 *
test_reg_op186 / 0186 / 0
test_resize4130 / 04130 / 0
test_restrict191 / 0191 / 0
test_splinc4577 / 04577 / 0

Byte-identical for bothCXX=clang++ and CXX=g++.

* the diag_bending failures are pre-existing on this base and unrelated to pushpull — they are fixed on the separate claude/regularisers-diag-bugfix branch. They fail identically before and after this change.

CUDA: nvcc -std=c++17 compile of fastfields-cuda-lib/distance.cpp (the CUDA TU that transitively includes pushpull.h) still succeeds (warnings unchanged). No GPU available, so CUDA is compile-verified only, as usual.

Note vs. the earlier estimate

The prior review estimated ~4,910 dead lines. The actual verified figure is 5,554 — the difference is utils.h, where the dead region turned out to be 842 lines (the four PushPullUtils<Z|L|Q|C> specialisations alone are ~550) rather than the ~200 implied. Nothing that was flagged as dead turned out to be live.

Consumers

No changes were needed in fastfields-cpu-impl, -cpu-lib, -cuda-impl, -cuda-lib or -lib — none of them referenced any deleted symbol.


Generated by Claude Code

…tatic-order specs, utils blocks)
The teeny-based single-voxel path (pushpull/teeny.h, vox::pull/push/count/grad)
is now the only pushpull implementation the impl layers use. Everything else in
pushpull/ was left behind and is unreachable from any live dispatch path.
Removed (5,554 lines of kernel code):
pushpull/nd.h -489 whole file; not included ANYWHERE (not even by the
pushpull.h umbrella) and specialises a type
`PushPullConfig` that does not exist in the tree —
it could not compile if it were included.
pushpull/3d.h -1814 whole file; only Kernels<Config<three,...>> partial
specialisations, never instantiated.
pushpull/2d.h -1229 whole file; only Kernels<Config<two,...>> partial
specialisations, never instantiated.
pushpull/1d.h -1180 the Spline<Z>/<L>/<Q>/<C> (Nearest/Linear/Quadratic/
Cubic) partial specialisations. The generic
Kernels<Config<one, Spline<I>, Bound<B>, ABS>> is
kept — it is the only one ever instantiated.
pushpull/utils.h -842 PushPull1D/2D/3D aliases, PushPullSelect/PushPull
dispatcher, the InFOV<> block (+FF_EXTRAPOLATE_TINY,
partly already commented out), PushPullAnyUtils, and
the PushPullUtils<Z|L|Q|C> specialisations. Kept:
Config, the primary Kernels declaration,
PushPullMaybe, SplineBufSize and the generic
PushPullUtils<S,B,ABS> — all reachable.
pushpull.h -2 umbrella now includes only pushpull/1d.h.
Verification (independent of the earlier review; re-derived symbol by symbol):
* The ONLY instantiation of pushpull::Kernels in the whole tree is
distance/spline.h:38
using PP = pushpull::Kernels<pushpull::Config<1, Spline<S>, Bound<B>>>;
i.e. D == 1 always -> 2d.h/3d.h/nd.h can never be instantiated.
* Every caller of that (cpu-impl/distance_spline.h and cuda-impl/
distance_spline.h, driven by cpu-lib/distance.cpp and cuda-lib/distance.cpp
_dt_spline_{table,brent,gaussnewton}) instantiates with
spline_t::Dynamic + bound_t::Dynamic, which selects the generic
Spline<I>/Bound<B> specialisation, never Z/L/Q/C. Those static-order
specialisations were therefore unreachable; the generic one already handles a
static S/B correctly (it folds `I == Dynamic ? runtime : I`), so nothing loses
a code path, only an unused compile-time fast path.
* The public pushpull ops (pushpull::pull/push/count/grad in cpu-impl/pushpull.h
and cuda-impl/pushpull.h, dispatched by cpu-lib/pushpull.cpp,
cuda-lib/pushpull.cpp and fastfields-lib/pushpull.cpp) route exclusively to
kernels/pushpull/teeny.h — they never mention Kernels/Config/PushPull*.
* grep over kernels, cpu-impl, cpu-lib, cuda-impl, cuda-lib, lib and bind-py
(sources AND tests) for PushPull1D/2D/3D, PushPullSelect, PushPull,
PushPullAnyUtils, PushPullUtils<Z|L|Q|C>, InFOV, PushPullConfig and the
"pushpull/{2d,3d,nd}.h" include paths: zero remaining references. No test
exercises any deleted symbol (test_pushpull.cpp goes through the lib API ->
teeny.h; test_distance_spline.cpp goes through dt_spline_* -> the generic 1d
Kernels, which is kept and still covered).
Tests: `make -C fastfields-cpu-lib clean test` with CXX=clang++ and CXX=g++ —
check counts and pass/fail byte-identical to the pre-deletion baseline on this
same base commit (test_distance_spline 704/0, test_pushpull 326/0; the 4+16
reg_field/reg_flow diag_bending failures are pre-existing on this base and are
fixed on the separate regularisers branch). The CUDA translation unit that
transitively includes pushpull.h (cuda-lib/distance.cpp) also still compiles
under nvcc -std=c++17.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015xcQBMEdA5eQtTsx2wB3AC
@balbastyClaude

Copy link
Copy Markdown
CollaboratorAuthor

Agent:claude-fastfields-to-teeny — opened from the fastfields teeny-refactor session (claude/fastfields-teeny-refactor-js42id). Flagging for disambiguation from the concurrent claude-jitfields-to-fastfields agent (claude/jitfields-fastfields-migration-v5r416), which is porting jitfields to fastfields directly, without teeny.


Generated by Claude Code

@balbasty
balbasty merged commit e579add into claude/fastfields-teeny-refactor-js42idAug 1, 2026
1 check failed
@balbasty
balbasty deleted the claude/pushpull-dead-code-deletion branch August 1, 2026 08:17
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