Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slang-test: Some tests show up as passing even though they print out error messages #5291

Closed
aleino-nv opened this issue Oct 14, 2024 · 14 comments
Assignees
Labels
goal:forward looking Feature needed at a later date, not connected to a specific use case. kind:bug something doesn't work like it should siggraphasia-2024

Comments

@aleino-nv
Copy link
Collaborator

aleino-nv commented Oct 14, 2024

  • tests/language-feature/shader-params/entry-point-uniform-params-implicit.slang
  • tests/metal/groupshared-threadlocal-same-parameter.slang
  • tests/bugs/gh-2959.slang
  • tests/bugs/gh-471.slang
  • tests/bugs/static-var.slang
  • tests/bugs/texture2d-gather.hlsl
  • tests/language-feature/anonymous-struct.slang
  • tests/language-feature/constants/static-const-in-generic-interface.slang
  • tests/language-feature/enums/nested-enum.slang
  • tests/language-feature/enums/strongly-typed-id.slang
  • tests/language-feature/generics/variadic-void.slang
  • tests/language-feature/generics/variadic-0.slang
  • tests/language-feature/generics/tuple.slang
  • tests/language-feature/generics/irwarray.slang

Example:

...
WGPU error: Binding doesn't exist in [BindGroupLayout (unlabeled)].
 - While validating that the entry-point's declaration for @group(0) @binding(1) matches [BindGroupLayout (unlabeled)]
 - While validating the entry-point's compatibility for group 0 with [BindGroupLayout (unlabeled)]
 - While validating compute stage ([ShaderModule (unlabeled)], entryPoint: computeMain).
 - While calling [Device].CreateComputePipeline([ComputePipelineDescriptor]).

WGPU error: Number of entries (1) did not match the expected number of entries (0) for [BindGroupLayout (unlabeled)].
Expected layout: []
 - While validating [BindGroupDescriptor] against [BindGroupLayout (unlabeled)]
 - While calling [Device].CreateBindGroup([BindGroupDescriptor]).

WGPU error: [Invalid ComputePipeline (unlabeled)] is invalid.
 - While encoding [ComputePassEncoder (unlabeled)].SetPipeline([Invalid ComputePipeline (unlabeled)]).
 - While finishing [CommandEncoder (unlabeled)].

WGPU error: [Invalid CommandBuffer] is invalid.
 - While calling [Queue].Submit([[Invalid CommandBuffer]])

Warning: Old MapAsync APIs are deprecated. If using C please pass a CallbackInfo struct that has two userdatas. Otherwise, if using C++, please use templated helpers.
passed test: 'tests/language-feature/shader-params/entry-point-uniform-params-implicit.slang.3 syn (wgpu)' 
Retrying 0 failed tests...

===
100% of tests passed (1/1), 3 tests ignored
===
@aleino-nv
Copy link
Collaborator Author

@csyonghe This is pretty worrying. I hope it's not some issue with slang-test itself!

@jkwak-work
Copy link
Collaborator

I added tests/bugs/texture2d-gather.hlsl to the list.

@bmillsNV bmillsNV added this to the Q4 2024 (Fall) milestone Oct 17, 2024
@bmillsNV bmillsNV added kind:bug something doesn't work like it should goal:forward looking Feature needed at a later date, not connected to a specific use case. labels Oct 17, 2024
@bmillsNV bmillsNV assigned cheneym2 and unassigned aleino-nv Oct 29, 2024
@cheneym2
Copy link
Collaborator

The first several cases did not repro anything other than a warning for me, but I did repro with texture2d-gather.hlsl

$ build/Debug/bin/slang-test.exe tests/bugs/texture2d-gather.hlsl
Supported backends: fxc dxc glslang spirv-dis clang visualstudio genericcpp spirv-opt tint
Check vk,vulkan: Supported
Check dx12,d3d12: Supported
Check dx11,d3d11: Supported
Check cuda: Not Supported
Check wgpu,webgpu: Supported
passed test: 'tests/bugs/texture2d-gather.hlsl (dx11)'
ignored test: 'tests/bugs/texture2d-gather.hlsl.1 (mtl)'
WGPU error: Error while parsing WGSL: :32:6 error: nested structures cannot be used for entry point IO
     assembledVertex_0 : AssembledVertex_0,
     ^^^^^^^^^^^^^^^^^

:36:1 note: while analyzing entry point 'vertexMain'
fn vertexMain( input_0 : VertexStageInput_0) -> VertexStageOutput_0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{
^
    var output_0 : VertexStageOutput_0;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    var _S2 : vec4<f32> = (((vec4<f32>(input_0.assembledVertex_0.position_1, 1.0f)) * (unpackStorage_0(Uniforms_0.modelViewProjection_0))));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    output_0.position_0 = _S2;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    var _S3 : vec4<f32> = vec4<f32>(input_0.assembledVertex_0.color_1, 1.0f);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    output_0.color_0 = _S3;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
    return output_0;
^^^^^^^^^^^^^^^^^^^^
}
^


 - While validating [ShaderModuleDescriptor]
 - While calling [Device].CreateShaderModule([ShaderModuleDescriptor]).

WGPU error: Error while parsing WGSL: :7:6 error: missing entry point IO attribute
     color_0 : vec4<f32>,
     ^^^^^^^

:12:1 note: while analyzing entry point 'fragmentMain'
fn fragmentMain( input_0 : VertexStageOutput_0) -> vec4<f32>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{
^
    var _S1 : vec4<f32> = (textureGather((i32(0)), (g_texture_0), (g_sampler_0), (input_0.color_0.xy)));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    return _S1;
^^^^^^^^^^^^^^^
}
^


 - While validating [ShaderModuleDescriptor]
 - While calling [Device].CreateShaderModule([ShaderModuleDescriptor]).

WGPU error: Buffer usages (BufferUsage::(MapWrite|CopySrc|CopyDst)) is invalid. If a buffer usage contains BufferUsage::MapWrite the only other allowed usage is BufferUsage::CopySrc.
 - While calling [Device].CreateBuffer([BufferDescriptor "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"]).

WGPU error: [Invalid Buffer "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"] is invalid.
 - While calling [Queue].WriteBuffer([Invalid Buffer "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"], (0 bytes), data, (96 bytes))

Warning: Old OnSubmittedWorkDone APIs are deprecated. If using C please pass a CallbackInfo struct that has two userdatas. Otherwise, if using C++, please use templated helpers.
WGPU error: [Invalid ShaderModule (unlabeled)] is invalid.
 - While validating vertex stage ([Invalid ShaderModule (unlabeled)], entryPoint: vertexMain).
 - While validating vertex state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor]).

Warning: Old MapAsync APIs are deprecated. If using C please pass a CallbackInfo struct that has two userdatas. Otherwise, if using C++, please use templated helpers.
WGPU error: Number of entries (3) did not match the expected number of entries (2) for [BindGroupLayout (unlabeled)].
Expected layout: [{ binding: 0, visibility: ShaderStage::(Vertex|Fragment|Compute), texture: {sampleType: TextureSampleType::UnfilterableFloat, viewDimension: 2, multisampled: 0} }, { binding: 1, visibility: ShaderStage::(Vertex
|Fragment|Compute), sampler: {type: SamplerBindingType::Filtering} }]
 - While validating [BindGroupDescriptor] against [BindGroupLayout (unlabeled)]
 - While calling [Device].CreateBindGroup([BindGroupDescriptor]).

WGPU error: [Invalid Buffer "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"] is invalid.
 - While encoding [RenderPassEncoder (unlabeled)].SetVertexBuffer(0, [Invalid Buffer "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"], 0, 96).
 - While finishing [CommandEncoder (unlabeled)].

WGPU error: [Invalid CommandBuffer] is invalid.
 - While calling [Queue].Submit([[Invalid CommandBuffer]])

WGPU error: [Texture "Unnamed texture (type=Texture2D, size=1024x768x1, arrayLength=1, mipLevelCount=1, sampleCount=1, sampleQuality=0, format=R8G8B8A8_UNORM, memoryType=DeviceLocal, usage=RenderTarget, defaultState=RenderTarget
)"] usage (TextureUsage::RenderAttachment) doesn't include TextureUsage::CopySrc.
 - While validating source [Texture "Unnamed texture (type=Texture2D, size=1024x768x1, arrayLength=1, mipLevelCount=1, sampleCount=1, sampleQuality=0, format=R8G8B8A8_UNORM, memoryType=DeviceLocal, usage=RenderTarget, defaultSta
te=RenderTarget)"] usage.
 - While encoding [CommandEncoder (unlabeled)].CopyTextureToBuffer([Texture "Unnamed texture (type=Texture2D, size=1024x768x1, arrayLength=1, mipLevelCount=1, sampleCount=1, sampleQuality=0, format=R8G8B8A8_UNORM, memoryType=Dev
iceLocal, usage=RenderTarget, defaultState=RenderTarget)"], [Buffer (unlabeled)], [Extent3D width:1024, height:768, depthOrArrayLayers:1]).
 - While finishing [CommandEncoder (unlabeled)].

WGPU error: [Invalid CommandBuffer] is invalid.
 - While calling [Queue].Submit([[Invalid CommandBuffer]])

WGPU error: Error while parsing WGSL: :32:6 error: nested structures cannot be used for entry point IO
     assembledVertex_0 : AssembledVertex_0,
     ^^^^^^^^^^^^^^^^^

:36:1 note: while analyzing entry point 'vertexMain'
fn vertexMain( input_0 : VertexStageInput_0) -> VertexStageOutput_0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{
^
    var output_0 : VertexStageOutput_0;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    var _S2 : vec4<f32> = (((vec4<f32>(input_0.assembledVertex_0.position_1, 1.0f)) * (unpackStorage_0(Uniforms_0.modelViewProjection_0))));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    output_0.position_0 = _S2;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    var _S3 : vec4<f32> = vec4<f32>(input_0.assembledVertex_0.color_1, 1.0f);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    output_0.color_0 = _S3;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
    return output_0;
^^^^^^^^^^^^^^^^^^^^
}
^


 - While validating [ShaderModuleDescriptor]
 - While calling [Device].CreateShaderModule([ShaderModuleDescriptor]).

WGPU error: Error while parsing WGSL: :7:6 error: missing entry point IO attribute
     color_0 : vec4<f32>,
     ^^^^^^^

:12:1 note: while analyzing entry point 'fragmentMain'
fn fragmentMain( input_0 : VertexStageOutput_0) -> vec4<f32>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{
^
    var _S1 : vec4<f32> = (textureGather((i32(0)), (g_texture_0), (g_sampler_0), (input_0.color_0.xy)));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    return _S1;
^^^^^^^^^^^^^^^
}
^


 - While validating [ShaderModuleDescriptor]
 - While calling [Device].CreateShaderModule([ShaderModuleDescriptor]).

WGPU error: Buffer usages (BufferUsage::(MapWrite|CopySrc|CopyDst)) is invalid. If a buffer usage contains BufferUsage::MapWrite the only other allowed usage is BufferUsage::CopySrc.
 - While calling [Device].CreateBuffer([BufferDescriptor "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"]).

WGPU error: [Invalid Buffer "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"] is invalid.
 - While calling [Queue].WriteBuffer([Invalid Buffer "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"], (0 bytes), data, (96 bytes))

Warning: Old OnSubmittedWorkDone APIs are deprecated. If using C please pass a CallbackInfo struct that has two userdatas. Otherwise, if using C++, please use templated helpers.
WGPU error: [Invalid ShaderModule (unlabeled)] is invalid.
 - While validating vertex stage ([Invalid ShaderModule (unlabeled)], entryPoint: vertexMain).
 - While validating vertex state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor]).

Warning: Old MapAsync APIs are deprecated. If using C please pass a CallbackInfo struct that has two userdatas. Otherwise, if using C++, please use templated helpers.
WGPU error: Number of entries (3) did not match the expected number of entries (2) for [BindGroupLayout (unlabeled)].
Expected layout: [{ binding: 0, visibility: ShaderStage::(Vertex|Fragment|Compute), texture: {sampleType: TextureSampleType::UnfilterableFloat, viewDimension: 2, multisampled: 0} }, { binding: 1, visibility: ShaderStage::(Vertex
|Fragment|Compute), sampler: {type: SamplerBindingType::Filtering} }]
 - While validating [BindGroupDescriptor] against [BindGroupLayout (unlabeled)]
 - While calling [Device].CreateBindGroup([BindGroupDescriptor]).

WGPU error: [Invalid Buffer "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"] is invalid.
 - While encoding [RenderPassEncoder (unlabeled)].SetVertexBuffer(0, [Invalid Buffer "Unnamed buffer (size=96, elementSize=0, format=Unknown, memoryType=Upload, usage=VertexBuffer, defaultState=VertexBuffer)"], 0, 96).
 - While finishing [CommandEncoder (unlabeled)].

WGPU error: [Invalid CommandBuffer] is invalid.
 - While calling [Queue].Submit([[Invalid CommandBuffer]])

WGPU error: [Texture "Unnamed texture (type=Texture2D, size=1024x768x1, arrayLength=1, mipLevelCount=1, sampleCount=1, sampleQuality=0, format=R8G8B8A8_UNORM, memoryType=DeviceLocal, usage=RenderTarget, defaultState=RenderTarget
)"] usage (TextureUsage::RenderAttachment) doesn't include TextureUsage::CopySrc.
 - While validating source [Texture "Unnamed texture (type=Texture2D, size=1024x768x1, arrayLength=1, mipLevelCount=1, sampleCount=1, sampleQuality=0, format=R8G8B8A8_UNORM, memoryType=DeviceLocal, usage=RenderTarget, defaultSta
te=RenderTarget)"] usage.
 - While encoding [CommandEncoder (unlabeled)].CopyTextureToBuffer([Texture "Unnamed texture (type=Texture2D, size=1024x768x1, arrayLength=1, mipLevelCount=1, sampleCount=1, sampleQuality=0, format=R8G8B8A8_UNORM, memoryType=Dev
iceLocal, usage=RenderTarget, defaultState=RenderTarget)"], [Buffer (unlabeled)], [Extent3D width:1024, height:768, depthOrArrayLayers:1]).
 - While finishing [CommandEncoder (unlabeled)].

WGPU error: [Invalid CommandBuffer] is invalid.
 - While calling [Queue].Submit([[Invalid CommandBuffer]])

passed test: 'tests/bugs/texture2d-gather.hlsl.2 syn (wgpu)'
passed test: 'tests/bugs/texture2d-gather.hlsl.3 syn (dx12)'

===
100% of tests passed (3/3), 1 tests ignored
===

@cheneym2
Copy link
Collaborator

cheneym2 commented Nov 1, 2024

The following wgsl source is passed into wgpuDeviceCreateShaderModule(), and despite producing errors on console, it returns a non-null pointer which is treated as success by slang-rhi:

module.module = m_device->m_ctx.api.wgpuDeviceCreateShaderModule(m_device->m_ctx.device, &desc);
if (!module.module)
{
    return SLANG_FAIL;
}
struct _MatrixStorage_float4x4std140_0
{
    @align(16) data_0 : array<vec4<f32>, i32(4)>,
};

struct SLANG_ParameterGroup_Uniforms_std140_0
{
    @align(16) modelViewProjection_0 : _MatrixStorage_float4x4std140_0,
};

@binding(2) @group(0) var<uniform> Uniforms_0 : SLANG_ParameterGroup_Uniforms_std140_0;
fn unpackStorage_0( _S1 : _MatrixStorage_float4x4std140_0) -> mat4x4<f32>
{
    return mat4x4<f32>(_S1.data_0[i32(0)][i32(0)], _S1.data_0[i32(0)][i32(1)], _S1.data_0[i32(0)][i32(2)], _S1.data_0[i32(0)][i32(3)], _S1.data_0[i32(1)][i32(0)], _S1.data_0[i32(1)][i32(1)], _S1.data_0[i32(1)][i32(2)], _S1.data_0[i32(1)][i32(3)], _S1.data_0[i32(2)][i32(0)], _S1.data_0[i32(2)][i32(1)], _S1.data_0[i32(2)][i32(2)], _S1.data_0[i32(2)][i32(3)], _S1.data_0[i32(3)][i32(0)], _S1.data_0[i32(3)][i32(1)], _S1.data_0[i32(3)][i32(2)], _S1.data_0[i32(3)][i32(3)]);
}

struct VertexStageOutput_0
{
     color_0 : vec4<f32>,
     position_0 : vec4<f32>,
};

struct AssembledVertex_0
{
     position_1 : vec3<f32>,
     color_1 : vec3<f32>,
     uv_0 : vec2<f32>,
};

struct VertexStageInput_0
{
     assembledVertex_0 : AssembledVertex_0,
};

@vertex
fn vertexMain( input_0 : VertexStageInput_0) -> VertexStageOutput_0
{
    var output_0 : VertexStageOutput_0;
    var _S2 : vec4<f32> = (((vec4<f32>(input_0.assembledVertex_0.position_1, 1.0f)) * (unpackStorage_0(Uniforms_0.modelViewProjection_0))));
    output_0.position_0 = _S2;
    var _S3 : vec4<f32> = vec4<f32>(input_0.assembledVertex_0.color_1, 1.0f);
    output_0.color_0 = _S3;
    return output_0;
}

This error output shows up:

WGPU error: Error while parsing WGSL: :32:6 error: nested structures cannot be used for entry point IO
     assembledVertex_0 : AssembledVertex_0,
     ^^^^^^^^^^^^^^^^^

:36:1 note: while analyzing entry point 'vertexMain'
fn vertexMain( input_0 : VertexStageInput_0) -> VertexStageOutput_0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{
^
    var output_0 : VertexStageOutput_0;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    var _S2 : vec4<f32> = (((vec4<f32>(input_0.assembledVertex_0.position_1, 1.0f)) * (unpackStorage_0(Uniforms_0.modelViewProjection_0))));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    output_0.position_0 = _S2;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    var _S3 : vec4<f32> = vec4<f32>(input_0.assembledVertex_0.color_1, 1.0f);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    output_0.color_0 = _S3;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
    return output_0;
^^^^^^^^^^^^^^^^^^^^
}
^


 - While validating [ShaderModuleDescriptor] 
 - While calling [Device].CreateShaderModule([ShaderModuleDescriptor]).

@cheneym2
Copy link
Collaborator

cheneym2 commented Nov 1, 2024

The error itself can be seen in isolation using this website:

https://shader-playground.timjones.io/04ab99f50368049943c2adcf0ec696c8

But the issue is the lack of an error code coming out of wgpuDeviceCreateShaderModule, which seems to be returning success according to the non-null return. I guess that's a Dawn issue, or a user error, not sure yet which.

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 1, 2024

Let's not worry about fixing this issue for now, and instead we should focus on addressing the invalid wgsl output by Slang.
I believe @jkwak-work is already working on addressing the issue.

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 1, 2024

Thanks for getting to the bottom of this, @cheneym2. Given that we know this is not a bug in our stack, I think we should close this issue.

@jkwak-work
Copy link
Collaborator

Yes I am working on the error with tests/bugs/texture2d-gather.hlsl

Is it only test printing error message?
And the rest of them are printing just warnings?

@aleino-nv
Copy link
Collaborator Author

aleino-nv commented Nov 4, 2024

WebGPU uses an error callback to report errors.
https://github.com/shader-slang/slang-rhi/blob/eaed14f275306c5c8a6240b4d40be742894d135e/src/wgpu/wgpu-device.cpp#L14

https://github.com/shader-slang/slang-rhi/blob/eaed14f275306c5c8a6240b4d40be742894d135e/src/wgpu/wgpu-device.cpp#L47

At the moment we just print them out.
Perhaps we should look at the error type in some cases, and respond to the error that way?

@cheneym2
Copy link
Collaborator

cheneym2 commented Nov 4, 2024

I think we need to propagate the error seen in the callback, as Anders mentioned and not close the issue until then.

@cheneym2
Copy link
Collaborator

cheneym2 commented Nov 4, 2024

shader-slang/slang-rhi#95 would make the failed compilation at least return SLANG_FAIL, which is faithfully recorded as a failed error code by the test harness, however, being an HLSL comparison test, the fact that the HLSL and Slang paths both return the same compilation error, texture2d-gather.hlsl still passes.

@cheneym2
Copy link
Collaborator

cheneym2 commented Nov 4, 2024

The inner test in spawnAndWaitSharedLibrary sees an error code, storing it in ExecuteResult outRes.errorCode
https://github.com/shader-slang/slang/blob/master/tools/slang-test/slang-test-main.cpp#L847 and returns SLANG_OK as the return from spawnAndWaitSharedLibrary().

doRenderComparisonTestRun merely builds the error code into an output string, and returns TestResult::Pass.
In this, both the "expected" and "actual" runs show the same "TestResult::Pass" return value and same output string that shows wgsl compilation failed. https://github.com/shader-slang/slang/blob/master/tools/slang-test/slang-test-main.cpp#L3568

The test is an overall match success.

@csyonghe
Copy link
Collaborator

csyonghe commented Nov 4, 2024

The test should definitely propagate any error code and return Fail when shader compilation failed.

@cheneym2
Copy link
Collaborator

cheneym2 commented Nov 4, 2024

Testing https://github.com/shader-slang/slang/pull/5485/files#diff-45451d657441da687eb40563c21b977d64ba42d643fd5783a1bc937b3eac62b3 as a possible fix, though I assume it will also require disabling newly failing tests once I see which they are.

@csyonghe csyonghe closed this as completed Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:forward looking Feature needed at a later date, not connected to a specific use case. kind:bug something doesn't work like it should siggraphasia-2024
Projects
None yet
Development

No branches or pull requests

5 participants