This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Introduce a flag to control enable/disable instruction sink pass
Needs ReviewPublic

Authored by cfang on Oct 8 2020, 10:03 PM.

Details

Summary

Instruction sink pass tries to sink instructions to the lowest possible point, with an effort
to bring instructions closer to their users. But it does not have heuristic regarding actual
benefit to do so. For example, when you sink an instruction, it may increase the live ranges
of it uses.
We have observe a greaterr than 10% performance benefit on some applications if we completely
turn off this pass. A flag to control this pass will allow us to tune the performance. It will also help us
isolate potential correctness issue that may be introduced from the llvm community.

Diff Detail

Event Timeline

cfang created this revision.Oct 8 2020, 10:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 8 2020, 10:03 PM
cfang requested review of this revision.Oct 8 2020, 10:03 PM
arsenm requested changes to this revision.Oct 9 2020, 12:27 PM

Just adding another flag isn't really fixing anything

This revision now requires changes to proceed.Oct 9 2020, 12:27 PM
cfang added a comment.Oct 9 2020, 12:33 PM

Just adding another flag isn't really fixing anything

Right, But we are providing a way to do performance tuning as well as triaging bugs.

I agree with Matt here. You should be able to do experiments locally. Perhaps sinking should be disabled entirely, or perhaps sinking should be improved to take register liveness into account.

I agree with Matt here. You should be able to do experiments locally. Perhaps sinking should be disabled entirely, or perhaps sinking should be improved to take register liveness into account.

Right, my point of view is that the Sink pass should be re-evaluated. Since it has been introduced into AMDGPU pipeline many years ago, there must have been unexpected dependencies
on this pass.

Local experiments are absolutely necessary, but not sufficient. I propose to introduce a flag which could enable a broad range of experiments (from CQE for example). And then we can make decisions:

  1. if it is mostly negative, we can disable it completely;
  2. if it is mostly positive, we can keep it as it is;
  3. if it it is in the middle, we can make effort to enhance it;

Why does this require a commit upstream?

Why does this require a commit upstream?

So everyone can use it. Also,
If my understand is correct, every optimization pass should have an associated flag to turn it on/off.

arsenm resigned from this revision.Sep 28 2022, 2:29 PM

Assuming this is irrelevant now

This revision now requires review to proceed.Sep 28 2022, 2:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2022, 2:29 PM