Bug 200410 - [WHLSL] Avoid visiting the full AST in computeDimensions
Summary: [WHLSL] Avoid visiting the full AST in computeDimensions
Status: RESOLVED FIXED
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:
Blocks:
 
Reported: 2019-08-02 16:40 PDT by Robin Morisset
Modified: 2019-08-02 18:11 PDT (History)
3 users (show)

See Also:


Attachments
Patch (3.83 KB, patch)
2019-08-02 16:43 PDT, Robin Morisset
no flags Details | Formatted Diff | Diff

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