This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Create AMDGPUModuleInfo
AbandonedPublic

Authored by rampitec on Mar 9 2021, 4:25 PM.

Details

Reviewers
arsenm
kzhuravl
Summary

Replace AMDGPUMachineModuleInfo to have per-module
information available before MF is created.

Diff Detail

Event Timeline

rampitec created this revision.Mar 9 2021, 4:25 PM
rampitec requested review of this revision.Mar 9 2021, 4:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2021, 4:25 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added inline comments.Mar 10 2021, 4:24 PM
llvm/lib/Target/AMDGPU/AMDGPUModuleInfo.cpp
58

Why does this need to store a module? The context may be used by multiple modules. It shouldn't matter since this just needs the context IDs

rampitec added inline comments.Mar 10 2021, 4:32 PM
llvm/lib/Target/AMDGPU/AMDGPUModuleInfo.cpp
58

It could remember context, but since it is named ModuleInfo I am keeping track of a module. Probably it can be renamed as AMDGPUContextInfo and track the context.

arsenm added inline comments.Mar 10 2021, 4:52 PM
llvm/lib/Target/AMDGPU/AMDGPUModuleInfo.cpp
58

It's not tracking anything about the module either. It's purely a context extension

rampitec added inline comments.Mar 10 2021, 4:56 PM
llvm/lib/Target/AMDGPU/AMDGPUModuleInfo.cpp
58

At least not so far. I will rename it tomorrow and will track the context. It will have to stay a module pass though, but I guess it is cheap. I will just have to check context didn't change before I reset it.

Ugh, that's the problem: I cannot tell if a context is the same as an old one. I can tell it for module as I can create a module pass. Every time module changes I can reset the context. I cannot create a context pass though.

Now I cannot compare context address as well since the same memory can be reused. This is exactly the same problem as with a module, its address can be the same, but the module different. I.e. there is no reliable way to identify a module, but there is a module pass, and there is no reliable way to identify a context, but there are no context passes.

Effectively even though this is a context extension I need to reset it for every new module. Well, unless you tell me there is a way to reliably identify a context.

Is there any guarantee that a pointer to LLVMContext remains valid through the whole TM life time?

rampitec updated this revision to Diff 330365.Mar 12 2021, 1:51 PM

Updated to use it from lowering.

rampitec abandoned this revision.Apr 15 2021, 2:32 PM