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

reg_field.h/reg_flow.h fail to compile: Impl:: static-qualified calls against kernels' now-instance-method regulariser API #40

Description

@balbasty

Summary

fastfields-cpu-impl/reg_field.h and reg_flow.h fail to compile against current fastfields-kernels main. This blocks make -C fastfields-cpu-lib test entirely for the regulariser modules — i.e. it blocks CI/local verification for every open PR touching field_*/flow_* regularisers, including the just-merged-pending fastfields-kernels#52 (OOB wget fix) and the whole in-place-accumulate PR series (fastfields-cpu-lib#50, fastfields-lib#47, etc.).

Root cause

fastfields-kernels' regularisers (regularisers/field/{1d,2d,3d}.h, regularisers/flow/{1d,2d,3d}.h) were refactored to support runtime (bound::type::Dynamic) boundary conditions: every method that touches a boundary (which is effectively all of them — get_kernelsize_*, make_kernel_*, make_fullkernel_*, matvec_*, diag_*, kernel_*, relax_*) now holds bound::dyn<B> state per axis (see fastfields-kernels/CLAUDE.md: "Kernels that use dyn take a runtime bound::BoundVec and have non-static methods"). Confirmed directly — e.g. regularisers/field/2d.h:

CUDEVinlineoffset_tget_kernelsize_bending(offset_t nc = C) // no `static`
{ return6 * (C < 0 ? nc : C); }

fastfields-cpu-impl/reg_field.h never updated its call sites — every one is still the old static-qualified form:

using Impl = RegField<0, ndim, scalar_t, reduce_t, offset_t, BOUND...>;
...
reduce_t * kernel = newreduce_t[Impl::get_kernelsize_membrane(nc)]; // no instanceImpl::make_kernel_membrane(kernel, absolute, membrane, voxel_size, nc);
...
Impl::template matvec_membrane<op_apply<op, scalar_t, reduce_t> >(...);

grep -c "Impl::" across the two files: ~150 call sites (68 Impl::template …, plus get_kernelsize_*/make_kernel_*/make_fullkernel_*/kernelsize_* — the full surface of both files).

Why this wasn't caught earlier

fastfields-cpu-lib's dispatch layer was recently updated to thread a const bound::BoundVec & bvec argument through to every impl call (see the note in fastfields-cpu-lib#52's description: "main's dispatch functions now thread a const bound::BoundVec & bvec first argument through to every impl call"), which is the cpu-lib-side half of adapting to the kernels Dynamic-bound refactor — but the cpu-impl side (constructing an Impl instance from that bvec and calling instance methods on it) was never done. Confirmed via git worktree comparison against a completely unmodified fastfields-kernels main that this is not a regression from any specific recent PR — it's the missing other half of the kernels#42 (bound::type::Dynamic) adaptation.

Fix

Every Impl::-qualified call in reg_field.h/reg_flow.h needs to go through a constructed Impl instance instead of a static qualifier:

  • For statically-instantiated (non-Dynamic) BOUND... packs, bound::dyn<B> is stateless/zero-cost, so a default-constructed (or bvec-passed-through-and-ignored) instance is correct and free.
  • For Dynamic axes, the instance must be constructed from the runtime bvec cpu-lib's dispatch layer already threads down — this needs a real bvec-accepting constructor call, not a default one.

Recommend checking how other already-adapted cpu-impl modules (or cuda-impl, if it's ahead here) construct their Impl/Kernels<Config<...>> instance from a bvec, and mirroring that pattern mechanically across all ~150 sites in both files.

Verification

make -C ../fastfields-cpu-lib test CXX=clang++ must go from a compile error (call to non-static member function without an object argument) to green, with the existing test_reg_field/test_reg_flow check counts unchanged (this is a pure compile-compatibility fix, not a behaviour change).

Workstream: claude-jitfields-to-fastfields

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions