Bug 199688

Summary: [WHLSL] The recursion checker should not have quadratic complexity
Product: WebKit Reporter: Robin Morisset <rmorisset>
Component: WebGPUAssignee: Robin Morisset <rmorisset>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=199835
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Robin Morisset 2019-07-10 15:58:38 PDT
...
Comment 1 Robin Morisset 2019-07-10 17:06:15 PDT
Created attachment 373878 [details]
Patch
Comment 2 Saam Barati 2019-07-10 17:10:20 PDT
Comment on attachment 373878 [details]
Patch

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

> Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:47
> +    void visit(Program& program) override
> +    {
> +        for (auto& functionDefinition : program.functionDefinitions())
> +            checkErrorAndVisit(functionDefinition);
> +    }

Nice. We should probably do this in more phases.

> Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:62
> +        auto addResult2 = m_finishedVisiting.add(&functionDefinition);
> +        ASSERT_UNUSED(addResult2, addResult2);

this probably doesn't compile on debug builds. You want addResult2.isNewEntry.

Also, can you just give it its own scope instead of calling it addResult2? Or perhaps limit scope to above addResult?
Comment 3 Robin Morisset 2019-07-10 17:31:17 PDT
Created attachment 373880 [details]
Patch
Comment 4 Robin Morisset 2019-07-10 17:33:24 PDT
Created attachment 373881 [details]
Patch
Comment 5 WebKit Commit Bot 2019-07-10 18:18:21 PDT
Comment on attachment 373881 [details]
Patch

Clearing flags on attachment: 373881

Committed r247339: <https://trac.webkit.org/changeset/247339>
Comment 6 WebKit Commit Bot 2019-07-10 18:18:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-07-10 18:19:25 PDT
<rdar://problem/52925463>