Skip to content
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

Implement the DispatchRaysDimensions HLSL Function #99186

Open
12 tasks
Tracked by #99235
farzonl opened this issue Jul 16, 2024 · 0 comments
Open
12 tasks
Tracked by #99235

Implement the DispatchRaysDimensions HLSL Function #99186

farzonl opened this issue Jul 16, 2024 · 0 comments
Labels
backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.

Comments

@farzonl
Copy link
Member

farzonl commented Jul 16, 2024

  • Implement DispatchRaysDimensions clang builtin,
  • Link DispatchRaysDimensions clang builtin with hlsl_intrinsics.h
  • Add sema checks for DispatchRaysDimensions to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for DispatchRaysDimensions to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/DispatchRaysDimensions.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/DispatchRaysDimensions-errors.hlsl
  • Create the int_dx_DispatchRaysDimensions intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_dx_DispatchRaysDimensions to 146 in DXIL.td
  • Create the DispatchRaysDimensions.ll and DispatchRaysDimensions_errors.ll tests in llvm/test/CodeGen/DirectX/
  • Create the int_spv_DispatchRaysDimensions intrinsic in IntrinsicsSPIRV.td
  • In SPIRVInstructionSelector.cpp create the DispatchRaysDimensions lowering and map it to int_spv_DispatchRaysDimensions in SPIRVInstructionSelector::selectIntrinsic.
  • Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/DispatchRaysDimensions.ll

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
146 DispatchRaysDimensions 6.3 ('library', 'raygeneration', 'intersection', 'anyhit', 'closesthit', 'miss', 'callable')

SPIR-V

LaunchSizeKHR

Short Description

LaunchSizeKHR - Launch dimensions for ray shaders

Description

LaunchSizeKHR
A variable decorated with the LaunchSizeKHR decoration will contain
the width , height , and depth dimensions passed to the
vkCmdTraceRaysKHR command that initiated this
shader execution. The width is in the first component, the
height is in the second component, and the depth is in the third
component.

Valid Usage


  • VUID-LaunchSizeKHR-LaunchSizeKHR-04269

    The LaunchSizeKHR decoration must be used only within the
    RayGenerationKHR , IntersectionKHR , AnyHitKHR ,
    ClosestHitKHR , MissKHR , or CallableKHR Execution
    Model


  • VUID-LaunchSizeKHR-LaunchSizeKHR-04270

    The variable decorated with LaunchSizeKHR must be declared
    using the Input Storage Class


  • VUID-LaunchSizeKHR-LaunchSizeKHR-04271

    The variable decorated with LaunchSizeKHR must be declared as
    a three-component vector of 32-bit integer values

Test Case(s)

Example 1

//dxc DispatchRaysDimensions_test.hlsl -T lib_6_8 -enable-16bit-types -O0

export uint3 fn() {
    return DispatchRaysDimensions();
}

SPIRV Example(s):

Example 2

//dxc DispatchRaysDimensions_spirv_test.hlsl -T lib_6_8 -E fn -enable-16bit-types -spirv -fspv-target-env=universal1.5 -fcgl -O0

[shader("intersection")]
void fn() {
uint3 	ret = DispatchRaysDimensions();
}

HLSL:

The width, height and depth values from the D3D12_DISPATCH_RAYS_DESC structure specified in the originating DispatchRays call.

Syntax

uint3 DispatchRaysDimensions();

Remarks

This function can be called from the following raytracing shader types:

See also

@farzonl farzonl added backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues. labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.
Projects
Status: No status
Development

No branches or pull requests

1 participant