Skip to content

Update GPUAdapterLimits to GPUSupportedLimits - #1765

Merged
toji merged 3 commits into
mainfrom
supported-limits
Jun 1, 2021
Merged

toji merged 3 commits into
mainfrom
supported-limits

Conversation

@toji

@toji toji commented May 24, 2021 •

Copy link
Copy Markdown
Member

Previously the GPUDevice had a limits attribute that was of type object, but there doesn't seem to be any reason why it can't share an interface with the GPUAdapter's limits. To reflect that shared use that interface gets renamed to GPUSupportedLimits like the GPUSupportedFeatures before it.

Additionally, there's been some discussion about what should happen when the user defines limits that are worse than the default limits. This change adds some logic to clamp them to the default value, but we shouldn't land it till we agree on what should happen. I just wanted to demonstrate how one approach to that problem could work.


Preview | Diff

@toji
toji requested review from kainino0x and kvark May 24, 2021 23:15
@kainino0x

Copy link
Copy Markdown
Contributor

This change adds some logic to clamp them to the default value,

I thought of two arguments for what to choose here:

  • If an app is using webgpu-compat, it could request lower than default limits. If requestDevice did validation that the requested limits >= defaults, then apps would crash on implementations that do not implement webgpu-compat.
  • If we enforce lower-than-default limits, then middleware won't be able to assume the default limits are available.

This eliminates the other two options, so I think clamping is best (despite the slightly spooky behavior).

@kainino0x kainino0x left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reminds me we can consider merging the definitions of [=supported limits=] and {{GPUSupportedLimits}}: #1312 (comment)

Comment thread spec/index.bs Resolved
Comment thread spec/index.bs

<div class=validusage>
- Each key in |descriptor|.{{GPUDeviceDescriptor/nonGuaranteedLimits}}
must be the name of a member of [=supported limits=].

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reclassifying this as an OperationError was suggested by @kainino0x in the review of this Chrome change:

Hm... the spec as I wrote it requires a TypeError here, but it occurs to me an OperationError might be better to match the behavior between "limit not known" and "limit higher than supported", because probably the former can be considered a special case of the latter....

DamieFC pushed a commit to DamieFC/chromium that referenced this pull request May 27, 2021
This patch mirrors the current discussions in the spec
(gpuweb/gpuweb#1765).

Bug: 1212868
Change-Id: I34a46712778449f020a05695d9a9a1ab03e049ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2915661
Commit-Queue: Brandon Jones <[email protected]>
Reviewed-by: Kai Ninomiya <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Cr-Commit-Position: refs/heads/master@{#887327}
@toji
toji merged commit de6eefd into main Jun 1, 2021
@toji
toji deleted the supported-limits branch June 1, 2021 16:07
github-actions Bot added a commit that referenced this pull request Jun 1, 2021
SHA: de6eefd
Reason: push, by @toji

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Jun 1, 2021
SHA: de6eefd
Reason: push, by @toji

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Jun 1, 2021
SHA: de6eefd
Reason: push, by @toji

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants