Page MenuHomePhabricator

[HIP][AMDGPU] Enable structurizer workarounds

Authored by sameerds on Apr 27 2020, 12:08 AM.



The StrucurizeCFG pass has two known limitations that are addressed by
the FixIrreducible pass and the UnifyLoopExits pass. These passes are
invoked by the AMDGPU backend, but currently hidden behind a
command-line option which is disabled by default.

This change enables the workaround when compiling a HIP program. The
option can now be specified multiple times. The user can thus
override the HIP default using:

clang -mllvm --amdgpu-enable-structurizer-workarounds=false

The HIP toolchain passes all "-mllvm" options to both opt and
llc. But this particular option has no effect on the opt invocation
since it is only used by the AMDGPU target during code generation.

Diff Detail

Event Timeline

sameerds created this revision.Apr 27 2020, 12:08 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 27 2020, 12:08 AM
arsenm added inline comments.Apr 27 2020, 2:07 PM

We should just flip this in the backend. llc flags are not intended for frontends to set options

sameerds added inline comments.Apr 27 2020, 8:17 PM

Admittedly, this is a broken workflow. I am not even sure if Clang should be invoking llc at all. Ideally, we would want to eliminate this flag entirely. But flipping it is okay too if graphics workloads are sensitive to it. The priority right now is to enable the workarounds officially only for HIP and this seems to be most concise way to do it. We can flip the flag once other users of the AMDGPU are on board.

sameerds marked an inline comment as done.May 10 2020, 9:54 PM
sameerds added inline comments.

To clarify, we can flip it in the backend if graphcis workloads are not sensitive to it. But HIP needs this earlier.

sameerds abandoned this revision.Jun 4 2020, 7:25 PM

Abandoned in favour of enabling the workarounds in the AMDGPU backend: