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

[Impeller] dont use half precision constants / Fixes for SPIRV tools roll #52213

Merged
merged 3 commits into from
Apr 18, 2024

Conversation

jonahwilliams
Copy link
Member

See b/335381180

In an upcoming version of SPIRV tools, these constants are being flagged as invalid. Due to some combination of the macros + inlining we're ending up with multiple precision modifiers on the constants:

third_party/flutter_engine/impeller/entity/shaders/radial_gradient_fill.frag: GLSL to SPIRV failed; Compilation error. 0 error(s) and 1 warning(s).
third_party/flutter_engine/impeller/entity/shaders/radial_gradient_fill.frag:14: warning: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
third_party/flutter_engine/impeller/entity/shaders/radial_gradient_fill.frag:          "precision mediump int; precision highp float;" 
shaderc: internal error: compilation succeeded but failed to optimize: ID '112' decorated with RelaxedPrecision multiple times is not allowed.
  %float_n0_474999994 = OpConstant %float -0.474999994

We don't really benefit from half precision on these, since we're either using them for equality or can cheaply convert to half precision anyway.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@@ -12,15 +12,15 @@ layout(constant_id = 0) const float supports_decal = 1.0;

// These values must correspond to the order of the items in the
// 'FilterContents::MorphType' enum class.
const float16_t kMorphTypeDilate = 0.0hf;
const float16_t kMorphTypeErode = 1.0hf;
const float kMorphTypeDilate = 0.0;
Copy link
Member

Choose a reason for hiding this comment

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

Even with these changes, the duplicate constant error is still showing up:

shaderc: internal error: compilation succeeded but failed to optimize: ID '27' decorated with RelaxedPrecision multiple times is not allowed.
  %float_0 = OpConstant %float 0

Also, similar changes are needed to:

const float16_t kBT601LimitedRange = 0.0hf;
const float16_t kBT601FullRange = 1.0hf;

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. Sorry, do you mean that even with this change there are still compilation errors?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that's what I meant. The compiler doesn't like 0 and 1 as constants for this file and yuv_to_rgb_filter.frag.

Copy link
Member

Choose a reason for hiding this comment

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

The latest commit 80579dd fixes the issue 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

woot, thanks for helping with this @jiahaog

@jonahwilliams jonahwilliams changed the title [Impeller] dont use half precision constants. [Impeller] dont use half precision constants / Fixes for SPIRV tools roll Apr 18, 2024
@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 18, 2024
@auto-submit auto-submit bot merged commit 442d14a into flutter:main Apr 18, 2024
29 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 19, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 19, 2024
…147023)

flutter/engine@6e4a15d...442d14a

2024-04-18 [email protected] [Impeller] dont use half precision constants / Fixes for SPIRV tools roll (flutter/engine#52213)
2024-04-18 [email protected] Roll Skia from edece87ce734 to 8fd4d8eaadc2 (1 revision) (flutter/engine#52238)

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],[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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
…lutter#147023)

flutter/engine@6e4a15d...442d14a

2024-04-18 [email protected] [Impeller] dont use half precision constants / Fixes for SPIRV tools roll (flutter/engine#52213)
2024-04-18 [email protected] Roll Skia from edece87ce734 to 8fd4d8eaadc2 (1 revision) (flutter/engine#52238)

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],[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://issues.skia.org/issues/new?component=1389291&template=1850622

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants