Add cluster acceleration structure API - #1142
Conversation
Expose cluster operation queries and command recording through SGL and Python. Add NumPy GPU-structure dtypes for host-authored indirect arguments without exposing GPU-side record classes.
📝 WalkthroughWalkthroughThe PR adds portable GPU record layouts, cluster acceleration structure operation APIs, Python bindings, and device tests covering CLAS, BLAS, TLAS, and ray tracing. ChangesCluster acceleration structure support
Merge Risk: 🔵 Low · up to The implementation appears sound, but the new trace test may fail the configured Ruff check until it is split into smaller helpers. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 42 functions across 15 files. (2 skipped: 1 unsupported, 1 too large.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Team
Run ID: 766d550d-ef9c-466d-851c-ad04e367862b
📒 Files selected for processing (17)
slangpy/__init__.pyslangpy/gpu_structs.pyslangpy/tests/device/test_cluster_acceleration_structure.pyslangpy/tests/device/test_cluster_acceleration_structure.slangslangpy/tests/device/test_opacity_micromap.pysrc/sgl/device/command.cppsrc/sgl/device/command.hsrc/sgl/device/device.cppsrc/sgl/device/device.hsrc/sgl/device/raytracing.cppsrc/sgl/device/raytracing.hsrc/sgl/device/types.hsrc/slangpy_ext/device/command.cppsrc/slangpy_ext/device/device.cppsrc/slangpy_ext/device/raytracing.cppsrc/slangpy_ext/py_doc.htools/postprocess_stub.py
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.
|
|
||
|
|
||
| @pytest.mark.parametrize("device_type", helpers.DEFAULT_DEVICE_TYPES) | ||
| def test_cluster_acceleration_structure_trace(device_type: spy.DeviceType) -> None: |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Keep test_cluster_acceleration_structure_trace below Ruff’s PLR0915 limit. The checked-in .coderabbit.yaml enables Ruff, and PLR0915 uses a 50-statement default limit. This 60-statement test can fail that check. Extract the CLAS build, BLAS build, and TLAS/trace setup into module-level helpers, similar to _execute_implicit_cluster_operation.
🧰 Tools
🪛 Ruff (0.16.3)
[warning] 211-211: Too many statements (60 > 50)
(PLR0915)
Summary
Adds cluster acceleration structure support to SGL and its Python bindings.
The API exposes the host-side controls needed to query allocation requirements and execute cluster operations, while keeping GPU-consumed data structures out of the public C++ and Python bindings.
Changes
Device.get_cluster_operation_sizes().CommandEncoder.execute_cluster_operation().RayTracingPipelineFlags.enable_clusters.AccelerationStructureHandleand allow constructing one from a raw handle.slangpy.gpu_structswith NumPy structured dtypes for portable GPU buffer records:TriangleClusterArgs.TriangleClusterArgs,InstantiateTemplateArgs, andClusterArgsout of the SGL C++ types and nanobind API.slangpy.gpu_structs.Testing