Bug 200410

Summary: [WHLSL] Avoid visiting the full AST in computeDimensions
Product: WebKit Reporter: Robin Morisset <rmorisset>
Component: WebGPUAssignee: Robin Morisset <rmorisset>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Robin Morisset 2019-08-02 16:40:46 PDT
We only need to look at the attributes of function definitions, nothing else.
And currently we spend a couple of milliseconds in computeDimensions.
Comment 1 Robin Morisset 2019-08-02 16:43:52 PDT
Created attachment 375466 [details]
Patch

2ms -> 0.002ms for that pass.
Comment 2 Myles C. Maxfield 2019-08-02 16:49:07 PDT
Comment on attachment 375466 [details]
Patch

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

> Source/WebCore/Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp:52
> +                if (&functionDefinition == &entryPoint) {

Can we move this check outside of the nearest for loop?
Comment 3 Robin Morisset 2019-08-02 17:16:43 PDT
(In reply to Myles C. Maxfield from comment #2)
> Comment on attachment 375466 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=375466&action=review
> 
> > Source/WebCore/Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp:52
> > +                if (&functionDefinition == &entryPoint) {
> 
> Can we move this check outside of the nearest for loop?

Not easily: the loop has two jobs, both computing the dimensions for the entry point and verifying that no function has multiple NumThreads attributes.
So we can't just "continue;" in the case where &functionDefinition != &entryPoint.
Comment 4 WebKit Commit Bot 2019-08-02 18:10:49 PDT
Comment on attachment 375466 [details]
Patch

Clearing flags on attachment: 375466

Committed r248194: <https://trac.webkit.org/changeset/248194>
Comment 5 WebKit Commit Bot 2019-08-02 18:10:51 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2019-08-02 18:11:20 PDT
<rdar://problem/53888075>