llvm-project/llvm/test/CodeGen/DirectX/wavesize-md-errs.ll
Finn Plummer 6312d27511
[DirectX] Emit hlsl.wavesize function attribute as entry property metadata (#165624)
This pr adds support for emitting the `hlsl.wavesize` function attribute
as an entry property metadata for a compute shader.

It follows the implementation of `hlsl.numthreads`.

- Collects the wave range information from the function attribute in
`DXILMetadataAnalysis`
- Introduce the `WaveRange` property tag
- Emit a `WaveSize` or `WaveRange` metadata (depending on shader model)
in `DXILTranslateMetadata`
- Add tests for valid/invalid scenarios
- Updates the base `PSVInfo` to reflect the min/max wave lane counts

Resolves #70118
2025-11-05 09:18:49 -08:00

32 lines
964 B
LLVM

; RUN: split-file %s %t
; RUN: not opt -S --dxil-translate-metadata %t/low-sm.ll 2>&1 | FileCheck %t/low-sm.ll
; RUN: not opt -S --dxil-translate-metadata %t/low-sm-for-range.ll 2>&1 | FileCheck %t/low-sm-for-range.ll
; Test that wavesize metadata is only allowed on applicable shader model versions
;--- low-sm.ll
; CHECK: Shader model 6.6 or greater is required to specify the "hlsl.wavesize" function attribute
target triple = "dxil-unknown-shadermodel6.5-compute"
define void @main() #0 {
entry:
ret void
}
attributes #0 = { "hlsl.wavesize"="16,0,0" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
;--- low-sm-for-range.ll
; CHECK: Shader model 6.8 or greater is required to specify wave size range values of the "hlsl.wavesize" function attribute
target triple = "dxil-unknown-shadermodel6.7-compute"
define void @main() #0 {
entry:
ret void
}
attributes #0 = { "hlsl.wavesize"="16,32,0" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }