Skip to content

[CodeGen] Avoid MachineModuleInfo in MachineModuleSlotTracker #140530

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

optimisan
Copy link
Contributor

@optimisan optimisan commented May 19, 2025

In NPM, MMI is not used to store machine functions so we need to use the analysis manager here.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@optimisan optimisan changed the title Avoid MMI in MIRPrinter Avoid MachineModuleInfo in MIRPrinter May 19, 2025
@optimisan optimisan changed the title Avoid MachineModuleInfo in MIRPrinter [CodeGen] Avoid MachineModuleInfo in MIRPrinter May 19, 2025
@optimisan optimisan marked this pull request as ready for review May 19, 2025 11:17
@optimisan optimisan changed the title [CodeGen] Avoid MachineModuleInfo in MIRPrinter [CodeGen] Avoid MachineModuleInfo in MachineModuleSlotTracker May 19, 2025
@optimisan optimisan requested review from MatzeB and arsenm May 19, 2025 11:22
@arsenm
Copy link
Contributor

arsenm commented May 19, 2025

In NPM, MMI is not used to store machine functions so we need to use the analysis manager here.

This sounds broken. MachineModuleInfo is supposed to merely be the map from Function to MachineFunction. The NewPM (and other PM-less uses) should still use it

@optimisan
Copy link
Contributor Author

optimisan commented May 22, 2025

We moved from having a MF analysis (in legacy) to MMI to support Module passes in codegen pipeline.
In NPM we are moving back to MF analysis (in NPM) and this patch is to complete this.
I don't see any new developments in this area, so

In NPM, MMI is not used to store machine functions so we need to use the analysis manager here.

This sounds broken. MachineModuleInfo is supposed to merely be the map from Function to MachineFunction. The NewPM (and other PM-less uses) should still use it

is mostly contradicting #88610 (review): "Moving things out of MMI is good"

@optimisan optimisan requested a review from paperchalice May 22, 2025 06:31
@arsenm
Copy link
Contributor

arsenm commented May 22, 2025

#88610 (review)

At this point MachineModuleInfo is just about reduced to the minimal map of IR Function to MachineFunction, the extra state has been removed. MachineModuleAnalysis still just holds a reference to the owning MachineModuleInfo?

OS,
[&](const Function &F) {
return &FAM->getResult<MachineFunctionAnalysis>(
const_cast<Function &>(F))
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't need const_cast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants