Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

kvark
Copy link
Contributor

@kvark kvark commented Dec 14, 2020

Addresses one of the major blockers mentioned in #1298
Closes #1278
Related to #1169

This is a relatively basic proposal for exposing the queue families. Like D3D12, it associates queue classes to queue families (which are separate concepts in Vulkan), which simplifies our API without losing much power.

Note: the PR needs a few more words on validation, but I wanted to get feedback on the approach first.


Preview | Diff

@github-actions
Copy link
Contributor

Previews, as seen at the time of posting this comment:
WebGPU | IDL
WGSL
2899193


<script type=idl>
dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
GPUQueueKind kind = "general";
Copy link
Contributor

Choose a reason for hiding this comment

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

So we would have exactly one queue family of each type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, yes. That matches D3D12, and I think it matches the Vulkan adapter geometry in practice, i.e. a recent AMD card has 1 general queue, one compute queue family with 2 queues, and 1 transfer queue family with 2 queues.

@github-actions
Copy link
Contributor

Previews, as seen at the time of posting this comment:
WebGPU | IDL
WGSL
75352b5

@tidoust
Copy link
Contributor

tidoust commented Dec 15, 2020

@kvak, the IPR bot complains because the Working Group just switched to the new Patent Policy, which means that you have to re-join the working group.

Copy link
Contributor

@Kangz Kangz left a comment

Choose a reason for hiding this comment

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

I'm a bit worried that we are adding MQ interface and spec text when we don't even know if we want it for v1. In particular I think we shouldn't have MQ in v1 and this PR (and the previous MQ PR) give the wrong impression.

[SameObject] readonly attribute GPUAdapterFeatures features;
//readonly attribute GPULimits limits; Don't expose higher limits for now.

readonly attribute unsigned long computeQueueCount;
Copy link
Contributor

Choose a reason for hiding this comment

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

So the application doesn't opt-into having more queues, but just receives them, always? That a portability hazard and imho it should be something you request as part of device creation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Even better I think applications should just be able to request a compute or transfer queue, even if the system doesn't have one. The number of queues in the system would just be a hint (or would disappear to avoid fingerprinting).

@kvark
Copy link
Contributor Author

kvark commented Dec 15, 2020

I'm a bit worried that we are adding MQ interface and spec text when we don't even know if we want it for v1. In particular I think we shouldn't have MQ in v1 and this PR (and the previous MQ PR) give the wrong impression.

@Kangz this is clearly a part of MQ story, and it's nice to discuss things with a semi-concrete proposal in mind, even if we decide that the whole MQ is delayed till after MVP or V1.

So the application doesn't opt-into having more queues, but just receives them, always? That a portability hazard and imho it should be something you request as part of device creation.

It's an interesting and complicated topic. Unlike the story with limits, the multiple queues can't be used "blindly". The developer always opts into them in code. How do you imagine developers using the API? Here is what I expect:

  • either they don't care, and they only use the default queue
  • or they do care, and they want to use all the queues we can give them

How many applications do you expect to just ask for one extra compute queue, for example, and not bother using more compute queues if available?

Even better I think applications should just be able to request a compute or transfer queue, even if the system doesn't have one. The number of queues in the system would just be a hint (or would disappear to avoid fingerprinting).

I think that ruins the explicit nature of MQ: the only reason we are trying to expose it is so the advanced users can benefit from it. If we do what you suggest, they don't really know if that queue is really a separate queue or just an useless API construct.

@Kangz
Copy link
Contributor

Kangz commented Dec 16, 2020

@Kangz this is clearly a part of MQ story, and it's nice to discuss things with a semi-concrete proposal in mind, even if we decide that the whole MQ is delayed till after MVP or V1.

Sure, what I'm meant is that we shouldn't land these as part of the spec until we decide we want MQ because otherwise, well, it is part of the spec and has to be implemented. I thought the GPUCommandEncoderDescriptor part was landed but it seems it's still pending so I have less concerns.

How many applications do you expect to just ask for one extra compute queue, for example, and not bother using more compute queues if available?

I expect most applications would use a single queue of each type, if they decide to use multiple queues. There isn't a lot of benefit to using multiple transfer queues, and all the engines I've heard using async compute do it on a single queue (even when AMD hardware has more than 1 compute queue). In a sense you get the most advantage from the first queue of a new type you use, with diminishing returns or even disadvantages when you use more due to the additional synchronization overhead.

Even better I think applications should just be able to request a compute or transfer queue, even if the system doesn't have one. The number of queues in the system would just be a hint (or would disappear to avoid fingerprinting).

I think that ruins the explicit nature of MQ: the only reason we are trying to expose it is so the advanced users can benefit from it. If we do what you suggest, they don't really know if that queue is really a separate queue or just an useless API construct.

It doesn't prevent the adapter from exposing whether the there are true compute and transfer queues in addition to the default queue and developers can use that data on the adapter to choose whether to use the MQ code path or not. Always allowing MQ even when the hardware doesn't have has several benefits:

  • It improves portability because code isn't going to break on devices that don't support MQ (assuming you're a developer that tests on an MQ system).
  • It allows developers on single-queue systems to write MQ code and know that it will pass validation.
  • It allows developer to have a single MQ code path and no single-queue fallback

@kainino0x kainino0x added the multi-queue Part of the multi-queue feature label Dec 16, 2020
@kainino0x
Copy link
Contributor

Closing stale PR; we will revisit this as a proposal when we get to looking back at the multi-queue label.

@kainino0x kainino0x closed this Aug 25, 2022
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
This PR adds unimplemented stubs for the `acos` builtin.

Issue: gpuweb#1212
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multi-queue Part of the multi-queue feature proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants