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
71 changes: 71 additions & 0 deletions test/Feature/HLSLLib/rcp.16.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#--- source.hlsl

StructuredBuffer<half4> In : register(t0);

RWStructuredBuffer<half4> Out : register(u1);

[numthreads(1,1,1)]
void main() {
Out[0] = rcp(In[0]);
half4 Tmp = {rcp(In[1].xyz), rcp(In[1].w)};
Out[1] = Tmp;
half4 Tmp2 = {rcp(In[2].xy), rcp(In[2].zw)};
Out[2] = Tmp2;
Out[3] = rcp(half4(1, 10, 0.2, -4));
}


//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: In
Format: Float16
Stride: 8
Data: [ 0x4200, 0x4900, 0x3c00, 0xbc00, 0x4100, 0xb400, 0x4000, 0x3800, 0x4100, 0xb400, 0x4000, 0x3800]
# 3, 10, 1, -1, 2.5, -0.25, 2, 0.5, 2.5, -0.25, 2, 0.5
- Name: Out
Format: Float16
Stride: 8
ZeroInitSize: 32
- Name: ExpectedOut # The result we expect
Format: Float16
Stride: 8
Data: [0x3555, 0x2e66, 0x3c00, 0xbc00, 0x3666, 0xc400, 0x3800, 0x4000, 0x3666, 0xc400, 0x3800, 0x4000, 0x3c00, 0x2e66, 0x4500, 0xb400]
# 0.333, 0.1, 1, -1, 0.4, -4, 0.5, 2, 0.4, -4, 0.5, 2, 1, 0.1, 5, -0.25
Results:
- Result: Test1
Rule: BufferFloatEpsilon
Epsilon: 0.0008
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

# https://github.com/llvm/llvm-project/issues/149561
# XFAIL: Clang-Vulkan

# REQUIRES: Half
# RUN: split-file %s %t
# RUN: %dxc_target -enable-16bit-types -T cs_6_5 -Fo %t.o %t/source.hlsl
# RUN: %offloader %t/pipeline.yaml %t.o
68 changes: 68 additions & 0 deletions test/Feature/HLSLLib/rcp.32.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#--- source.hlsl

StructuredBuffer<float4> In : register(t0);

RWStructuredBuffer<float4> Out : register(u1);

[numthreads(1,1,1)]
void main() {
Out[0] = rcp(In[0]);
float4 Tmp = {rcp(In[1].xyz), rcp(In[1].w)};
Out[1] = Tmp;
float4 Tmp2 = {rcp(In[2].xy), rcp(In[2].zw)};
Out[2] = Tmp2;
Out[3] = rcp(float4(1, 10, 0.2, -4));
}


//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: In
Format: Float32
Stride: 16
Data: [3, 10, 1, -1, 2.5, -0.25, 2, 0.5, 2.5, -0.25, 2, 0.432]
- Name: Out
Format: Float32
Stride: 16
ZeroInitSize: 64
- Name: ExpectedOut # The result we expect
Format: Float32
Stride: 16
Data: [0.333333, 0.1, 1, -1, 0.4, -4 , 0.5, 2, 0.4, -4 , 0.5, 2.31481481481, 1, 0.1, 5, -0.25]
Results:
- Result: Test1
Rule: BufferFloatEpsilon
Epsilon: 0.0008
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

# https://github.com/llvm/llvm-project/issues/149561
# XFAIL: Clang-Vulkan

# RUN: split-file %s %t
# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl
# RUN: %offloader %t/pipeline.yaml %t.o
69 changes: 69 additions & 0 deletions test/Feature/HLSLLib/rcp.64.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#--- source.hlsl

StructuredBuffer<double4> In : register(t0);

RWStructuredBuffer<double4> Out : register(u1);

[numthreads(1,1,1)]
void main() {
Out[0] = rcp(In[0]);
double4 Tmp = {rcp(In[1].xyz), rcp(In[1].w)};
Out[1] = Tmp;
double4 Tmp2 = {rcp(In[2].xy), rcp(In[2].zw)};
Out[2] = Tmp2;
Out[3] = rcp(double4(1, 10, 0.2, -4));
}


//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: In
Format: Float64
Stride: 32
Data: [ 3, 10, 1, -1, 2.5, -0.25, 2, 0.5, 2.5, -0.25, 2, 0.432]
- Name: Out
Format: Float64
Stride: 32
ZeroInitSize: 128
- Name: ExpectedOut # The result we expect
Format: Float64
Stride: 32
Data: [ 0.333333, 0.1, 1, -1, 0.4, -4, 0.5, 2, 0.4, -4, 0.5, 2.31481, 1, 0.1, 5, -0.25 ]
Results:
- Result: Test1
Rule: BufferFloatEpsilon
Epsilon: 0.0008
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

# https://github.com/llvm/llvm-project/issues/149561
# XFAIL: Clang-Vulkan

# REQUIRES: Double
# RUN: split-file %s %t
# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl
# RUN: %offloader %t/pipeline.yaml %t.o