Skip to content

Conversation

@amanasifkhalid
Copy link
Contributor

Follow-up to #111365. Instead of allocating a separate ordinal array, track each block's ordinal by overwriting its bbPostorderNum. We can check if a given block is in the candidate set of blocks being reordered if its ordinal is less than the number of hot blocks, and if the block at the given ordinal in blockOrder matches the block in question (i.e. the same implementation as FlowGraphDfsTree::Contains.

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 15, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@amanasifkhalid
Copy link
Contributor Author

cc @dotnet/jit-contrib, @AndyAyersMS PTAL. No diffs. Thanks!

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Should we take precautions so that nobody looks at these numbers later hoping they make sense?

Probably invalidating the DFS tree is sufficient, if we're not already doing that?

@amanasifkhalid
Copy link
Contributor Author

Probably invalidating the DFS tree is sufficient, if we're not already doing that?

We already invalidate the DFS tree after running 3-opt, though I suppose I could move that earlier (i.e. right after we set the initial ordinal numbers before reordering) to be safe?

@AndyAyersMS
Copy link
Member

Probably invalidating the DFS tree is sufficient, if we're not already doing that?

We already invalidate the DFS tree after running 3-opt, though I suppose I could move that earlier (i.e. right after we set the initial ordinal numbers before reordering) to be safe?

Afterwards is fine.

@jakobbotsch
Copy link
Member

jakobbotsch commented Jan 16, 2025

Note that the post phase check in fgDebugCheckFlowGraphAnnotations already validates that the postorder numbers are correct if the DFS tree is set, so it shouldn't be possible to leave it stale.

@amanasifkhalid amanasifkhalid merged commit 73a9330 into dotnet:main Jan 16, 2025
109 checks passed
@amanasifkhalid amanasifkhalid deleted the 3-opt-ordinals branch January 16, 2025 14:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 16, 2025
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.

3 participants