Skip to content
Open
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
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ endfunction()

option(OFFLOADTEST_ENABLE_DEBUG "Enable available runtime debug layers (defaults On)." ON)
option(OFFLOADTEST_ENABLE_VALIDATION "Enable available runtime validation layers (defaults Off)." OFF)
option(OFFLOADTEST_ENABLE_EDGE_CONDITIONS "Enable edge condition tests which are flaky (defaults Off)." OFF)

list(APPEND OFFLOADTEST_DEPS
api-query
Expand Down Expand Up @@ -105,7 +106,8 @@ endif()

llvm_canonicalize_cmake_booleans(OFFLOADTEST_TEST_CLANG
OFFLOADTEST_ENABLE_DEBUG
OFFLOADTEST_ENABLE_VALIDATION)
OFFLOADTEST_ENABLE_VALIDATION
OFFLOADTEST_ENABLE_EDGE_CONDITIONS)

foreach(platform ${platforms_to_test})
set(TEST_${platform} False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ RWStructuredBuffer<float> Infs : register(u1);
RWStructuredBuffer<float> NegInfs : register(u2);
RWStructuredBuffer<float> Mix : register(u3);

[numthreads(32,1,1)]
void main(uint3 TID : SV_GroupThreadID) {
Nans[TID.x % 8] = WaveActiveMax(Nans[TID.x % 8]);
Infs[TID.x % 8] = WaveActiveMax(Infs[TID.x % 8]);
NegInfs[TID.x % 8] = WaveActiveMax(NegInfs[TID.x % 8]);
Mix[TID.x % 8] = WaveActiveMax(Mix[TID.x % 8]);
[numthreads(4,1,1)]
void main(uint GID : SV_GroupIndex) {
Nans[GID] = WaveActiveMax(Nans[GID]);
Infs[GID] = WaveActiveMax(Infs[GID]);
NegInfs[GID] = WaveActiveMax(NegInfs[GID]);
Mix[GID] = WaveActiveMax(Mix[GID]);
}
//--- pipeline.yaml

Expand Down Expand Up @@ -66,10 +66,10 @@ DescriptorSets:
#--- end

# 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 | FileCheck %s

# The behavior of this operation is consistent on Metal, so the test verifies that behavior.
# RUN: %dxc_target -T cs_6_0 -Gis -Fo %t.o %t/source.hlsl
# RUN: %offloader %t/pipeline.yaml %t.o | FileCheck %s \
# RUN: %if Metal %{ --check-prefixes=CHECK,NAN %} \
# RUN: %else %{ --check-prefixes=CHECK,NO_NAN %}

# The SPIR-V Spec for OpGroupNonUniformFMax says:
# > From the set of Value(s) provided by active invocations within a subgroup,
Expand All @@ -79,27 +79,20 @@ DescriptorSets:

# This makes Vulkan undefined for cases where all values are nan.

# Also SPIR-V states:
# > The identity I for Operation is -INF.

# This makes it defined that any lane value of -INF is ignored.

# DirectX driver implementations seem to match SPIR-V, except WARP, which does
# not treat -INF as an identity.
# DirectX driver implementations seem to match SPIR-V.

# XFAIL: DirectX && WARP
# Metal also is consistent except that it preserves NaN.

# CHECK: Name: Nans
# CHECK-NEXT: Format: Float32
# METAL-NEXT: Data: [ 0, 0, 0, 0 ]
# DX-NEXT: Data:
# VULKAN-NEXT: Data:
# NAN-NEXT: Data: [ nan, nan, nan, nan ]
# NO_NAN-NEXT: Data:
# CHECK: Name: Infs
# CHECK-NEXT: Format: Float32
# CHECK-NEXT: Data: [ inf, inf, inf, inf ]
# CHECK: Name: NegInfs
# CHECK-NEXT: Format: Float32
# CHECK-NEXT: Data: [ 0, 0, 0, 0 ]
# CHECK-NEXT: Data: [ -inf, -inf, -inf, -inf ]
# CHECK: Name: Mix
# CHECK-NEXT: Format: Float32
# CHECK-NEXT: Data: [ inf, inf, inf, inf ]
2 changes: 2 additions & 0 deletions test/Feature/WaveOps/EdgeConditions/lit.cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
if "EdgeConditions" in config.available_features:
config.unsupported = True
3 changes: 3 additions & 0 deletions test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def setDeviceFeatures(config, device, compiler):
)
HLSLCompiler = "DXC"

if config.offloadtest_enable_edge_cond_tests:
config.available_features.add("EdgeConditions")

config.available_features.add(HLSLCompiler)

tools.append(ToolSubst("obj2yaml", FindTool("obj2yaml")))
Expand Down
1 change: 1 addition & 0 deletions test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ config.offloadtest_enable_metal = @TEST_mtl@
config.offloadtest_os = "@CMAKE_SYSTEM_NAME@"
config.offloadtest_enable_debug = @OFFLOADTEST_ENABLE_DEBUG@
config.offloadtest_enable_validation = @OFFLOADTEST_ENABLE_VALIDATION@
config.offloadtest_enable_edge_cond_tests = @OFFLOADTEST_ENABLE_EDGE_CONDITIONS@

import lit.llvm
lit.llvm.initialize(lit_config, config)
Expand Down
Loading