Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions test/Basic/Matrix/matrix_const_single_subscript.i2x3.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#--- source.hlsl
RWBuffer<int> In : register(u0);
RWBuffer<int> Index : register(u1);
RWBuffer<int> Out : register(u2);
RWBuffer<int> 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
74 changes: 74 additions & 0 deletions test/Basic/Matrix/matrix_const_single_subscript.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#--- source.hlsl
RWBuffer<int> In : register(u0);
RWBuffer<int> 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
101 changes: 101 additions & 0 deletions test/Basic/Matrix/matrix_single_subscript_basic.i2x3.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#--- source.hlsl
RWBuffer<int> In : register(u0);
RWBuffer<int> Index : register(u1);
RWBuffer<int> Out : register(u2);
RWBuffer<int> 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
105 changes: 105 additions & 0 deletions test/Basic/Matrix/matrix_single_subscript_basic.i3x2.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#--- source.hlsl
RWBuffer<int> In : register(u0);
RWBuffer<int> Index : register(u1);
RWBuffer<int> Out : register(u2);
RWBuffer<int> 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
Loading
Loading