-
Notifications
You must be signed in to change notification settings - Fork 6k
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] reland: switch Pipeline to use raw ptr instead of shared ptr for recorded references. #57086
Conversation
Remove FML_CHECK on == so we can make comparison to nullptr.
…to raw_ptr_pipeline
impeller/entity/entity_unittests.cc
Outdated
@@ -1751,6 +1753,7 @@ TEST_P(EntityTest, RuntimeEffect) { | |||
|
|||
ASSERT_TRUE(runtime_stage->IsDirty()); | |||
expect_dirty = true; | |||
first_pipeline = PipelineRef{nullptr}; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
impeller/entity/entity_unittests.cc
Outdated
@@ -1751,6 +1753,7 @@ TEST_P(EntityTest, RuntimeEffect) { | |||
|
|||
ASSERT_TRUE(runtime_stage->IsDirty()); | |||
expect_dirty = true; | |||
first_pipeline = PipelineRef{nullptr}; |
There was a problem hiding this comment.
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.
impeller/entity/entity_unittests.cc
Outdated
@@ -1724,13 +1724,9 @@ TEST_P(EntityTest, RuntimeEffect) { | |||
entity.SetContents(contents); | |||
bool result = contents->Render(context, entity, pass); | |||
|
|||
if (expect_dirty) { | |||
EXPECT_NE(first_pipeline, pass.GetCommands().back().pipeline); | |||
first_pipeline = pass.GetCommands().back().pipeline; |
There was a problem hiding this comment.
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.
…f shared ptr for recorded references. (flutter/engine#57086)
…f shared ptr for recorded references. (flutter/engine#57086)
…160052) flutter/engine@23fc43d...3a641b6 2024-12-10 [email protected] Clean up key embedder responder tests (flutter/engine#57054) 2024-12-10 [email protected] [Impeller] reland: switch Pipeline to use raw ptr instead of shared ptr for recorded references. (flutter/engine#57086) 2024-12-10 [email protected] 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 [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
Prev: #57015
There is a unit test that is clearing out the pipeline storage, manually null out captured PipelineRef.