Fix race condition in shader validation tests#4597
Fix race condition in shader validation tests#4597diegodelatoba wants to merge 1 commit intogpuweb:mainfrom
Conversation
Combines GPU error scope validation and compilation info checks into a single sequential async operation to prevent non-deterministic error message ordering. This fixes intermittent test failures where error messages would appear in different orders across test runs due to parallel async execution.
|
@greggman is there a race in the current logic? We see errors print in different orders based on promise resolution and the spec says: https://www.w3.org/TR/webgpu/#dom-gpudevice-poperrorscope says:
or am I missing something and is the test currently guaranteed to be deterministic? |
|
I'm not seeing the race but I'm terrible at seeing races 😅 The first check just expects that eventually the compilation validation succeeds or fails. Regardless, it will immediately and synchronously return a shader module. The 2nd check is that you can call I don't see a race about which order those are expected happen. The test seems like it allows them happening in any order @diegodelatoba where do you see the race? |
@greggman From my understanding the race isn't about which check happens first since those can happen in any order. Perhaps "race" was not the correct wording here but the issue here is that currently there is non-deterministic error message printing in the test output. What I found is that |
ok, that makes more sense to me. I wouldn't expect to see logs get interleaved, there's still only one JS thread. But, the order individual tests get logged might be different. I wonder if it would be better to order the outputs at a lower level. As it is, it looks like the code calls throwing out ideas
I'm leaning toward something more like 1. There aren't that many calls to Or maybe we can just make this change for this test. I'd be nice to get @kainino0x's feedback. |
Changes:
expectCompileResultimplementations to use a singleeventualAsyncExpectationthat executes GPU validation and compilationchecks sequentially
let shaderModuletoconst shaderModulefor better code qualityTesting:
Verified in WebKit with 500 consecutive test runs with no failures (previously
failed around iteration 15-304).
Note: This is a test infrastructure bug fix, not related to a spec change.
No CTS project tracker issue is required.
Requirements for PR author:
.unimplemented()./** documented */and new helper files are found inhelper_index.txt.Requirements for reviewer sign-off:
When landing this PR, be sure to make any necessary issue status updates.