Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented May 15, 2023

Compute shader implementation of #41803

I found this to be generally more straightforward, and we can revisit the vertex shader approach with GLES.

Benchmark is pending here: flutter/flutter#126728

Note: rendering behavior is identical even though this is now a single draw call. This is becuase strokes have overdraw prevention enabled by default, while this new contents does not

image

layout(local_size_x = 16) in;

layout(std430) readonly buffer PointData {
vec2 points[];
Copy link
Contributor

Choose a reason for hiding this comment

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

You should include a uint count here to guard against OOB access.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see, you put it as a uniform.

Copy link
Contributor

Choose a reason for hiding this comment

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

(Consider adding a comment that the count for this is in the uniform)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

point_data;

layout(std430) writeonly buffer GeometryData {
vec2 geometry[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably want a count here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment

Comment on lines 33 to 34
// TODO(dnfield): https://github.com/flutter/flutter/issues/112683
// We should be able to use length here instead of an extra arrgument.
Copy link
Contributor

Choose a reason for hiding this comment

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

I kind of doubt this will ever get fixed, we should probably just remove these.

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 can actually ifdef/function constant these out based on a runtime flag if the device supports non-uniform threadgroup sizing.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

Neat! Mostly nits

@jonahwilliams jonahwilliams requested a review from dnfield May 18, 2023 22:11
@jonahwilliams
Copy link
Contributor Author

I found a problem with how dispatch was being done. We were setting the threadGroup size as if it were the threadsize, which resulted in us doing way more work than necessary. I've now fixed this for one dimension, so that the thread group size is correctly computed as the units of work / maxThreadgroupSize. This is still broken for 2D. fyi @dnfield

@jonahwilliams jonahwilliams changed the title [Impeller] Implement drawPoint geometry computation with compute, fallback to specialized CPU. [Impeller] Fix 1d threadgroup dispatch size, Implement drawPoint geometry computation with compute, fallback to specialized CPU. May 19, 2023

// For now, check that the sizes are uniform.
FML_DCHECK(grid_size == thread_group_size);
// FML_DCHECK(grid_size == thread_group_size);
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 think we should rethink this API. What would make sense to me is 1. specifying the units of work in a grid size.

Maybe there are cases where we need to control threadgroup size? not sure

@jonahwilliams jonahwilliams requested a review from dnfield May 19, 2023 15:28
}

auto size = MTLSizeMake(width, height, 1);
[encoder dispatchThreadgroups:size threadsPerThreadgroup:size];
Copy link
Contributor

Choose a reason for hiding this comment

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

This is ok but we should really fix this in a separate PR

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label May 19, 2023
@auto-submit auto-submit bot merged commit 0166141 into flutter:main May 19, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 19, 2023
…Point geometry computation with compute, fallback to specialized CPU. (flutter/engine#42060)
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 19, 2023
…127224)

flutter/engine@2b14f8a...3267fa2

2023-05-19 [email protected] [Impeller] Limit blur kernel to 1000x1000 pixels (flutter/engine#42154)
2023-05-19 [email protected] Roll Fuchsia Mac SDK from IGeTvUK2wkajmQQ2k... to pwdDQgM88sqLmZczj... (flutter/engine#42163)
2023-05-19 [email protected] Roll Skia from 0a63dbe8cd15 to 7202b405f061 (1 revision) (flutter/engine#42162)
2023-05-19 [email protected] [Impeller] Fix 1d threadgroup dispatch size, Implement drawPoint geometry computation with compute, fallback to specialized CPU. (flutter/engine#42060)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from IGeTvUK2wkaj to pwdDQgM88sqL

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 [email protected],[email protected] 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
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request May 24, 2023
…lutter#127224)

flutter/engine@2b14f8a...3267fa2

2023-05-19 [email protected] [Impeller] Limit blur kernel to 1000x1000 pixels (flutter/engine#42154)
2023-05-19 [email protected] Roll Fuchsia Mac SDK from IGeTvUK2wkajmQQ2k... to pwdDQgM88sqLmZczj... (flutter/engine#42163)
2023-05-19 [email protected] Roll Skia from 0a63dbe8cd15 to 7202b405f061 (1 revision) (flutter/engine#42162)
2023-05-19 [email protected] [Impeller] Fix 1d threadgroup dispatch size, Implement drawPoint geometry computation with compute, fallback to specialized CPU. (flutter/engine#42060)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from IGeTvUK2wkaj to pwdDQgM88sqL

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 [email protected],[email protected] 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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants