Share Gaussian preparation and radix sort with Metal compute - #110
Merged
Merged
Conversation
4 tasks
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.
Summary
Metal Gaussian rendering still prepares and sorts particles on the CPU. Move the existing Vulkan projection, covariance, SH, culling/compaction and portable radix-sort kernels into shared Slang sources, then compile Metal wrappers into the embedded and installed Gaussian library. A native Metal compute harness compares the complete preparation-to-sort submission with the CPU reference.
The transformed SH regression also exposed an existing GPU bug: row cofactors were used as inverse-matrix rows, applying the inverse transpose. Correct the shared calculation so directional SH matches the CPU reference under rotation and nonuniform scale.
Impact
float3padding differences.preferfalls back andrequirerejects. Persistent attributes, frame scheduling and indirect raster integration remain open.Verification
Local runtime environment: Apple M3, macOS 15.7.9, Xcode 16.4, Slang 2026.8.
ctest --test-dir build-metal --output-on-failure: 24/24 passed, no skips (Debug).ctest --test-dir build/metal-compute-release --output-on-failure: 24/24 passed, no skips (fresh Release build).ctest --preset core: 17/17 passed.2e-4 * max(1, abs(reference)); identities, classifications, counters and sentinel placement match exactly. Intentional distance ties use binary-exact coordinates.880517d(queued at PR creation). Native viewport/HgiMetal comparisons and performance captures were not rerun for this change.Review checklist