Bug 239377 - [WebGPU] Implement hardware limits
Summary: [WebGPU] Implement hardware limits
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-15 01:34 PDT by Myles C. Maxfield
Modified: 2022-04-16 12:28 PDT (History)
11 users (show)

See Also:


Attachments
Patch (50.08 KB, patch)
2022-04-15 01:41 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (49.35 KB, patch)
2022-04-15 02:20 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (53.99 KB, patch)
2022-04-15 13:52 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (54.01 KB, patch)
2022-04-15 13:57 PDT, Myles C. Maxfield
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2022-04-15 01:34:57 PDT
[WebGPU] Implement hardware limits
Comment 1 Myles C. Maxfield 2022-04-15 01:41:37 PDT
Created attachment 457684 [details]
Patch
Comment 2 Myles C. Maxfield 2022-04-15 02:20:58 PDT
Created attachment 457686 [details]
Patch
Comment 3 Myles C. Maxfield 2022-04-15 13:52:30 PDT
Created attachment 457720 [details]
Patch
Comment 4 Myles C. Maxfield 2022-04-15 13:57:51 PDT
Created attachment 457722 [details]
Patch
Comment 5 Darin Adler 2022-04-15 15:51:14 PDT
Comment on attachment 457722 [details]
Patch

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

> Source/WebGPU/WebGPU/Adapter.h:45
> +    static Ref<Adapter> create(id<MTLDevice> device, Instance& instance, WGPULimits&& limits)

There is no benefit to passing a structure full of scalars with an rvalue reference and calling WTFMove. Just const& is fine for this kind of object, unless this is generic code where it might be something with non-scalars in it, or if we think we’ll be evolving it some day.

> Source/WebGPU/WebGPU/HardwareLimits.mm:41
> +static WGPULimits apple3()

constexpr

> Source/WebGPU/WebGPU/HardwareLimits.mm:75
> +static WGPULimits apple4()

constexpr

> Source/WebGPU/WebGPU/HardwareLimits.mm:109
> +static WGPULimits apple5()

constexpr

> Source/WebGPU/WebGPU/HardwareLimits.mm:144
> +static WGPULimits apple6()

constexpr

> Source/WebGPU/WebGPU/HardwareLimits.mm:178
> +static WGPULimits apple7()

constexpr

> Source/WebGPU/WebGPU/HardwareLimits.mm:338
> +static bool checkLimits(const WGPULimits& limits)

This could be constexpr

> Source/WebGPU/WebGPU/HardwareLimits.mm:386
> +bool isValid(const WGPULimits& limits)

This could be constexpr

> Source/WebGPU/WebGPU/HardwareLimits.mm:391
> +bool anyLimitIsBetterThan(const WGPULimits& target, const WGPULimits& reference)

This could be constexpr
Comment 6 Myles C. Maxfield 2022-04-15 21:48:20 PDT
Committed r292940 (249705@trunk): <https://commits.webkit.org/249705@trunk>
Comment 7 Radar WebKit Bug Importer 2022-04-15 21:49:14 PDT
<rdar://problem/91842461>
Comment 8 Ryosuke Niwa 2022-04-16 12:06:42 PDT
This patch broke builds:
https://build.webkit.org/#/builders/12/builds/11560

/Volumes/Data/worker/bigsur-debug/build/Source/WebGPU/WebGPU/HardwareLimits.mm:338:23: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
Comment 9 Myles C. Maxfield 2022-04-16 12:19:32 PDT
(In reply to Ryosuke Niwa from comment #8)
> This patch broke builds:
> https://build.webkit.org/#/builders/12/builds/11560
> 
> /Volumes/Data/worker/bigsur-debug/build/Source/WebGPU/WebGPU/HardwareLimits.
> mm:338:23: error: constexpr function never produces a constant expression
> [-Winvalid-constexpr]

Trying to reproduce now
Comment 10 Myles C. Maxfield 2022-04-16 12:25:20 PDT
(In reply to Myles C. Maxfield from comment #9)
> (In reply to Ryosuke Niwa from comment #8)
> > This patch broke builds:
> > https://build.webkit.org/#/builders/12/builds/11560
> > 
> > /Volumes/Data/worker/bigsur-debug/build/Source/WebGPU/WebGPU/HardwareLimits.
> > mm:338:23: error: constexpr function never produces a constant expression
> > [-Winvalid-constexpr]
> 
> Trying to reproduce now

I can't reproduce this (possibly because I have a different SDK installed than the one bot uses), but I can see by inspection that the error is correct - that function is marked as constexpr but will never produce a constant expression. I'll commit a prospective fix.
Comment 11 Myles C. Maxfield 2022-04-16 12:28:25 PDT
(In reply to Myles C. Maxfield from comment #10)
> (In reply to Myles C. Maxfield from comment #9)
> > (In reply to Ryosuke Niwa from comment #8)
> > > This patch broke builds:
> > > https://build.webkit.org/#/builders/12/builds/11560
> > > 
> > > /Volumes/Data/worker/bigsur-debug/build/Source/WebGPU/WebGPU/HardwareLimits.
> > > mm:338:23: error: constexpr function never produces a constant expression
> > > [-Winvalid-constexpr]
> > 
> > Trying to reproduce now
> 
> I can't reproduce this (possibly because I have a different SDK installed
> than the one bot uses), but I can see by inspection that the error is
> correct - that function is marked as constexpr but will never produce a
> constant expression. I'll commit a prospective fix.

https://commits.webkit.org/r292941