diff --git a/test/Feature/HLSLLib/sign_mat.fp.test b/test/Feature/HLSLLib/sign_mat.fp.test new file mode 100644 index 000000000..51d479224 --- /dev/null +++ b/test/Feature/HLSLLib/sign_mat.fp.test @@ -0,0 +1,91 @@ +#--- source.hlsl + +StructuredBuffer In : register(t0); +RWStructuredBuffer Out : register(u1); + +[numthreads(1,1,1)] +void main() { + int3x2 F32 = sign(float3x2(In[0].xyz, In[1].xyz)); + int2x4 F24 = sign(float2x4(In[2], In[3])); + int3x1 F31 = sign(float3x1(In[4].xyz)); + int4x4 F44 = sign(float4x4(In[5], In[6], In[7], In[8])); + int2x2 F22Const = sign(float2x2(-96.83, -8.7, 8.72, 44.0)); + + Out[0] = int4(F32[0], F32[1]); + Out[1] = int4(F32[2], 0, 0); + Out[2] = F24[0]; + Out[3] = F24[1]; + Out[4] = int4(F31[0], F31[1], F31[2], 0); + Out[5] = F44[0]; + Out[6] = F44[1]; + Out[7] = F44[2]; + Out[8] = F44[3]; + Out[9] = int4(F22Const[0], F22Const[1]); +} + +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main +Buffers: + - Name: In + Format: Float32 + Stride: 16 + Data: [ 0.0, -0.0, -4.2, 0.0, + -1.0, 1.0, 58.0, 0.0, + -4.2, 58.0, 75.59, 41.9, + 91.09, -3.76, 19.98, -5.47, + -53.1, 590.32, 70794.0, 0.0, + -60.6, 98.0, 1.2, -8.5, + 0.0, 4.46, -4.9, -8.0, + 7.42, 7.2, -764.09, -30.6, + -9.1, 81.6, -94.0, 7.0 ] + - Name: Out + Format: Int32 + Stride: 16 + FillSize: 160 + - Name: ExpectedOut + Format: Int32 + Stride: 16 + Data: [ 0, 0, -1, -1, + 1, 1, 0, 0, + -1, 1, 1, 1, + 1, -1, 1, -1, + -1, 1, 1, 0, + -1, 1, 1, -1, + 0, 1, -1, -1, + 1, 1, -1, -1, + -1, 1, -1, 1, + -1, -1, 1, 1 ] +Results: + - Result: Test + Rule: BufferExact + 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 + +# Unimplemented https://github.com/llvm/llvm-project/issues/184488 +# XFAIL: Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -HV 202x -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Feature/HLSLLib/sign_mat.int.test b/test/Feature/HLSLLib/sign_mat.int.test new file mode 100644 index 000000000..0ec5f22f3 --- /dev/null +++ b/test/Feature/HLSLLib/sign_mat.int.test @@ -0,0 +1,91 @@ +#--- source.hlsl + +StructuredBuffer In : register(t0); +RWStructuredBuffer Out : register(u1); + +[numthreads(1,1,1)] +void main() { + int3x2 I32 = sign(int3x2(In[0].xyz, In[1].xyz)); + int2x4 I24 = sign(int2x4(In[2], In[3])); + int3x1 I31 = sign(int3x1(In[4].xyz)); + int4x4 I44 = sign(int4x4(In[5], In[6], In[7], In[8])); + int2x2 I22Const = sign(int2x2(93, 0, -251, 96)); + + Out[0] = int4(I32[0], I32[1]); + Out[1] = int4(I32[2], 0, 0); + Out[2] = I24[0]; + Out[3] = I24[1]; + Out[4] = int4(I31[0], I31[1], I31[2], 0); + Out[5] = I44[0]; + Out[6] = I44[1]; + Out[7] = I44[2]; + Out[8] = I44[3]; + Out[9] = int4(I22Const[0], I22Const[1]); +} + +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main +Buffers: + - Name: In + Format: Int32 + Stride: 16 + Data: [ 0, -1, 1, 0, + 1000, -1000, 57, 0, + -2147483648, 2147483647, -992, 5, + -330, 78, -58, 56, + 658, 0, -76, 0, + 8, -86, 21, 0, + 262, 1, 0, 42, + -3, 3, 61, 81, + -927, 0, 44, 90 ] + - Name: Out + Format: Int32 + Stride: 16 + FillSize: 160 + - Name: ExpectedOut + Format: Int32 + Stride: 16 + Data: [ 0, -1, 1, 1, + -1, 1, 0, 0, + -1, 1, -1, 1, + -1, 1, -1, 1, + 1, 0, -1, 0, + 1, -1, 1, 0, + 1, 1, 0, 1, + -1, 1, 1, 1, + -1, 0, 1, 1, + 1, 0, -1, 1 ] +Results: + - Result: Test + Rule: BufferExact + 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 + +# Unimplemented https://github.com/llvm/llvm-project/issues/184488 +# XFAIL: Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -HV 202x -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Feature/HLSLLib/sign_mat.uint.test b/test/Feature/HLSLLib/sign_mat.uint.test new file mode 100644 index 000000000..4c22b87b9 --- /dev/null +++ b/test/Feature/HLSLLib/sign_mat.uint.test @@ -0,0 +1,94 @@ +#--- source.hlsl + +StructuredBuffer In : register(t0); +RWStructuredBuffer Out : register(u1); + +[numthreads(1,1,1)] +void main() { + int3x2 U32 = sign(uint3x2(In[0].xyz, In[1].xyz)); + int2x4 U24 = sign(uint2x4(In[2], In[3])); + int3x1 U31 = sign(uint3x1(In[4].xyz)); + int4x4 U44 = sign(uint4x4(In[5], In[6], In[7], In[8])); + int2x2 U22Const = sign(uint2x2(0, 26, 3, 27374)); + + Out[0] = int4(U32[0], U32[1]); + Out[1] = int4(U32[2], 0, 0); + Out[2] = U24[0]; + Out[3] = U24[1]; + Out[4] = int4(U31[0], U31[1], U31[2], 0); + Out[5] = U44[0]; + Out[6] = U44[1]; + Out[7] = U44[2]; + Out[8] = U44[3]; + Out[9] = int4(U22Const[0], U22Const[1]); +} + +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main +Buffers: + - Name: In + Format: UInt32 + Stride: 16 + Data: [ 0, 3, 40, 0, + 8, 5, 7, 0, + 63, 419, 100, 5, + 50, 0, 2, 0, + 0, 4294967295, 14910, 0, + 494, 70, 44, 6, + 13, 9, 78, 0, + 0, 5, 7, 621, + 64, 22, 9, 0 ] + - Name: Out + Format: Int32 + Stride: 16 + FillSize: 160 + - Name: ExpectedOut + Format: Int32 + Stride: 16 + Data: [ 0, 1, 1, 1, + 1, 1, 0, 0, + 1, 1, 1, 1, + 1, 0, 1, 0, + 0, 1, 1, 0, + 1, 1, 1, 1, + 1, 1, 1, 0, + 0, 1, 1, 1, + 1, 1, 1, 0, + 0, 1, 1, 1 ] +Results: + - Result: Test + Rule: BufferExact + 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 + +# Unimplemented https://github.com/llvm/llvm-project/issues/184488 +# XFAIL: Clang + +# Bug https://github.com/microsoft/DirectXShaderCompiler/issues/8860 +# XFAIL: DXC && Vulkan + +# RUN: split-file %s %t +# RUN: %dxc_target -HV 202x -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o