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 diag_absolute drops the op template arg when forwarding to kernel_absolute #6

Description

@balbasty

In the regulariser kernels, diag_absolute<op> forwards to kernel_absolute(...)without passing <op>, so it always uses the default op = set regardless of the caller's op:

template <OpType op = set>
CUDEVstaticinlinevoiddiag_absolute(scalar_t out[], offset_t osc, constreduce_t kernel[], offset_t nc = C)
{
returnkernel_absolute(out, osc, kernel, nc); // <-- should be kernel_absolute<op>(...)
}

Affected (one forwarding site each): regularisers/field/{1,2,3}d.h and regularisers/flow/{1,2,3}d.h.

Impact: harmless today (the dtype-dispatch layers only ever pass op = '=', and the default is set), but once op = '+'/'-' is used (see the reg-op fix in fastfields/fastfields-cpu-impl#5 / fastfields-lib#6a), diag_absolute would silently overwrite instead of accumulate/subtract. This mirrors the just-fixed impl-layer bug, but at the kernel layer. The same defect exists in the CUDA path (identical source).

Fix: forward <op>return kernel_absolute<op>(out, osc, kernel, nc); (flow variants have no nc arg). One-token change per file; provably a no-op for the currently-exercised op = '=' path. A '+'/'-'diag_absolute test will be added to cpu-lib's reg-op test once the pin chain carries both this and the impl fix.

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions