Repository navigation
DLDFScan and OneSweep declare their buffers once; UniformStruct slots - #83
Merged
Merged
Conversation
ScanParameters is a UniformStruct; the kernel's six buffers are declared with `buffers` (the output is array<vec4<T>> for a scan, array<T> for a reduce). The kernel is unchanged apart from where the declarations sit (4 configurations compared with main, including emulated subgroups). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015kfNC6id65zEHzuAAH4jtJ
…l parameters
- UniformStruct.allocateSlots(label, valuesList, alignment) packs one set of
values per kernel into one uniform buffer at aligned offsets, and
slot(label, i, alignment) is the binding of set i ({ buffer, offset, size }).
- OneSweep: SortParameters is a UniformStruct with one slot per kernel
(global_hist, onesweep_scan, each onesweep_pass); its buffers are declared
with `buffers` (two bind groups; keys and payloads swap on odd passes). The
layout comments for hist and passHist moved with the declarations.
- Its 26 kernels (4 configurations) are unchanged apart from where the
declarations sit, the struct's padding, and each slot's binding now having
an explicit size (32 bytes) rather than running to the end of the buffer;
offsets are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kfNC6id65zEHzuAAH4jtJ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015kfNC6id65zEHzuAAH4jtJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #82, which is stacked on #81. This finishes moving every Gridwise primitive to declared buffers and
UniformStruct.ScanParametersis aUniformStruct, and its six buffers are declared withbuffers. The output type isarray<vec4<T>>for a scan andarray<T>for a reduce.UniformStructslots: OneSweep gives each kernel its own parameters, packed into one uniform buffer at aligned offsets. That's now a core capability:allocateSlots(label, valuesList, alignment)packs the sets;slot(label, i, alignment)is the binding for seti.SortParametersis aUniformStructwith one slot per kernel.buffers, in two bind groups. Keys and payloads swap roles on odd passes.histandpassHistmoved along with the declarations.WriteGPUBufferin a primitive is gone. It's still tested bytest_wgsl_functions.mjs.Checked
main:DLDFScan, 4 configurations (including emulated subgroups): identical apart from where the declarations sit.
OneSweep, 26 kernels over 4 configurations (keys u32, key-value i32 descending, u64,
KEY_BITS12): identical apart from three things:The offsets (0, 256, 512, …) are unchanged.
With this, no Gridwise primitive declares a binding by hand any more.
Generated by Claude Code