Bug 199688 - [WHLSL] The recursion checker should not have quadratic complexity
Summary: [WHLSL] The recursion checker should not have quadratic complexity
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-07-10 15:58 PDT by Robin Morisset
Modified: 2019-07-16 12:49 PDT (History)
3 users (show)

See Also:


Attachments
Patch (3.12 KB, patch)
2019-07-10 17:06 PDT, Robin Morisset
no flags Details | Formatted Diff | Diff
Patch (3.16 KB, patch)
2019-07-10 17:31 PDT, Robin Morisset
no flags Details | Formatted Diff | Diff
Patch (3.16 KB, patch)
2019-07-10 17:33 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-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>