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

Conversation

@jonahwilliams
Copy link
Contributor

Prev: #57015

There is a unit test that is clearing out the pipeline storage, manually null out captured PipelineRef.

@jonahwilliams jonahwilliams marked this pull request as ready for review December 10, 2024 15:33

ASSERT_TRUE(runtime_stage->IsDirty());
expect_dirty = true;
first_pipeline = PipelineRef{nullptr};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing this test to null out the pipeline. The test is clearing out the shader cache which invalidates this ptr.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this is the right fix. The reason being that the failure was Expected: (first_pipeline) != (pass.GetCommands().back().pipeline). It's an assertion that doesn't even look into the validity of the pointer, it just performs a computation on the address. Were you able to validate locally this removed the failure?

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'm not sure exactly what happens here. Right now we're holding onto a raw_ptr. The structure that keeps the shared_ptr alive is being cleared out. So that raw_ptr is no longer valid.

I don't know why they do match but only sometimes.

Copy link
Member

Choose a reason for hiding this comment

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

I'm wary of changing this test to fix the failure. I'm afraid we may be masking a bug. My intuition on this assertion is that the render pass's commands should point to a different pipeline if the runtime stage has been updated. That makes sense. This change just removes that assertion by just asserting that the pipeline is not null. So this probably removes the flakiness but not the bug it's demonstrating.

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 don't really think that this is a meaningful assertion

Copy link
Member

Choose a reason for hiding this comment

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

Chatted offline: The most likely reason that sometimes this fails is that we get (un)lucky and we're creating a new pipeline that has the same address. Jonah's right that this is not a good assertion. I'd say that usually not equals assertions are kind of trash anyways. We should have some sort of positive assertion about the rebuild having happened.

Copy link
Member

Choose a reason for hiding this comment

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

I can't come up with a better alternative to this assert. This is fine for me. Although I think it's better to just delete that EXPECT_NE or replace it with EXPECT_NE(nullptr, pass.GetCommands().back().pipeline.get()); instead of fiddling with state.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

Glad we came up with a probable explanation, thanks.


ASSERT_TRUE(runtime_stage->IsDirty());
expect_dirty = true;
first_pipeline = PipelineRef{nullptr};
Copy link
Member

Choose a reason for hiding this comment

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

I can't come up with a better alternative to this assert. This is fine for me. Although I think it's better to just delete that EXPECT_NE or replace it with EXPECT_NE(nullptr, pass.GetCommands().back().pipeline.get()); instead of fiddling with state.


if (expect_dirty) {
EXPECT_NE(first_pipeline, pass.GetCommands().back().pipeline);
first_pipeline = pass.GetCommands().back().pipeline;
Copy link
Member

Choose a reason for hiding this comment

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

You're going to still want this so the else condition passes. I'd remove that resetting of first_pipeline you added too.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 10, 2024
@auto-submit auto-submit bot merged commit bfda83b into flutter:main Dec 10, 2024
33 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 10, 2024
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Dec 11, 2024
flutter/engine@23fc43d...3a641b6

2024-12-10 robert.ancell@canonical.com Clean up key embedder responder
tests (flutter/engine#57054)
2024-12-10 jonahwilliams@google.com [Impeller] reland: switch Pipeline
to use raw ptr instead of shared ptr for recorded references.
(flutter/engine#57086)
2024-12-10 skia-flutter-autoroll@skia.org Roll Skia from bd7d952398d5 to
d541f1aa0c9b (3 revisions) (flutter/engine#57098)

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,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://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
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
…tr for recorded references. (flutter/engine#57086)

Prev: flutter/engine#57015

There is a unit test that is clearing out the pipeline storage, manually null out captured PipelineRef.
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.

2 participants