This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Do not not force alwaysinline with calls and module LDS enabled
AcceptedPublic

Authored by arsenm on Jun 7 2023, 5:22 PM.

Details

Reviewers
JonChesterfield
scchan
rampitec
Pierre-vh
cdevadas
Group Reviewers
Restricted Project
Summary

Function calls are now well supported. We used to also need this for
dealing with LDS uses in functions, but now that should also work.
This also removes the stress calls option, which would require moving
the flag to the TargetMachine and I no longer think it's useful.

We should probably drop the amdgpu-function-calls too but I think
hipcc is still using it.

This trims the pass list nicely (I'm surprised this saved a dominator
and alias analysis run).

Diff Detail

Event Timeline

arsenm created this revision.Jun 7 2023, 5:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2023, 5:22 PM
arsenm requested review of this revision.Jun 7 2023, 5:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2023, 5:22 PM
Herald added a subscriber: wdng. · View Herald Transcript
scchan added a comment.Jun 8 2023, 9:20 AM

We should probably drop the amdgpu-function-calls too but I think
hipcc is still using it.

The amdgpu-function-calls switch is needed to disable function calls as a prereq to enable alwaysinline, which I don't understand why.

arsenm added a comment.Jun 8 2023, 9:48 AM

We should probably drop the amdgpu-function-calls too but I think
hipcc is still using it.

The amdgpu-function-calls switch is needed to disable function calls as a prereq to enable alwaysinline, which I don't understand why.

I'm failing to parse this sentence

foad added a comment.Jun 8 2023, 10:06 AM

Typo in description "not not"

We should probably drop the amdgpu-function-calls too but I think
hipcc is still using it.

The amdgpu-function-calls switch is needed to disable function calls as a prereq to enable alwaysinline, which I don't understand why.

I'm failing to parse this sentence

hipcc uses this switch because the enablement of alwaysinline requires that the function call support be turned off why do we have to turn off function call?

arsenm added a comment.Jun 8 2023, 4:27 PM

hipcc uses this switch because the enablement of alwaysinline requires that the function call support be turned off why do we have to turn off function call?

I'm still confused about what you're asking. Function calls are supposed to always be on, they can't actually be completely avoided. amdgpu-function-calls was for bringup of call support and should be retired. This maintains the flag for the force off usage hipcc was relying on, for now.

jmmartinez added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
977–983

Currently the inliner gives a boost to the inline-threshold for functions that take alloca instructions as arguments (ArgAllocaCost in AMDGPUTargetTransformInfo.cpp).

Should that inline bonus be removed too?

arsenm added inline comments.Jun 26 2023, 5:23 AM
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
977–983

Those would be unrelated. That's just regular inline heuristics, not related to hacking out a call to avoid codegen limitations

arsenm updated this revision to Diff 535462.Jun 28 2023, 10:33 AM
arsenm edited the summary of this revision. (Show Details)

Rebase

JonChesterfield accepted this revision.Jul 12 2023, 2:38 AM

LG here. Can we get rid of EnableFunctionCalls?

This revision is now accepted and ready to land.Jul 12 2023, 2:38 AM

LG here. Can we get rid of EnableFunctionCalls?

If we can get rid of hipcc which is still using it

LG here. Can we get rid of EnableFunctionCalls?

If we can get rid of hipcc which is still using it

hipcc only needs a way to force EarlyInlineAll but that pass is predicated by !EnableFunctionCalls. If we don't think it's warranted then we can deprecate EnableFunctionCalls by first removing it in hipcc.

llvm/test/CodeGen/AMDGPU/llc-pipeline.ll