Skip to content

JIT: initial workup for suppressing dumps and checks post-phase#33305

Merged
AndyAyersMS merged 6 commits intodotnet:masterfrom
AndyAyersMS:PhaseActionsReturnFlags
Mar 30, 2020
Merged

JIT: initial workup for suppressing dumps and checks post-phase#33305
AndyAyersMS merged 6 commits intodotnet:masterfrom
AndyAyersMS:PhaseActionsReturnFlags

Conversation

@AndyAyersMS
Copy link
Member

Allow phases to declare what parts of jit state they might have modified,
and suppress dumps and checks based on these declarations.

Existing phases that don't know about this are handled by defaulting to
reporting that everything might have beem nodified.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 6, 2020
@AndyAyersMS
Copy link
Member Author

@dotnet/jit-contrib curious what you think of this approach. If it looks reasonable I will propagate to more phases.

Might be overkill to return fine-grained PhaseStatus; it could just be a bool.

@AndyAyersMS
Copy link
Member Author

@dotnet/jit-contrib any thoughts on this proposed change to phases?

Copy link
Contributor

@sandreenko sandreenko left a comment

Choose a reason for hiding this comment

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

I like the idea in general, I am not sure how much will it affect log sizes and checked TP.
Probably nobody is scrolling through the whole JitDump, but if you are looking for a specific tree and you will get twice less occurrences it will speed up the process significantly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: enum class should not need a class prefix, because they can't be used without className.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, it is annoying to repeat this.

Copy link
Contributor

@CarolEidt CarolEidt left a comment

Choose a reason for hiding this comment

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

Looks like a good approach to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy/paste error?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Any idea what checking such an "other" category might want to trigger?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure? Seems like a good part of the compiler object state probably can't be checked effectively. But maybe there are some things we can come up with.

Copy link
Contributor

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

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

LGTM.

Seems semi-dangerous to trust phases to report what changed and then not check. Seems ok to not dump in that case.

Allow phases to declare what parts of jit state they might have modified,
and suppress dumps and checks based on these declarations.

Existing phases that don't know about this are handled by defaulting to
reporting that everything might have beem nodified.

Changed over all explicit phases to return status, as well as a handful
of phases that are methods on the Compiler object. Also converted a few
lambda phases into Compiler phase methods.
@AndyAyersMS AndyAyersMS force-pushed the PhaseActionsReturnFlags branch from f90713e to 277f289 Compare March 25, 2020 17:40
@AndyAyersMS
Copy link
Member Author

Need to merge in latest...

@AndyAyersMS AndyAyersMS marked this pull request as ready for review March 25, 2020 23:51
@AndyAyersMS
Copy link
Member Author

Moving out of draft status.

@dotnet/jit-contrib any other thoughts?

Copy link
Contributor

@CarolEidt CarolEidt left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -24151,16 +24180,18 @@ void Compiler::fgRemoveEmptyFinally()
printf("\n");
}

Copy link
Contributor

Choose a reason for hiding this comment

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

GitHub bug: All the real changes are not shown

const bool madeChanges = (status != PhaseStatus::MODIFIED_NOTHING);
const char* const statusMessage = madeChanges ? "" : " [no changes]";
bool doPostPhase = false;

Copy link
Contributor

Choose a reason for hiding this comment

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

As a additional check if a phase reports MODIFIED_NOTHING, we could assert that no new Nodes were created.

assert(madeChanges || (compGenTreeID == s_previousValue));

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I'll implement this, and also check that some other easy to verify things are unchanged.

Copy link
Contributor

@briansull briansull left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks

@AndyAyersMS AndyAyersMS changed the title JIT: draft workup for suppressing dumps and checks post-phase JIT: initial workup for suppressing dumps and checks post-phase Mar 30, 2020
@AndyAyersMS
Copy link
Member Author

Am going to ignore the OSX libraries test failure, suspect this is when we briefly lost connectivity to the test machines.

@AndyAyersMS AndyAyersMS merged commit 6de9884 into dotnet:master Mar 30, 2020
@AndyAyersMS AndyAyersMS deleted the PhaseActionsReturnFlags branch March 30, 2020 17:24
@AndyAyersMS
Copy link
Member Author

Part of #2109.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants