Bug 198978

Summary: [WHLSL] Create a shading language test harness
Product: WebKit Reporter: Justin Fan <justin_fan>
Component: WebGPUAssignee: Justin Fan <justin_fan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dino, ews-watchlist, graouts, jonlee, kondapallykalyan, mmaxfield, rniwa, saam, tsavell, webkit-bug-importer
Priority: P1 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 199028    
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews105 for mac-highsierra-wk2
none
Patch
none
Archive of layout-test-results from ews107 for mac-highsierra-wk2
none
Patch for landing none

Description Justin Fan 2019-06-18 15:40:35 PDT
[WHLSL] Create a shading language test harness
Comment 1 Justin Fan 2019-06-18 16:00:39 PDT
Created attachment 372399 [details]
Patch
Comment 2 EWS Watchlist 2019-06-18 17:05:33 PDT
Comment on attachment 372399 [details]
Patch

Attachment 372399 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/12513922

New failing tests:
webgpu/whlsl-harness-test.html
Comment 3 EWS Watchlist 2019-06-18 17:05:34 PDT
Created attachment 372407 [details]
Archive of layout-test-results from ews105 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 4 Myles C. Maxfield 2019-06-18 17:30:26 PDT
Comment on attachment 372399 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=372399&action=review

I don’t see any WHLSL yet. What would that look like using this harness?

> LayoutTests/webgpu/whlsl-harness-test.html:27
> +let tests = {};

Can the harness be used in many different tests? I think we will want many files rather than dumping all the tests in a single file.
Comment 5 Justin Fan 2019-06-18 17:55:15 PDT
(In reply to Myles C. Maxfield from comment #4)
> Comment on attachment 372399 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=372399&action=review
> 
> I don’t see any WHLSL yet. What would that look like using this harness?
> 
> > LayoutTests/webgpu/whlsl-harness-test.html:27
> > +let tests = {};
> 
> Can the harness be used in many different tests? I think we will want many
> files rather than dumping all the tests in a single file.

Yes; whlsl-test-harness.js is designed to be used by itself or in combo with the WPT test harness as shown here. whlsl-harness-test.html is just to test the harness itself.

I plan on replacing the MSL with WHLSL, or adding a WHLSL mode to the harness immediately. This is just to make sure that the WebGPU bits will work properly, and to serve as a proof of concept.
Comment 6 Justin Fan 2019-06-18 19:43:11 PDT
Created attachment 372420 [details]
Patch
Comment 7 EWS Watchlist 2019-06-18 21:01:36 PDT
Comment on attachment 372420 [details]
Patch

Attachment 372420 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/12516121

New failing tests:
webgpu/whlsl-harness-test.html
Comment 8 EWS Watchlist 2019-06-18 21:01:38 PDT
Created attachment 372425 [details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 9 Justin Fan 2019-06-19 13:08:25 PDT
Investigating failure on High Sierra.
Comment 10 Justin Fan 2019-06-19 18:02:52 PDT
Figured out the issue. Some types (e.g. uint) are restricted to the metal namespace (e.g. metal::uint) on the version of the MSL compiler on High Sierra. Adding "using namespace metal" to all Metal shaders generated by the harness.
Comment 11 Justin Fan 2019-06-19 19:35:16 PDT
Created attachment 372519 [details]
Patch for landing
Comment 12 WebKit Commit Bot 2019-06-19 20:18:43 PDT
Comment on attachment 372519 [details]
Patch for landing

Clearing flags on attachment: 372519

Committed r246628: <https://trac.webkit.org/changeset/246628>
Comment 13 WebKit Commit Bot 2019-06-19 20:18:45 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Radar WebKit Bug Importer 2019-06-19 20:19:22 PDT
<rdar://problem/51926676>
Comment 15 Truitt Savell 2019-06-20 08:30:09 PDT
Looks like the new test webgpu/whlsl-harness-test.html
added in https://trac.webkit.org/changeset/246628/webkit

is a constant crash on High Sierra WK2

History:
https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=webgpu%2Fwhlsl-harness-test.html

Crash:
VM Regions Near 0x44:
--> 
    __TEXT                 0000000104a67000-0000000104a68000 [    4K] r-x/rwx SM=COW  /Volumes/VOLUME/*/*.Development

Application Specific Information:
CRASHING TEST: webgpu/whlsl-harness-test.html

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.driver.AppleIntelHD4000GraphicsMTLDriver	0x00007fff2ee03733 IGAccelComputeCommandEncoder::setEmulationBuffer(MTLIGAccelBuffer*, unsigned int, unsigned int) + 43
1   com.apple.driver.AppleIntelHD4000GraphicsMTLDriver	0x00007fff2ee0edcf -[MTLIGAccelComputeCommandEncoder setEmulationBuffers:offsets:withRange:] + 96
2   com.apple.Metal               	0x00007fff399c8a2d __57-[MTLIOAccelComputeCommandEncoder bindEmulationArguments]_block_invoke.8 + 54
3   com.apple.Metal               	0x00007fff399d93e3 -[MTLIndirectArgumentBufferEmulationData bindIndirectArgumentsWithFunctions:] + 166
4   com.apple.Metal               	0x00007fff399c89a5 -[MTLIOAccelComputeCommandEncoder bindEmulationArguments] + 354
5   com.apple.driver.AppleIntelHD4000GraphicsMTLDriver	0x00007fff2edfabc3 -[MTLIGAccelComputeCommandEncoder dispatchThreadgroups:threadsPerThreadgroup:] + 211
6   com.apple.WebCore             	0x000000010662297c WebCore::GPUComputePassEncoder::dispatch(unsigned int, unsigned int, unsigned int) + 140
Comment 16 Jon Lee 2019-06-20 09:57:21 PDT
Justin, Myles, I suggest for now to skip webgpu on High Sierra and we file a separate bug to re-enable for follow-up.
Comment 17 Justin Fan 2019-06-20 12:38:10 PDT
Filed https://bugs.webkit.org/show_bug.cgi?id=199076.