diff --git a/test/Basic/Matrix/matrix_const_single_subscript.i2x3.test b/test/Basic/Matrix/matrix_const_single_subscript.i2x3.test new file mode 100644 index 00000000..8727d063 --- /dev/null +++ b/test/Basic/Matrix/matrix_const_single_subscript.i2x3.test @@ -0,0 +1,104 @@ +#--- source.hlsl +RWBuffer In : register(u0); +RWBuffer Index : register(u1); +RWBuffer Out : register(u2); +RWBuffer Out2 : register(u3); + +[numthreads(1,1,1)] +void main() { + int3 A = int3(In[0], In[1], In[2]); + int3 B = int3(In[3], In[4], In[5]); + + int2x3 Mat; + Mat[1].xzy = A; + Mat[0] = B.zyx; + + int2x3 Mat2; + Mat2[Index[0]] = Mat[1].yzx; + Mat2[0].zxy = Mat[Index[1]]; + + const uint COLS = 3; + for(uint i = 0; i < 6; i++) { + uint row = i / COLS; + uint col = i % COLS; + Out[i] = Mat[row][col]; + Out2[i] = Mat2[row][col]; + } +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In + Format: Int32 + Data: [ 1, 2, 3, 4, 5, 6] + - Name: Index + Format: Int32 + Data: [ 1, 0] + - Name: Out + Format: Int32 + FillSize: 24 + - Name: ExpectedOut + Format: Int32 + Data: [ 6, 5, 4, 1, 3, 2 ] + - Name: Out2 + Format: Int32 + FillSize: 24 + - Name: ExpectedOut2 + Format: Int32 + Data: [ 5, 4, 6, 3, 2, 1 ] +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut + - Result: Out2 + Rule: BufferExact + Actual: Out2 + Expected: ExpectedOut2 +DescriptorSets: + - Resources: + - Name: In + Kind: RWBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: Index + Kind: RWBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 2 + Space: 0 + VulkanBinding: + Binding: 2 + - Name: Out2 + Kind: RWBuffer + DirectXBinding: + Register: 3 + Space: 0 + VulkanBinding: + Binding: 3 +... +#--- end + +# Unimplemented: https://github.com/llvm/llvm-project/issues/170534 +# XFAIL: Vulkan && Clang + +# Bug: https://github.com/llvm/llvm-project/issues/172805 +# XFAIL: Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Basic/Matrix/matrix_const_single_subscript.test b/test/Basic/Matrix/matrix_const_single_subscript.test new file mode 100644 index 00000000..86f489ab --- /dev/null +++ b/test/Basic/Matrix/matrix_const_single_subscript.test @@ -0,0 +1,74 @@ +#--- source.hlsl +RWBuffer In : register(u0); +RWBuffer Out : register(u1); + +[numthreads(1,1,1)] +void main() { + int4x4 A = int4x4(In[0], In[1], In[2], In[3], + In[4], In[5], In[6], In[7], + In[8], In[9], In[10], In[11], + In[12], In[13], In[14], In[15]); + int4x4 B; + + B[0] = A[3]; + B[1].rbag = A[1]; + B[2] = A[2].bagr; + B[3] = A[0]; + + const uint COLS = 4; + for(int i = 0; i < 16; i++) { + uint row = i / COLS; + uint col = i % COLS; + Out[i] = B[row][col]; + } +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In + Format: Int32 + Data: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + - Name: Out + Format: Int32 + FillSize: 64 + - Name: ExpectedOut + Format: Int32 + Data: [ 13, 14, 15, 16, 5, 8, 6, 7, 11, 12, 10, 9, 1, 2, 3, 4 ] +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut +DescriptorSets: + - Resources: + - Name: In + Kind: RWBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 +... +#--- end + +# Unimplemented: https://github.com/llvm/llvm-project/issues/170534 +# XFAIL: Vulkan && Clang + +# Bug: https://github.com/llvm/llvm-project/issues/172805 +# XFAIL: Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Basic/Matrix/matrix_single_subscript_basic.i2x3.test b/test/Basic/Matrix/matrix_single_subscript_basic.i2x3.test new file mode 100644 index 00000000..b5419adc --- /dev/null +++ b/test/Basic/Matrix/matrix_single_subscript_basic.i2x3.test @@ -0,0 +1,101 @@ +#--- source.hlsl +RWBuffer In : register(u0); +RWBuffer Index : register(u1); +RWBuffer Out : register(u2); +RWBuffer Out2 : register(u3); + +[numthreads(1,1,1)] +void main() { + int3 A = int3(In[0], In[1], In[2]); + int3 B = int3(In[3], In[4], In[5]); + + int2x3 Mat; + Mat[Index[0]] = A; + Mat[Index[1]] = B; + + int2x3 Mat2; + Mat2[Index[1]] = Mat[Index[0]]; + Mat2[Index[0]] = Mat[Index[1]]; + + const uint COLS = 3; + for(uint i = 0; i < 6; i++) { + uint row = i / COLS; + uint col = i % COLS; + Out[i] = Mat[row][col]; + Out2[i] = Mat2[row][col]; + } +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In + Format: Int32 + Data: [ 1, 2, 3, 4, 5, 6] + - Name: Index + Format: Int32 + Data: [ 1, 0] + - Name: Out + Format: Int32 + FillSize: 24 + - Name: ExpectedOut + Format: Int32 + Data: [ 4, 5, 6, 1, 2, 3] + - Name: Out2 + Format: Int32 + FillSize: 24 + - Name: ExpectedOut2 + Format: Int32 + Data: [ 1, 2, 3, 4, 5, 6] +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut + - Result: Out2 + Rule: BufferExact + Actual: Out2 + Expected: ExpectedOut2 +DescriptorSets: + - Resources: + - Name: In + Kind: RWBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: Index + Kind: RWBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 2 + Space: 0 + VulkanBinding: + Binding: 2 + - Name: Out2 + Kind: RWBuffer + DirectXBinding: + Register: 3 + Space: 0 + VulkanBinding: + Binding: 3 +... +#--- end + +# Unimplemented: https://github.com/llvm/llvm-project/issues/170534 +# XFAIL: Vulkan && Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Basic/Matrix/matrix_single_subscript_basic.i3x2.test b/test/Basic/Matrix/matrix_single_subscript_basic.i3x2.test new file mode 100644 index 00000000..87c8d3ed --- /dev/null +++ b/test/Basic/Matrix/matrix_single_subscript_basic.i3x2.test @@ -0,0 +1,105 @@ +#--- source.hlsl +RWBuffer In : register(u0); +RWBuffer Index : register(u1); +RWBuffer Out : register(u2); +RWBuffer Out2 : register(u3); + +[numthreads(1,1,1)] +void main() { + int2 A = int2(In[0], In[1]); + int2 B = int2(In[2], In[3]); + int2 C = int2(In[4], In[5]); + + int3x2 Mat; + Mat[Index[0]] = A; + Mat[Index[1]] = B; + Mat[Index[2]] = C; + + int3x2 Mat2; + Mat2[Index[2]] = Mat[Index[0]]; + Mat2[Index[1]] = Mat[Index[1]]; + Mat2[Index[0]] = Mat[Index[2]]; + + + const uint COLS = 2; + for(uint i = 0; i < 6; i++) { + uint row = i / COLS; + uint col = i % COLS; + Out[i] = Mat[row][col]; + Out2[i] = Mat2[row][col]; + } +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In + Format: Int32 + Data: [ 1, 2, 3, 4, 5, 6] + - Name: Index + Format: Int32 + Data: [ 1, 0, 2] + - Name: Out + Format: Int32 + FillSize: 24 + - Name: ExpectedOut + Format: Int32 + Data: [ 3, 4, 1, 2, 5, 6] + - Name: Out2 + Format: Int32 + FillSize: 24 + - Name: ExpectedOut2 + Format: Int32 + Data: [ 3, 4, 5, 6, 1, 2] +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut + - Result: Out2 + Rule: BufferExact + Actual: Out2 + Expected: ExpectedOut2 +DescriptorSets: + - Resources: + - Name: In + Kind: RWBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: Index + Kind: RWBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 2 + Space: 0 + VulkanBinding: + Binding: 2 + - Name: Out2 + Kind: RWBuffer + DirectXBinding: + Register: 3 + Space: 0 + VulkanBinding: + Binding: 3 +... +#--- end + +# Unimplemented: https://github.com/llvm/llvm-project/issues/170534 +# XFAIL: Vulkan && Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Basic/Matrix/matrix_single_subscript_basic.test b/test/Basic/Matrix/matrix_single_subscript_basic.test new file mode 100644 index 00000000..adc205c6 --- /dev/null +++ b/test/Basic/Matrix/matrix_single_subscript_basic.test @@ -0,0 +1,107 @@ +#--- source.hlsl +RWBuffer In : register(u0); +RWBuffer Index : register(u1); +RWBuffer Out : register(u2); +RWBuffer Out2 : register(u3); + +[numthreads(1,1,1)] +void main() { + int4 A = int4(In[0], In[1], In[2], In[3]); + int4 B = int4(In[4], In[5], In[6], In[7]); + int4 C = int4(In[8], In[9], In[10], In[11]); + int4 D = int4(In[12], In[13], In[14], In[15]); + + int4x4 Mat; + Mat[Index[0]] = A; + Mat[Index[1]] = B; + Mat[Index[2]] = C; + Mat[Index[3]] = D; + + int4x4 Mat2; + Mat2[Index[3]] = Mat[Index[0]]; + Mat2[Index[2]] = Mat[Index[1]]; + Mat2[Index[1]] = Mat[Index[2]]; + Mat2[Index[0]] = Mat[Index[3]]; + + const uint COLS = 4; + for(int i = 0; i < 16; i++) { + uint row = i / COLS; + uint col = i % COLS; + Out[i] = Mat[row][col]; + Out2[i] = Mat2[row][col]; + } +} +//--- pipeline.yaml + +--- +Shaders: + - Stage: Compute + Entry: main + DispatchSize: [1, 1, 1] +Buffers: + - Name: In + Format: Int32 + Data: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + - Name: Index + Format: Int32 + Data: [ 2, 0, 3, 1 ] + - Name: Out + Format: Int32 + FillSize: 64 + - Name: ExpectedOut + Format: Int32 + Data: [ 5, 6, 7, 8, 13, 14, 15, 16, 1, 2, 3, 4, 9, 10, 11, 12] + - Name: Out2 + Format: Int32 + FillSize: 64 + - Name: ExpectedOut2 + Format: Int32 + Data: [ 9, 10, 11, 12, 1, 2, 3, 4, 13, 14, 15, 16, 5, 6, 7, 8] +Results: + - Result: Out + Rule: BufferExact + Actual: Out + Expected: ExpectedOut + - Result: Out2 + Rule: BufferExact + Actual: Out2 + Expected: ExpectedOut2 +DescriptorSets: + - Resources: + - Name: In + Kind: RWBuffer + DirectXBinding: + Register: 0 + Space: 0 + VulkanBinding: + Binding: 0 + - Name: Index + Kind: RWBuffer + DirectXBinding: + Register: 1 + Space: 0 + VulkanBinding: + Binding: 1 + - Name: Out + Kind: RWBuffer + DirectXBinding: + Register: 2 + Space: 0 + VulkanBinding: + Binding: 2 + - Name: Out2 + Kind: RWBuffer + DirectXBinding: + Register: 3 + Space: 0 + VulkanBinding: + Binding: 3 +... +#--- end + +# Unimplemented: https://github.com/llvm/llvm-project/issues/170534 +# XFAIL: Vulkan && Clang + +# RUN: split-file %s %t +# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl +# RUN: %offloader %t/pipeline.yaml %t.o diff --git a/test/Basic/Matrix/matrix_single_subscript_load.test b/test/Basic/Matrix/matrix_single_subscript_load.test index 91a18f2a..87243140 100644 --- a/test/Basic/Matrix/matrix_single_subscript_load.test +++ b/test/Basic/Matrix/matrix_single_subscript_load.test @@ -64,6 +64,7 @@ DescriptorSets: ... #--- end +# Unimplemented https://github.com/llvm/llvm-project/issues/170777 # XFAIL: Clang # RUN: split-file %s %t # RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl diff --git a/test/Basic/Matrix/matrix_single_subscript_store.test b/test/Basic/Matrix/matrix_single_subscript_store.test index 6989ba3f..2de42fd3 100644 --- a/test/Basic/Matrix/matrix_single_subscript_store.test +++ b/test/Basic/Matrix/matrix_single_subscript_store.test @@ -64,7 +64,7 @@ DescriptorSets: Binding: 1 ... #--- end - +# Unimplemented https://github.com/llvm/llvm-project/issues/170777 # XFAIL: Clang # RUN: split-file %s %t # RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl