This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Implement TargetTransformInfo canAlwaysSinkRead
AbandonedPublic

Authored by critson on Oct 3 2022, 4:06 AM.

Details

Summary

Allow sinking of invariant loads across critical edges during Sink
pass when amdgpu-aggressive-load-sinking attribute is set to true.
This should always be safe.
Typically it reduces VGPR pressure, but can increase SGPR pressure.

If amdgpu-always-sink-loads is *also* set true then allow sinking
of all loads.
The intention is that the frontend sets this after validating the
shader has no memory writes and no EXEC manipulation (e.g. kills).

Diff Detail

Event Timeline

critson created this revision.Oct 3 2022, 4:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 4:06 AM
critson requested review of this revision.Oct 3 2022, 4:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 4:06 AM
foad added inline comments.Oct 3 2022, 4:42 AM
llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
1231–1232

It seems wrong that we have to handle this here. There should be some other mechanism to prevent sinking in this case, otherwise we would have pre-existing bugs. For example InstCombine will sink loads if it is not moving them past any stores.