Bug 237736

Summary: [WGSL] Add the core parts of the behavior checker
Product: WebKit Reporter: Robin Morisset <rmorisset>
Component: WebGPUAssignee: Robin Morisset <rmorisset>
Status: ASSIGNED ---    
Severity: Normal CC: benjamin, cdumez, cmarcelo, ews-watchlist, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 236655    
Bug Blocks:    
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
rmorisset: review-, rmorisset: commit-queue-
WIP rmorisset: review-, rmorisset: commit-queue-

Description Robin Morisset 2022-03-10 15:11:05 PST
There are a few validation phases required for WGSL:
- Type checking
- Behavior checking (see https://www.w3.org/TR/WGSL/#behaviors)
- Uniformity analysis
- no recursion
- only valid attributes applied
- etc...

I decided to start by the behavior checking, for the following reasons:
- It is fairly simple
- But it touches both statements and expressions
- And it will be required for uniformity
Comment 1 Robin Morisset 2022-03-10 17:08:52 PST
Created attachment 454430 [details]
Patch
Comment 2 Myles C. Maxfield 2022-03-10 19:30:45 PST
Comment on attachment 454430 [details]
Patch

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

> Source/WTF/ChangeLog:9
> +        Added IndexMap::insert, which automatically grows the underlying vector if needed.
> +        It allows using IndexMap ergonomically even if we don't know the number of keys ahead of time.

This probably should be its own patch, with its own TestWTF tests
Comment 3 Robin Morisset 2022-03-14 13:26:07 PDT
(In reply to Myles C. Maxfield from comment #2)
> Comment on attachment 454430 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=454430&action=review
> 
> > Source/WTF/ChangeLog:9
> > +        Added IndexMap::insert, which automatically grows the underlying vector if needed.
> > +        It allows using IndexMap ergonomically even if we don't know the number of keys ahead of time.
> 
> This probably should be its own patch, with its own TestWTF tests

IndexMap currently does not seem to have any test whatsoever. I filed https://bugs.webkit.org/show_bug.cgi?id=237847 about it.
Comment 4 Robin Morisset 2022-03-14 13:29:08 PDT
Created attachment 454617 [details]
Patch

Validator.h was missing.
Comment 5 Robin Morisset 2022-03-14 14:16:34 PDT
Comment on attachment 454617 [details]
Patch

Cancelling the review as trying to implement the uniformity analysis in the same style showed that it is too limited.
Comment 6 Radar WebKit Bug Importer 2022-03-17 16:12:16 PDT
<rdar://problem/90458338>
Comment 7 Robin Morisset 2022-04-13 16:15:57 PDT
Created attachment 457573 [details]
WIP