diff --git a/test/Feature/HLSLLib/fmod.16.test b/test/Feature/HLSLLib/fmod.16.test new file mode 100644 index 00000000..6555900d --- /dev/null +++ b/test/Feature/HLSLLib/fmod.16.test @@ -0,0 +1,78 @@ +#--- source.hlsl +StructuredBuffer In0 : register(t0); +StructuredBuffer In1 : register(t1); + +RWStructuredBuffer Out0 : register(u2); + +[numthreads(1,1,1)] +void main() { + Out0[0] = fmod(In0[0], In1[0]); + Out0[1] = half4(fmod(In0[1].xyz, In1[1].xyz), fmod(In0[1].w, In1[1].w)); + Out0[2] = half4(fmod(In0[2].xy, In1[2].xy), fmod(In0[2].zw, In1[2].zw)); + Out0[3] = fmod(half4(10.5, -99.5, 5, 0.25), half4(1, -3, 0.25, 5)); +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In0 + Format: Float16 + Stride: 8 + Data: [0x4940, 0xd638, 0x4500, 0x3400, 0, 0x6056, 0x4940, 0xd638, 0x4500, 0x3400, 0, 0x6056] + # 10.5, -99.5, 5, 0.25, 0, 555, 10.5, -99.5, 5, 0.25, 0, 555 + - Name: In1 + Format: Float16 + Stride: 8 + Data: [0x3c00, 0xc200, 0x3400, 0x4500, 0x4900, 0x4100, 0x3c00, 0xc200, 0x3400, 0x4500, 0x4900, 0x4100] + # 1, -3, 0.25, 5, 10, 2.5, 1, -3, 0.25, 5, 10, 2.5 + - Name: Out0 + Format: Float16 + Stride: 8 + ZeroInitSize: 32 + - Name: ExpectedOut0 + Format: Float16 + Stride: 8 + Data: [ 0x3800, 0xB800, 0x0, 0x3400, 0x0, 0x0, 0x3800, 0xB800, 0x0, 0x3400, 0x0, 0x0, 0x3800, 0xB800, 0x0, 0x3400 ] + # 0.5, -0.5, 0, 0.25, 0, 0, 0.5 -0.5, 0, 0.25, 0, 0, 0.5, -0.5, 0, 0.25 +Results: + - Result: Test0 + Rule: BufferFloatEpsilon + Epsilon: 0.04 + Actual: Out0 + Expected: ExpectedOut0 +DescriptorSets: + - Resources: + - Name: In0 + Kind: StructuredBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: In1 + Kind: StructuredBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 + - Name: Out0 + Kind: RWStructuredBuffer + DirectXBinding: + Register: 2 + Space: 0 + VulkanBinding: + Binding: 2 +#--- end + +# https://github.com/llvm/llvm-project/issues/149561 +# XFAIL: Clang-Vulkan + +# REQUIRES: Half +# RUN: split-file %s %t +# RUN: %dxc_target -Gis -HV 202x -enable-16bit-types -T cs_6_5 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Feature/HLSLLib/fmod.32.test b/test/Feature/HLSLLib/fmod.32.test new file mode 100644 index 00000000..a4403a29 --- /dev/null +++ b/test/Feature/HLSLLib/fmod.32.test @@ -0,0 +1,74 @@ +#--- source.hlsl +StructuredBuffer In0 : register(t0); +StructuredBuffer In1 : register(t1); + +RWStructuredBuffer Out0 : register(u2); + +[numthreads(1,1,1)] +void main() { + Out0[0] = fmod(In0[0], In1[0]); + Out0[1] = float4(fmod(In0[1].xyz, In1[1].xyz), fmod(In0[1].w, In1[1].w)); + Out0[2] = float4(fmod(In0[2].xy, In1[2].xy), fmod(In0[2].zw, In1[2].zw)); + Out0[3] = fmod(float4(10.10, -99.99, 5, 0.25), float4(1.1, -3, 0.25, 5)); +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In0 + Format: Float32 + Stride: 16 + Data: [10.10, -99.99, 5, 0.25, 0, 6555.555, 10.10, -99.99, 5, 0.25, 0, 6555.555] + - Name: In1 + Format: Float32 + Stride: 16 + Data: [1.1, -3, 0.25, 5, 10, 2.22, 1.1, -3, 0.25, 5, 10, 2.22] + - Name: Out0 + Format: Float32 + Stride: 16 + ZeroInitSize: 64 + - Name: ExpectedOut0 + Format: Float32 + Stride: 16 + Data: [ 0.2, -0.99, 0, 0.25, 0, 2.1154, 0.2, -0.99, 0, 0.25, 0, 2.1154, 0.2, -0.99, 0, 0.25 ] +Results: + - Result: Test0 + Rule: BufferFloatEpsilon + Epsilon: 0.0008 + Actual: Out0 + Expected: ExpectedOut0 +DescriptorSets: + - Resources: + - Name: In0 + Kind: StructuredBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: In1 + Kind: StructuredBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 + - Name: Out0 + Kind: RWStructuredBuffer + DirectXBinding: + Register: 2 + Space: 0 + VulkanBinding: + Binding: 2 +#--- end + +# https://github.com/llvm/llvm-project/issues/149561 +# XFAIL: Clang-Vulkan + +# RUN: split-file %s %t +# RUN: %dxc_target -Gis -T cs_6_5 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o