Skip to content

Renderer: thread-group ID swizzling for L2 locality in fullscreen compute passes #720

Description

@drsnuggles8

Is your feature request related to a problem? Please describe.

Every fullscreen compute pass we have dispatches in default row-major workgroup order — GTAO.comp, GTAO_Denoise.comp, HZB.comp, FroxelFogScatter.comp / FroxelFogIntegrate.comp, LightCulling.comp, AutoExposureHistogram.comp, and the SSR/SSGI/TAA passes. Row-major order means concurrently-resident workgroups span the full width of the render target, so their texture fetches touch widely-separated memory and thrash L2.

Describe the solution you'd like

A shared GLSL helper that remaps gl_WorkGroupID into tiles of N workgroups (N typically 8/16/32) before computing the pixel coordinate, so concurrently-scheduled groups cover a compact screen region. Purely a coordinate remap — no change in work performed or output. Adopt across the fullscreen compute passes behind a single include, and measure per pass.

Describe alternatives you've considered

Nothing — this is a well-understood, output-identical micro-optimization; the only question is how much it wins on a given pass, which is why the acceptance criterion is a measurement.

Additional context

Technique: NVIDIA, Optimizing Compute Shaders for L2 Locality using Thread-Group-ID Swizzling (developer blog) — implement from there. A GLSL translation in use can be seen at D:\repos\tachyonfire\th1\shaders\cubemap.comp:625-679 (ThreadGroupTilingX) — GPLv3, read for approach only.

Acceptance criteria

  • Output byte-identical on every converted pass (this is a scheduling change only).
  • GPU timings recorded before/after per pass via GPUPassTimerPool; passes where it does not help revert to plain order rather than carrying the helper for nothing.

Score

capability: 3
craft: 1
stability: 1
decay: 1
effort: 1
confidence: 0.8
learning: 3
fun: 3
kano: performance
blocked_by: []
blocks: []

Rated per issue-scoring · score = confidence × (capability + craft + stability + decay) / effort, derived by the picker.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestperformancePerformance / data-oriented optimizationrobustnessProduction hardening / shipping robustness

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions