Skip to content

Limit tiering support#9119

Open
andyleiserson wants to merge 3 commits intogfx-rs:trunkfrom
andyleiserson:jj-push-qtxq
Open

Limit tiering support#9119
andyleiserson wants to merge 3 commits intogfx-rs:trunkfrom
andyleiserson:jj-push-qtxq

Conversation

@andyleiserson
Copy link
Contributor

@andyleiserson andyleiserson commented Feb 27, 2026

Related Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1979753

To make it harder to use WebGPU for fingerprinting, we want to report limit values that are quantized to a set of pre-defined buckets, rather than raw limit values that are likely to have more entropy that is useful for fingerprinting.

This change implements tiered limit support. Tiered limits are requested by a new apply_limit_tiers flag in RequestAdapterOptions. By default that flag is false and limits are not modified by the tiering logic.

There is a module comment in the new wgpu_core::limits module that explains limit tiering in more depth.

I determined the tiers by crunching a bunch of data from gpuinfo and collected at https://webgpu-limits.netlify.app/. I am not sure how best to capture/preserve the analysis tooling for future use, I'm open to suggestions. For more detail of the tiers, see the tiers.html attachment on the linked bug.

Testing
Adds a directed test suite.

Squash or Rebase? Rebase

Checklist

  • Need to change log::info! to debug!.
  • Needs a CHANGELOG.md entry.

@andyleiserson andyleiserson force-pushed the jj-push-qtxq branch 2 times, most recently from 170bc92 to f052d0f Compare March 2, 2026 22:39
};

// e.g. Apple M Series
const M1: Tier = Tier {
Copy link
Member

Choose a reason for hiding this comment

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

Could we make the const names more readable, even if we want to keep any user visible names short?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any naming suggestions? I had avoided using the brand names on a general principle of avoiding using brand names when possible, and also because confusion could result when a device lands in a tier for the "wrong" brand. (I'm not opposed to naming them with the full brands, just curious if you have any other suggestions.)

Copy link
Member

Choose a reason for hiding this comment

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

If the tiers we come up with can apply to multiple GPUs/backends I think just TIER_X would be ideal.

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

Overall feedback: I think it would be ideal if the building blocks (ex: current UPLEVEL) for tiers were always less capable than the tier they are building. I had to keep going back and forth to check if a limit is being lowered in a tier compared to UPLEVEL.

is_fallback_adapter: bool,

subgroup_min_size: u32,
subgroup_max_size: u32,
Copy link
Member

Choose a reason for hiding this comment

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

Currently Firefox's vendor, architecture, device and description are empty. It might be nice if the tier contained strings for them (if they don't reveal additional information). Not blocking though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The values we report to content are empty, but we have the data. The logic that reports empty values to content is in dom::webgpu::AdapterInfo. In https://phabricator.services.mozilla.com/D286387 I capture the telemetry in wgpu_bindings, so it gets the real values. about::support also gets the real values.

I'm not sure I understand what you mean by "might be nice if the tier contained [the device info]" though. Do you mean recording the "e.g." devices listed in comments on the definitions in the structure itself?

Copy link
Member

Choose a reason for hiding this comment

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

Do you mean recording the "e.g." devices listed in comments on the definitions in the structure itself?

Yes, I was imagining that we can report something to content rather than empty strings (if they don't reveal additional information) if we have buckets specifically for amd/nvidia/apple silicon also considering that content can most likely check how the GPU samples to figure out the vendor at the very least.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't done anything about this question. I don't think the limit bucket names will work very well as an architecture proxy, whether that manifests now (no-f16, which has both AMD and NVIDIA) or later (when we change the buckets). So my preference would be to leave this as-is, and address it in #8649.

@teoxoy
Copy link
Member

teoxoy commented Mar 11, 2026

On naming: The name "tier" implies an ordering, maybe we should use the term "bucket" instead. Some buckets can have an order but we will have diverging sets.

@teoxoy
Copy link
Member

teoxoy commented Mar 19, 2026

On naming: The name "tier" implies an ordering, maybe we should use the term "bucket" instead. Some buckets can have an order but we will have diverging sets.

Thoughts on this? I found myself tripping up saying "adapter tiering". The spec also uses the term "bucket" for this.

@andyleiserson
Copy link
Contributor Author

The latest push renames it from tiers to buckets.

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

🎉

@teoxoy
Copy link
Member

teoxoy commented Mar 20, 2026

Ah sorry I shouldn't have resolved the changelog conflict via GH's UI since this is supposed to be rebased.

@teoxoy
Copy link
Member

teoxoy commented Mar 20, 2026

If you want you can also add clip distances to the M1 bucket, see #9270.

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