In Test\Feature\HLSLLib create, if applicable: (reference the HLSL headers for the types supported by the intrinsic)
A .test file should contain
#--- source.hlsl
StructuredBuffer<float4> In : register(t0);
RWStructuredBuffer<float> Out : register(u1);
[numthreads(1,1,1)]
void main() {
// A single test can test for all scalar/vector length as shown here.
Out[0] = length(In[0]); // Test float4
Out[1] = length(In[1].x); // Test float
Out[2] = length(In[1].yzw); // Test float3
Out[3] = length(In[1].yz); // Test float2
}
//--- pipeline.yaml
---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: In
Format: Float32
Stride: 16
Data: [ 4, 4, 4, 4, 3.14159, 0, 5, 12 ]
- Name: Out
Format: Float32
Stride: 4
ZeroInitSize: 12
- Name: ExpectedOut # The result we expect
Format: Float32
Stride: 4
Data: [ 8, 3.14159, 13, 5 ]
Results: # A test might have more than 1 result.
- Result: Test1
Rule: BufferFuzzy # there is also a BufferExact rule
ULPT: 1
Actual: Out
Expected: ExpectedOut
DescriptorSets:
- Resources:
- Name: In
Kind: StructuredBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0
- Name: Out
Kind: RWStructuredBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
...
#--- end
# RUN: split-file %s %t
# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl
# RUN: %offloader %t/pipeline.yaml %t.o
Tests for 16 bit floating point should have a # REQUIRES: Half. Also add -enable-16bit-types to the RUN line.
Tests for 16 bit integer should have a # REQUIRES: Int16. Also add -enable-16bit-types to the RUN line.
Tests for 64 bit floating point should have a # REQUIRES: Double.
Tests for 64 bit integer should have a # REQUIRES: Int64.
In
Test\Feature\HLSLLibcreate, if applicable: (reference the HLSL headers for the types supported by the intrinsic)WavePrefixProduct.int16.test)WavePrefixProduct.fp16.test)WavePrefixProduct.32.test)WavePrefixProduct.int64.test)WavePrefixProduct.fp64.test)A .test file should contain
Tests for 16 bit floating point should have a
# REQUIRES: Half. Also add-enable-16bit-typesto the RUN line.Tests for 16 bit integer should have a
# REQUIRES: Int16. Also add-enable-16bit-typesto the RUN line.Tests for 64 bit floating point should have a
# REQUIRES: Double.Tests for 64 bit integer should have a
# REQUIRES: Int64.