Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cluster as optix 6431 #6995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

szihs
Copy link
Contributor

@szihs szihs commented May 5, 2025

  1. Implementation:
    - The implementation correctly added support for all three requested intrinsics:
    • GetClusterID() for basic ray tracing
    • HitObject.GetClusterID() for HitObject-based ray tracing
    • RayQuery.CandidateClusterID() and RayQuery.CommittedClusterID() for ray queries
  2. Proper Extension Support:
    - Added appropriate extension declarations:
    • SPV_NV_cluster_acceleration_structure
    • GL_NV_cluster_acceleration_structure
      - Set up proper capabilities, including the RayTracingClusterAccelerationStructureNV capability
  3. Multi-platform Integration:
    - All intrinsics support multiple backends:
    • HLSL: Using NVAPI intrinsics (NvRtGetClusterID, etc.)
    • GLSL: Using GLSL extensions (gl_ClusterIDNV, etc.)
    • SPIRV: Using the proper SPIRV operations
    • CUDA: Using OptiX intrinsics (optixGetClusterId, etc.)
  4. Documentation:
    - Methods include proper documentation comments
    - Type signatures match the specification
  5. Test Coverage:
    - Created test files for each new intrinsic:
    • optix-cluster.slang for basic GetClusterID()
    • optix-hit-object-cluster.slang for HitObject.GetClusterID()
    • optix-ray-query-cluster.slang for RayQuery cluster methods

--

  1. Issue Identification:
    - The SPIRV opcodes for cluster ray tracing functionality (5345 and 5346) are correctly defined in the SPIRV headers.
    - The opcodes appear in the auto-generated grammar files (slang-spirv-core-grammar-embed.cpp).
    - However, when using these opcodes in SPIRV inline assembly blocks, they're not recognized correctly.
  2. Temporary Workaround:
    - We've modified all three cluster-related functions to return -1 for SPIRV targets:
    • Base GetClusterID() function
    • RayQuery.CandidateClusterID() and RayQuery.CommittedClusterID() methods
    • HitObject.GetClusterID() method
      - This allows code using these methods to compile but returns placeholder values.
  3. Added Helper Function:
    - Added requireRayTracingClusterAccelerationStructure() to slang-emit-spirv.cpp to ensure proper extension and capability declaration when needed.

szihs added 2 commits May 5, 2025 21:05
- Added GetClusterID() method to HitObject class
- Added CandidateClusterID() and CommittedClusterID() methods to
RayQuery class
- Added SPV_NV_cluster_acceleration_structure extension support
- Added GL_NV_cluster_acceleration_structure extension support
- Added test files for RayQuery and HitObject cluster methods

Fixes shader-slang#6431
Disabling spirv backend for SPV_NV_cluster_acceleration_structure

hlsl.meta.slang(18674): error 29100: unrecognized spirv opcode:
OpRayQueryGetIntersectionClusterIdNV
                result:$$int = OpRayQueryGetIntersectionClusterIdNV
&this $iCandidateOrCommitted;
                ^~~~~~
hlsl.meta.slang(18670): error 30019: expected an expression of type
'int', got 'void'
            return spirv_asm
                   ^~~~~~~~~
ninja: build stopped: subcommand failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant