-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathmatrix_elementwise_cast.test
More file actions
107 lines (98 loc) · 2.27 KB
/
matrix_elementwise_cast.test
File metadata and controls
107 lines (98 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#--- source.hlsl
RWBuffer<float> In : register(u0);
RWBuffer<int> MatOut : register(u1);
RWBuffer<int> ArrOut : register(u2);
RWBuffer<int> StructOut : register(u3);
struct S {
int A,B,C;
float X,Y,Z;
};
[numthreads(6,1,1)]
void main(uint GI : SV_GroupIndex) {
float2x3 A = float2x3(In[0], In[1], In[2],
In[3], In[4], In[5]);
float Arr[2][3] = {In[0], In[1], In[2],
In[3], In[4], In[5]};
S s = {(int)In[0], (int)In[1], (int)In[2],
In[3], In[4], In[5]};
const uint COLS = 3; // float2x3 => 2 rows, 3 columns
uint row = GI / COLS; // 0..1
uint col = GI % COLS; // 0..2
int2x3 B = (int2x3)A;
int2x3 C = (int2x3)Arr;
int2x3 D = (int2x3)s;
MatOut[GI] = B[row][col];
ArrOut[GI] = C[row][col];
StructOut[GI] = D[row][col];
}
//--- pipeline.yaml
---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: In
Format: Float32
Data: [ 1.1, 2.2, 3.3, 4.4, 5.5, 6.6]
- Name: MatOut
Format: Int32
FillSize: 24
- Name: ArrOut
Format: Int32
FillSize: 24
- Name: StructOut
Format: Int32
FillSize: 24
- Name: ExpectedOut
Format: Int32
Data: [ 1, 2, 3, 4, 5, 6 ]
Results:
- Result: MatOut
Rule: BufferExact
Actual: MatOut
Expected: ExpectedOut
- Result: ArrOut
Rule: BufferExact
Actual: ArrOut
Expected: ExpectedOut
- Result: StructOut
Rule: BufferExact
Actual: StructOut
Expected: ExpectedOut
DescriptorSets:
- Resources:
- Name: In
Kind: RWBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0
- Name: MatOut
Kind: RWBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: ArrOut
Kind: RWBuffer
DirectXBinding:
Register: 2
Space: 0
VulkanBinding:
Binding: 2
- Name: StructOut
Kind: RWBuffer
DirectXBinding:
Register: 3
Space: 0
VulkanBinding:
Binding: 3
...
#--- end
# Unimplemented: https://github.com/llvm/llvm-project/issues/170534
# 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