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.
Follow-up to #59 / #76.
The packed
Diffusionsweep 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 thecffluxdescriptors — 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-leafzero_ghosts!before the gather kernel is the same pattern (pre-existing on the other adjoint kernels).Proposed: a device-resident twin of the
cffluxtable (SoA of leaf/face/offset descriptors) and one@kernelper 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 thetest/forest_diffusion.jlKA-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.