-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathmatrix_elementwise_vector_cast.test
More file actions
81 lines (75 loc) · 1.76 KB
/
matrix_elementwise_vector_cast.test
File metadata and controls
81 lines (75 loc) · 1.76 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
#--- source.hlsl
RWBuffer<float> In : register(u0);
RWBuffer<float> FloatMatOut : register(u1);
RWBuffer<int> IntMatOut : register(u2);
[numthreads(4,1,1)]
void main(uint GI : SV_GroupIndex) {
float4 V = float4(In[0], In[1],In[2], In[3]);
float2x2 M = (float2x2)V;
int2x2 M2 = (int2x2)V;
const uint COLS = 2; // float2x2 => 2 rows, 2 columns
uint row = GI / COLS; // 0..1
uint col = GI % COLS; // 0..1
FloatMatOut[GI] = M[row][col];
IntMatOut[GI] = M2[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]
- Name: FloatMatOut
Format: Float32
FillSize: 16
- Name: IntMatOut
Format: Int32
FillSize: 16
- Name: ExpectedFloatOut
Format: Float32
Data: [ 1.1, 2.2, 3.3, 4.4]
- Name: ExpectedIntOut
Format: Int32
Data: [ 1, 2, 3, 4 ]
Results:
- Result: FloatMatOut
Rule: BufferExact
Actual: FloatMatOut
Expected: ExpectedFloatOut
- Result: IntMatOut
Rule: BufferExact
Actual: IntMatOut
Expected: ExpectedIntOut
DescriptorSets:
- Resources:
- Name: In
Kind: RWBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0
- Name: FloatMatOut
Kind: RWBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: IntMatOut
Kind: RWBuffer
DirectXBinding:
Register: 2
Space: 0
VulkanBinding:
Binding: 2
...
#--- end
# Unimplemented: https://github.com/llvm/llvm-project/issues/170538
# 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