Bug 237736 - [WGSL] Add the core parts of the behavior checker
Summary: [WGSL] Add the core parts of the behavior checker
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robin Morisset
URL:
Keywords: InRadar
Depends on: 236655
Blocks:
  Show dependency treegraph
 
Reported: 2022-03-10 15:11 PST by Robin Morisset
Modified: 2022-04-13 16:15 PDT (History)
6 users (show)

See Also:


Attachments
Patch (30.99 KB, patch)
2022-03-10 17:08 PST, Robin Morisset
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (32.72 KB, patch)
2022-03-14 13:29 PDT, Robin Morisset
rmorisset: review-
rmorisset: commit-queue-
Details | Formatted Diff | Diff
WIP (38.92 KB, patch)
2022-04-13 16:15 PDT, Robin Morisset
rmorisset: review-
rmorisset: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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