Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] Compute in Vulkan #42294

Merged
merged 17 commits into from Jun 1, 2023
Merged

[Impeller] Compute in Vulkan #42294

merged 17 commits into from Jun 1, 2023

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented May 24, 2023

Fixes flutter/flutter#110622

  • Updates capabilities checks for support
  • Fixes a bug where SSBOs were being treated as UBOs in render (and does the same work in compute).
  • Fixes CommandEncoderVK::Submit so that it takes a completion callback and CommandBufferVK uses it to avoid sending a kComplete status to callers when it should really be kPending.

@@ -330,12 +343,14 @@ bool CapabilitiesVK::SupportsFramebufferFetch() const {

// |Capabilities|
bool CapabilitiesVK::SupportsCompute() const {
return false;
// Vulkan 1.1 requires support for compute.
Copy link
Member

Choose a reason for hiding this comment

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

oh, this will work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not wired up yet. But capabilities wise it is supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

More specifically,

needs to get implemented for this to work in impeller, but the device will support it even though Impeller doesn't.

Copy link
Member

Choose a reason for hiding this comment

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

I think we'll start crashing on drawPoints on Vulkan if this returns true before its completely ready?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, yes. I'm not sure how big of a deal that is. I could make this patch still return false here but true on supports subgroups for now...?

Copy link
Member

Choose a reason for hiding this comment

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

sg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(We'll hit a codepath that ends up doing an IMPELLER_UNIMPLEMENTED which will abort)

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM with question

@dnfield
Copy link
Contributor Author

dnfield commented May 25, 2023

I'm going to hold off on landing this until I either get a sense of how long it'll take to fix the comptue implementation on Vulkan or I set the return value to false for now

@chinmaygarde chinmaygarde added the Work in progress (WIP) Not ready (yet) for review! label May 25, 2023
@dnfield dnfield changed the title [Impeller] Feature detection for subgroup support in Vulkan [Impeller] Compute in Vulkan Jun 1, 2023
@@ -31,7 +31,10 @@ void main() {
value = input_data.data[ident];
}

memory[ident] = value;
if (ident < BLOCK_SIZE) {
Copy link
Member

Choose a reason for hiding this comment

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

Technically we need to use a function constant sizing of the memory size so that it exactly corresponds to the threadgroup size.

@dnfield dnfield added autosubmit Merge PR when tree becomes green via auto submit App and removed Work in progress (WIP) Not ready (yet) for review! labels Jun 1, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 1, 2023

auto label is removed for flutter/engine, pr: 42294, due to - The status or check suite Linux linux_license has failed. Please fix the issues identified (or deflake) before re-applying this label.

}
return submit;
return encoder_->Submit([callback](bool submit) {
if (!submit) {
Copy link
Member

Choose a reason for hiding this comment

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

You missed the early return after the callback invocation on error. Thats why I prefer this stylistically too (and its drier).

callback(submitted ? kCompleted : kError);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That doesn't work - it fires the callback too early.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh NVM I see.

bool CommandEncoderVK::Submit() {
bool CommandEncoderVK::Submit(SubmitCallback callback) {
// Make sure to call callback with `false` if anything returns early.
bool fail_callback = !!callback;
Copy link
Member

Choose a reason for hiding this comment

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

Prefer a ScopedCleanupClosure that returns false by default. On the one success case, release the closure and invoke it with true once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's being done below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fail_callback is used in the ScopedCleanupClosure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I think I see what you mean.

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 thought there was some way to make this a little clearer with a second fml::ScopedCleanupClosure but I'm missing it. Maybe we can sync up offline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Argh, nevermind again, I misread this and now I understand what you're saying :)

@chinmaygarde
Copy link
Member

Sorry, just noticed an error on a second pass. Also some nits but those are not blockers.

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 1, 2023

auto label is removed for flutter/engine, pr: 42294, due to - The status or check suite Mac mac_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

  • The status or check suite Linux Android clang-tidy has failed. Please fix the issues identified (or deflake) before re-applying this label.

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 1, 2023

auto label is removed for flutter/engine, pr: 42294, due to - The status or check suite Linux Host clang-tidy has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@auto-submit auto-submit bot merged commit b8ef52a into flutter:main Jun 1, 2023
29 checks passed
@dnfield dnfield deleted the vk_compute branch June 2, 2023 05:59
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 2, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 2, 2023
…128119)

flutter/engine@02d6fbb...c6e9383

2023-06-02 jason-simmons@users.noreply.github.com [Impeller] clang-tidy fixes (flutter/engine#42503)
2023-06-02 103135467+sealesj@users.noreply.github.com Allow for optional label to trigger vuln scan on patch PRs (flutter/engine#42494)
2023-06-02 skia-flutter-autoroll@skia.org Roll Skia from 881a8df6f9e9 to 47b0db43f6a4 (1 revision) (flutter/engine#42512)
2023-06-02 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from X4Pkixxtt3BkjRW9P... to PuYA-6NVHeHPlkCdk... (flutter/engine#42511)
2023-06-02 skia-flutter-autoroll@skia.org Roll Skia from 7777ee2bf7ef to 881a8df6f9e9 (1 revision) (flutter/engine#42510)
2023-06-02 skia-flutter-autoroll@skia.org Roll Dart SDK from 3d4d29d8f16b to 9d8df2a5210b (2 revisions) (flutter/engine#42509)
2023-06-02 skia-flutter-autoroll@skia.org Roll Skia from 02e706e9761b to 7777ee2bf7ef (2 revisions) (flutter/engine#42508)
2023-06-02 skia-flutter-autoroll@skia.org Roll Skia from 0c75f1877b37 to 02e706e9761b (2 revisions) (flutter/engine#42506)
2023-06-02 dkwingsmt@users.noreply.github.com Revert "[Rasterizer] Make resubmit information temporary" (flutter/engine#42455)
2023-06-02 skia-flutter-autoroll@skia.org Roll Skia from f4854a3d009d to 0c75f1877b37 (1 revision) (flutter/engine#42505)
2023-06-02 skia-flutter-autoroll@skia.org Roll Dart SDK from 0d3c310fd6d9 to 3d4d29d8f16b (3 revisions) (flutter/engine#42502)
2023-06-02 skia-flutter-autoroll@skia.org Roll Skia from 082a7d1f72f7 to f4854a3d009d (4 revisions) (flutter/engine#42500)
2023-06-01 godofredoc@google.com Do not retry lint or clang tidy tests. (flutter/engine#42498)
2023-06-01 dnfield@google.com [Impeller] Compute in Vulkan (flutter/engine#42294)
2023-06-01 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from yqJfBsLdfLP4_vbFu... to JQRQ1nH1ILNA--N_b... (flutter/engine#42499)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from X4Pkixxtt3Bk to PuYA-6NVHeHP
  fuchsia/sdk/core/mac-amd64 from yqJfBsLdfLP4 to JQRQ1nH1ILNA

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jonahwilliams@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Archived in project
3 participants