Skip to content

perf(amr): batch the coarse-fine flux rewrite into one device launch for packed Diffusion #78

Description

@kylebeggs

Follow-up to #59 / #76.

The packed Diffusion sweep on a GPU backend is one KernelAbstractions launch over (blocksize..., nleaves) for the stencil, but the conservative coarse–fine seam (_cf_flux_rewrite! / _cf_flux_rewrite_adjoint!) still runs as a host loop over the cfflux descriptors — a few small broadcast launches on device views per coarse–fine face, ahead of (forward) or after (adjoint) the stencil launch. The launch count therefore still scales with the number of coarse–fine faces, which only partly meets #59's "leaf-count-independent launch structure" acceptance item. The adjoint's per-leaf zero_ghosts! before the gather kernel is the same pattern (pre-existing on the other adjoint kernels).

Proposed: a device-resident twin of the cfflux table (SoA of leaf/face/offset descriptors) and one @kernel per direction that applies every face rewrite in a single launch, keeping the per-face body identical to the host loop so the numerical definition does not fork. Same for a batched ghost-zeroing kernel on the adjoint path. Acceptance: bit-parity with the host loop on the test/forest_diffusion.jl KA-CPU direct-launch tests and on the CUDA leg (MFO_TEST_GPU=true), and no change to the exchange count.

🤖 Beep boop — filed by Claude, not Kyle leaving himself homework.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions