Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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: 2 additions & 2 deletions tests/autodiff/differentiable-interface-return.slang
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// `this_type(...)` leaks all the way to codegen — invalid HLSL on
// `-target hlsl` and an ICE on `-target spirv`.

//TEST:SIMPLE(filecheck=CHECK_HLSL): -target hlsl -stage compute -entry main
//TEST:SIMPLE(filecheck=CHECK_SPV): -target spirv-asm -stage compute -entry main
//TEST:SIMPLE(filecheck=CHECK_HLSL): -target hlsl -stage compute -entry main -O3
//TEST:SIMPLE(filecheck=CHECK_SPV): -target spirv-asm -stage compute -entry main -O3
Comment thread
jkwak-work marked this conversation as resolved.
//TEST:INTERPRET(filecheck=CHECK_INTERP): -entry interpretMain

// The fix should ensure `this_type` (the unresolved IR placeholder) does not
Expand Down
10 changes: 5 additions & 5 deletions tests/autodiff/reverse-loop-immediate-return.slang
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -slang -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-cuda -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -slang -compute -shaderobj -output-using-type -Xslang -O3
Comment thread
jkwak-work marked this conversation as resolved.
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-cuda -compute -shaderobj -output-using-type -Xslang -O3

//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;
Expand Down Expand Up @@ -36,7 +36,7 @@ void run(
}

if (idx == 0)
{
{
x = x * 2.0f;
}
}
Expand All @@ -53,8 +53,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
// bwd_diff
DifferentialPair<float> dpa = DifferentialPair<float>(1.0, 0.0);
bwd_diff(run)(dispatchThreadID.x, dpa);
outputBuffer[dispatchThreadID.x] = dpa.d;
outputBuffer[dispatchThreadID.x] = dpa.d;

// CHECK: type: float
// CHECK: 2.0
}
2 changes: 1 addition & 1 deletion tests/bugs/gh-10774-concrete-return.slang
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// the interface requirement and the satisfying method. It should compile, but
// currently fails during interface conformance checking.

//TEST:SIMPLE(filecheck=CHECK): -target spirv-asm -emit-spirv-directly -stage compute -entry computeMain
//TEST:SIMPLE(filecheck=CHECK): -target spirv-asm -emit-spirv-directly -stage compute -entry computeMain -O3

// CHECK: OpCapability RayQueryKHR
// CHECK: OpRayQueryInitializeKHR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv
//TEST:SIMPLE(filecheck=CHECK): -target spirv -O3

// This is a test that checks that we can apply partial specialization to a function
// that takes existential parameters.
Expand Down Expand Up @@ -33,7 +33,7 @@ struct Scene : IScene {
};

public interface IIntegrator {

// This function takes two existential parameters, `scene` and `rng`.
// if we call this function with `rng` being dynamic, and `scene` being static,
// we should still be able to specialize the `sample` function with the statically known
Expand Down Expand Up @@ -90,4 +90,4 @@ void main(
integrator::Test integrator = integrator::Test();
float4 grad = integrator.sample(scene, {}, rng, {}, id);
output[id.xy] += float4(grad.xyz, grad.w);
}
}
2 changes: 1 addition & 1 deletion tests/bugs/gh-9916.slang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv-asm -stage fragment -entry fragmentMain
//TEST:SIMPLE(filecheck=CHECK): -target spirv-asm -stage fragment -entry fragmentMain -O3
Comment thread
jkwak-work marked this conversation as resolved.
//TEST:SIMPLE(filecheck=CHECK_BINDLESS): -target spirv-asm -stage fragment -entry fragmentMain -capability spvBindlessTextureNV -DUSE_BINDLESS_NV
Comment thread
jkwak-work marked this conversation as resolved.

// A global DescriptorHandle constant lowers to a module-scope descriptor-handle
Expand Down
12 changes: 6 additions & 6 deletions tests/bugs/metal-return-value-lost.slang
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
//TEST:SIMPLE(filecheck=CPP): -target cpp -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=WGSL): -target wgsl -entry computeMain -stage compute

//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-d3d12 -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-vk -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-cuda -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-cpu -compute -shaderobj -output-using-type
//TEST(compute, metal):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-metal -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-wgsl -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-d3d12 -compute -shaderobj -output-using-type -Xslang -O3
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-vk -compute -shaderobj -output-using-type -Xslang -O3
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-cuda -compute -shaderobj -output-using-type -Xslang -O3
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-cpu -compute -shaderobj -output-using-type -Xslang -O3
//TEST(compute, metal):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-metal -compute -shaderobj -output-using-type -Xslang -O3
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-wgsl -compute -shaderobj -output-using-type -Xslang -O3

//TEST_INPUT: ubuffer(data=[0], stride=4):out,name=outputBuffer
RWStructuredBuffer<uint> outputBuffer;
Expand Down
2 changes: 1 addition & 1 deletion tests/bugs/spirv-opt-SROA-of-globals.slang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv -fvk-use-entrypoint-name -enable-experimental-passes
//TEST:SIMPLE(filecheck=CHECK): -target spirv -fvk-use-entrypoint-name -enable-experimental-passes -O3

// This test checks that spirv-opt is running SROA (scalar replacement of aggregates) to
// hoist out all member variables of a struct. If this sucsessfully runs, we should not see
Expand Down
6 changes: 3 additions & 3 deletions tests/bugs/vk-structured-buffer-load.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//TEST:CROSS_COMPILE: -profile glsl_460+GL_NV_ray_tracing -entry HitMain -stage closesthit -target spirv-assembly
//TEST:SIMPLE(filecheck=DXIL): -target dxil -entry HitMain -stage closesthit -profile sm_6_5
//TEST:SIMPLE(filecheck=SPV): -target spirv
//TEST:CROSS_COMPILE: -profile glsl_460+GL_NV_ray_tracing -entry HitMain -stage closesthit -target spirv-assembly -O3
Comment thread
jkwak-work marked this conversation as resolved.
//TEST:SIMPLE(filecheck=DXIL): -target dxil -entry HitMain -stage closesthit -profile sm_6_5 -O3
//TEST:SIMPLE(filecheck=SPV): -target spirv -O3

// DXIL: define void @
// SPV: OpEntryPoint
Expand Down
4 changes: 2 additions & 2 deletions tests/compute/byte-address-buffer-array.slang
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-slang -compute -vk -shaderobj -output-using-type

//TEST:SIMPLE(filecheck=CHECK2):-target hlsl -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=CHECK3):-target spirv -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=CHECK3):-target spirv -emit-spirv-directly -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=CHECK3):-target spirv -entry computeMain -stage compute -O1
//TEST:SIMPLE(filecheck=CHECK3):-target spirv -emit-spirv-directly -entry computeMain -stage compute -O1

// Confirm compilation of `(RW)ByteAddressBuffer` with aligned load / stores to wider data types.

Expand Down
8 changes: 4 additions & 4 deletions tests/compute/half-texture.slang
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//TEST:SIMPLE(filecheck=CHECK_SPIRV): -target spirv -entry computeMain -profile cs_6_2 -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=CHECK_SPIRV): -target spirv -entry computeMain -profile cs_6_2 -emit-spirv-directly
//TEST:CROSS_COMPILE: -target dxil-assembly -entry computeMain -profile cs_6_2
//TEST:CROSS_COMPILE: -target dxil-assembly -entry computeMain -profile cs_6_2 -O3
//TEST:SIMPLE(filecheck=CHECK_CUDA): -target cuda -entry computeMain -profile cs_6_2

//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=16):out
Expand All @@ -22,8 +22,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
int2 pos = int2(dispatchThreadID.xy);
float2 uv = pos * (1.0f / 3.0f);
int2 pos2 = int2(3 - pos.y, 3 - pos.x);
#if 0

#if 0
half h = halfTexture.Sample(s, uv);
half2 h2 = halfTexture2.Sample(s, uv);
half4 h4 = halfTexture4.Sample(s, uv);
Expand All @@ -42,7 +42,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
halfTexture[pos] = h2.x + h2.y;
halfTexture2[pos] = h4.xy;
halfTexture4[pos] = half4(h2, h, h);

int index = pos.x + pos.y * 4;
outputBuffer[index] = index;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/compute/nonuniformres-as-function-parameter.slang
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=CHECK_SPV):-target spirv -entry main -stage compute
//TEST:SIMPLE(filecheck=CHECK_GLSL_SPV):-target spirv -entry main -stage compute -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=CHECK_SPV):-target spirv -entry main -stage compute -O1
//TEST:SIMPLE(filecheck=CHECK_GLSL_SPV):-target spirv -entry main -stage compute -emit-spirv-via-glsl -O1
//TEST:SIMPLE(filecheck=CHECK_GLSL):-target glsl -entry main -stage compute
//TEST:SIMPLE(filecheck=CHECK_HLSL):-target hlsl -entry main -stage compute
//TEST:SIMPLE(filecheck=CHECK_CUDA):-target cuda -entry main -stage compute
Expand Down
4 changes: 2 additions & 2 deletions tests/compute/nonuniformres-nested-rwstructuredbuf.slang
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//TEST:SIMPLE(filecheck=CHECK0):-target glsl -entry main -stage compute
//TEST:SIMPLE(filecheck=CHECK1):-target hlsl -entry main -stage compute
//TEST:SIMPLE(filecheck=CHECK2):-target spirv -entry main -stage compute -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=CHECK2):-target spirv -entry main -stage compute -emit-spirv-via-glsl -O3
//TEST:SIMPLE(filecheck=CHECK3):-target spirv -entry main -stage compute -emit-spirv-directly
//TEST:SIMPLE(filecheck=CHECK4):-target cuda -entry main -stage compute -emit-spirv-directly

Expand Down Expand Up @@ -30,7 +30,7 @@ void main(uint3 dispatchThreadID: SV_DispatchThreadID)
// CHECK3-DAG: OpDecorate %[[IDX2]] NonUniform
// CHECK3-DAG: OpDecorate %[[AC2]] NonUniform
// CHECK3-DAG: %{{.*}} = OpAccessChain %_ptr_StorageBuffer_int %[[AC2]]

// CHECK4: Array<RWStructuredBuffer<int>> [[BUFFER:buffer[_0-9]*]];
// CHECK4: [[GLOBALPARAMS:globalParams[_0-9]*]]->[[BUFFER]][_S{{[0-9]+}}]
// CHECK4: [[GLOBALPARAMS]]->[[BUFFER]][int(_S{{[0-9]+}})]
Expand Down
6 changes: 3 additions & 3 deletions tests/compute/static-const-array.slang
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// static-const-array.slang

//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -slang -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -Xslang -O3
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -Xslang -O3
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -slang -compute -shaderobj -Xslang -O3

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out, name outputBuffer
RWStructuredBuffer<int> outputBuffer;
Expand Down
2 changes: 1 addition & 1 deletion tests/cooperative-vector/layout-structuredbuffer.slang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//TEST:SIMPLE(filecheck=CHECK):-target spirv -emit-spirv-directly -entry computeMain -stage compute -capability cooperative_vector
//TEST:SIMPLE(filecheck=CHECK):-target spirv -emit-spirv-directly -entry computeMain -stage compute -capability cooperative_vector -O3

// Check that cooperative vector StructuredBuffer overloads preserve distinct
// std140/std430 ArrayStride decorations for runtime arrays and pointers.
Expand Down
4 changes: 2 additions & 2 deletions tests/cross-compile/loop-attribs.slang
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// loop-attribs.slang
// Test that loop attributes are correctly emitted to the resulting HLSL.

//TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0 -loop-inversion
//TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0 -loop-inversion -O3

float4 main() : SV_Target
{
float sum = 0.0f;

[loop]
for (int i = 0; i < 100; i++)
sum += float(i);
Expand Down
2 changes: 1 addition & 1 deletion tests/cross-compile/precise-keyword.slang
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//TEST:SIMPLE(filecheck=SPIRV): -target spirv-assembly -entry main -stage fragment
//TEST:CROSS_COMPILE:-target dxbc-assembly -entry main -stage fragment
//TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0
//TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0 -O3

// Test handling of the `precise` keyword

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
//DIAGNOSTIC_TEST:SIMPLE(diag=CHECK1):-target -profile ps_4_0
//CHECK1: unknown code generation target '-profile'

//DIAGNOSTIC_TEST:SIMPLE(diag=CHECK2):-profile ps_4_0 -target
//DIAGNOSTIC_TEST:SIMPLE(diag=CHECK2):-profile ps_4_0 -O3 -target
Comment thread
jkwak-work marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make sense.
We shouldn't need this change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Agent] Agreed — fixed at the root in 265ad27 and this test file is now unchanged from master. The real problem was that slang-test appended its default -O0 after the directive arguments, so a diagnostic test ending with an intentionally dangling -target would consume -O0 as its argument and report a different diagnostic. addDefaultSlangOptimization now inserts the default at the front of the argument list (slangc option parsing is position-independent), so test-provided arguments keep their meaning and no test needs to compensate. Validation: the slangTestDefaultOptimizationInsertion unit test now pins the front-insertion behavior with a dangling -target case, and tests/diagnostics/, tests/front-end/, and tests/cross-compile/ all pass locally (756/756).

//CHECK2: expected an argument for command-line option '-target'
2 changes: 1 addition & 1 deletion tests/glsl-intrinsic/intrinsic-basic-vector.slang
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl
//TEST:SIMPLE(filecheck=CHECK_GLSL_SPIRV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=CHECK_SPIR): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
//TEST:SIMPLE(filecheck=CHECK_SPIR): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -O1
//TEST:SIMPLE(filecheck=CHECK_HLSL): -allow-glsl -stage compute -entry computeMain -target hlsl

//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -output-using-type -emit-spirv-via-glsl
Expand Down
6 changes: 3 additions & 3 deletions tests/glsl-intrinsic/intrinsic-texture.slang
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
//TEST:SIMPLE(filecheck=GLSL_GRADS): -allow-glsl -stage fragment -entry fragMain -target glsl -DGLSL

// Sampling gradients available. Implicit LOD sampling translates to OpImageSampleImplicitLod and similar
//TEST:SIMPLE(filecheck=SPIR_GRADS): -allow-glsl -stage fragment -entry fragMain -target spirv -DSPIRV
//TEST:SIMPLE(filecheck=SPIR_GRADS): -allow-glsl -stage compute -entry computeMain -target spirv -DSPIRV -capability SPV_KHR_compute_shader_derivatives
//TEST:SIMPLE(filecheck=SPIR_GRADS): -allow-glsl -stage fragment -entry fragMain -target spirv -DSPIRV -O3
//TEST:SIMPLE(filecheck=SPIR_GRADS): -allow-glsl -stage compute -entry computeMain -target spirv -DSPIRV -capability SPV_KHR_compute_shader_derivatives -O3

// sampling gradients not available. Implicit LOD sampling translates to OpImageSampleExplicitLod with Lod=0 and similar
//TEST:SIMPLE(filecheck=SPIR_NOGRADS): -allow-glsl -stage vertex -entry vertexMain -target spirv -DSPIRV -DVERTEX_STAGE -DNO_GRADS
//TEST:SIMPLE(filecheck=SPIR_NOGRADS): -allow-glsl -stage vertex -entry vertexMain -target spirv -DSPIRV -DVERTEX_STAGE -DNO_GRADS -O3

//TEST:SIMPLE(filecheck=CUDA): -allow-glsl -stage compute -entry computeMain -target cuda -DCUDA
//TEST:SIMPLE(filecheck=CUDA): -allow-glsl -stage fragment -entry fragMain -target cuda -DCUDA
Expand Down
24 changes: 12 additions & 12 deletions tests/glsl/matrix-bool-lowering.slang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-slang -compute -emit-spirv-via-glsl -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-slang -compute -emit-spirv-via-glsl -shaderobj -Xslang -O3

//TEST_INPUT:ubuffer(data=[1 0], stride=4):name inputBuffer
//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer
Expand Down Expand Up @@ -29,7 +29,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
// Load true/false values from input buffer to avoid constant folding
trueVal = inputBuffer[0] != 0;
falseVal = inputBuffer[1] != 0;

// Test bool matrix construction
bool2x2 mat1 = bool2x2(trueVal, falseVal, falseVal, trueVal);
bool3x3 mat2 = bool3x3(
Expand All @@ -41,19 +41,19 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
trueVal, falseVal, trueVal, falseVal,
trueVal, falseVal, trueVal, falseVal
);

// Test bool matrix element access
bool val1 = mat1[0][0];
bool val2 = mat2[2][1];

// Test bool matrix row access
bool2 row = mat1[1];
bool3 row3 = mat2[0];

// Test logical operations
bool2x2 not_mat = !mat1;
bool2x2 and_mat = mat1 && bool2x2(trueVal, trueVal, falseVal, falseVal);

// Test element assignment
mat1[0][1] = trueVal;
mat2[1][2] = falseVal;
Expand All @@ -63,12 +63,12 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)

// Test structs with bool matrix fields
matrixWrapper wrapper = {};

// Test any/all operations
bool2x2 all_true = bool2x2(trueVal, trueVal, trueVal, trueVal);
bool2x2 all_false = bool2x2(falseVal, falseVal, falseVal, falseVal);
bool2x2 mixed = bool2x2(trueVal, falseVal, trueVal, falseVal);

bool test_all_true = all(all_true); // all elements true -> true
bool test_all_false = all(all_false); // all elements false -> false
bool test_all_mixed = all(mixed); // some elements false -> false
Expand All @@ -92,11 +92,11 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
outputBuffer[6] = and_mat[0][0];
// CHECK-NEXT: 1
outputBuffer[7] = mat1[0][1];
// CHECK-NEXT: 1
// CHECK-NEXT: 1
outputBuffer[8] = mat3[0][1];
// CHECK-NEXT: 0
// CHECK-NEXT: 0
outputBuffer[9] = anded;
// CHECK-NEXT: 0
// CHECK-NEXT: 0
outputBuffer[10] = wrapper.mat1[0][0] || wrapper.mat2[0][0];
// CHECK-NEXT: 1
outputBuffer[11] = test_all_true;
Expand All @@ -111,4 +111,4 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
// CHECK-NEXT: 0
outputBuffer[16] = test_any_mixed;
// CHECK-NEXT: 1
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -emit-spirv-via-glsl -entry fragmentMain -stage fragment -DENABLE_CLAMP
//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry fragmentMain -stage fragment -DENABLE_CLAMP
//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -emit-spirv-via-glsl -entry fragmentMain -stage fragment -DENABLE_CLAMP -O3
//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry fragmentMain -stage fragment -DENABLE_CLAMP -O3
//DISABLED_TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry fragmentMain -stage fragment -DENABLE_CLAMP -emit-spirv-directly

//DISABLED_TEST:SIMPLE(filecheck=DXIL):-target dxil-assembly -entry fragmentMain -stage fragment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry main -stage closesthit -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry main -stage closesthit
//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry main -stage closesthit -emit-spirv-via-glsl -O3
//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry main -stage closesthit -O3
// Motion rays not supported on HLSL impl currently, so disable with NOMOTION define:
//TEST:SIMPLE(filecheck=DXIL):-target dxil-assembly -entry main -stage closesthit -profile sm_6_5 -DNOMOTION

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry main -stage miss -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry main -stage miss
//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry main -stage miss -emit-spirv-via-glsl -O3
//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry main -stage miss -O3
// Motion rays not supported on HLSL impl currently, so disable with NOMOTION define:
//TEST:SIMPLE(filecheck=DXIL):-target dxil-assembly -entry main -stage miss -profile sm_6_5 -DNOMOTION

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry main -stage raygeneration -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry main -stage raygeneration
//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry main -stage raygeneration -emit-spirv-via-glsl -O3
//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry main -stage raygeneration -O3
// Motion rays not supported on HLSL impl currently, so disable with NOMOTION define:
//TEST:SIMPLE(filecheck=DXIL):-target dxil-assembly -entry main -stage raygeneration -profile sm_6_5 -DNOMOTION

Expand Down Expand Up @@ -131,7 +131,7 @@ float CheckSysValueIntrinsics()
[shader("raygeneration")]
void main()
{

float2 dir = (DispatchRaysIndex().xy / DispatchRaysDimensions().xy) * 2.0f - 1.0f;
float aspectRatio = DispatchRaysDimensions().x / DispatchRaysDimensions().y;

Expand All @@ -147,7 +147,7 @@ void main()
float val = 0.0f;

val += CheckTraceRay(payload, rayDesc);

if( val < T_MAX )
{
val += CheckSysValueIntrinsics();
Expand Down
2 changes: 1 addition & 1 deletion tests/hlsl/texture-mips-operator.slang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv
//TEST:SIMPLE(filecheck=CHECK): -target spirv -O3

// CHECK: OpImageFetch %v4float {{.*}} Lod %int_1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// marshalling: the outer array elements are themselves arrays, each of
// which must be packed element-by-element into AnyValue storage.

//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-dx12 -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-dx12 -compute -shaderobj -output-using-type -Xslang -O2
Comment thread
jkwak-work marked this conversation as resolved.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be -O3 not -O2

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Agent] I tried -Xslang -O3 and it fails locally on dx12: dxc validation rejects the shader with 'Instructions should not read uninitialized value' at 'select i1 %15, float fadd (float fadd (float undef, float undef), float undef), ...' in computeMain, so the compute run returns no output and the CHECK comparison fails. At -O2 the test passes (5/5 locally, and it passed CI). So -O2 and -O3 do differ on the DXIL path: the Slang level maps to different downstream dxc optimization flags, and dxc at the higher level exposes an undef read in the generated HLSL. I kept -O2 for now. Two follow-ups for your call: (1) confirm keeping -O2 here, and (2) the undef read that dxc surfaces at -O3 may be a real codegen issue in the dynamic-dispatch/AnyValue path worth filing separately.

Comment thread
jkwak-work marked this conversation as resolved.
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-cuda -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-cpu -compute -shaderobj -output-using-type
Expand Down
Loading
Loading