This is an archive of the discontinued LLVM Phabricator instance.

[NFC][AMDGPU] Document the AMDGPU target feature defaults
ClosedPublic

Authored by t-tye on Feb 26 2021, 4:42 PM.

Details

Summary

Document the default for the XNACK and SRAMECC target features for code object V2-V3 and V4.

Diff Detail

Event Timeline

t-tye created this revision.Feb 26 2021, 4:42 PM
t-tye requested review of this revision.Feb 26 2021, 4:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2021, 4:42 PM
This revision is now accepted and ready to land.Feb 27 2021, 10:14 AM
This revision was automatically updated to reflect the committed changes.
foad added a subscriber: foad.Mar 1 2021, 12:59 AM
foad added inline comments.
llvm/docs/AMDGPUUsage.rst
509–528

Isn't your third paragraph here just explaining that the first two are identical? I.e. "generate code that works with xnack replay enabled" and "generate code that works whether xnack replay is enabled or not" are the same thing.

t-tye added inline comments.Mar 1 2021, 12:54 PM
llvm/docs/AMDGPUUsage.rst
509–528

Code object v2/v3 does not support the concept of ANY and so the default has to be ether ON or OFF. The second paragraph specifies that ON is used.

Code object V4 has the concept of ANY and the third paragraph states that the default is ANY.

The fourth paragraph describes the consequences of these defaults.

foad added inline comments.Mar 1 2021, 1:49 PM
llvm/docs/AMDGPUUsage.rst
509–528

But ANY and ON are synonyms, aren't they? They both seem to tell the compiler to do exactly the same thing, so the default behaviour hasn't changed in any observable way.

t-tye added inline comments.Mar 1 2021, 5:24 PM
llvm/docs/AMDGPUUsage.rst
509–528

No they are not. Code object v2-v3 only supports ON and OFF. Code object supports ON, OFF, and ANY. ANY tells the loader that it is safe to load the code on a device configured with either ON or OFF. ON tells the loader it can only load onto a device with the feature ON.

It may be that the compiler generates the same code for ON and ANY but that is distinct from how the loader acts on them.

This is explained more in the TargetID section of the clang offload bundler.

foad added inline comments.Mar 2 2021, 3:05 AM
llvm/docs/AMDGPUUsage.rst
509–528

ANY tells the loader that it is safe to load the code on a device configured with either ON or OFF. ON tells the loader it can only load onto a device with the feature ON.

Thanks. But doesn't that contradict what you wrote: "Executing code that was generated with XNACK replay enabled [...] on a device that does not have XNACK replay enabled will execute correctly". What does it mean to say it "will execute correctly" if the loader would refuse to load it?

In any case, if the loader treats ANY and ON differently, then I think you should mention that here. Otherwise there is nothing to explain that ANY and ON are different, which makes changing the default from ON (v2/v3) to ANY (v4) sound rather pointless :-)

t-tye added inline comments.Mar 2 2021, 9:18 AM
llvm/docs/AMDGPUUsage.rst
509–528

ANY tells the loader that it is safe to load the code on a device configured with either ON or OFF. ON tells the loader it can only load onto a device with the feature ON.

Thanks. But doesn't that contradict what you wrote: "Executing code that was generated with XNACK replay enabled [...] on a device that does not have XNACK replay enabled will execute correctly". What does it mean to say it "will execute correctly" if the loader would refuse to load it?

It is not a contradiction. It explains that the code is the same, even though the loader does the enforcement described. Some users like to know this, and the original text said this so I left it here:-)

In any case, if the loader treats ANY and ON differently, then I think you should mention that here. Otherwise there is nothing to explain that ANY and ON are different, which makes changing the default from ON (v2/v3) to ANY (v4) sound rather pointless :-)

The documentation on ANY and ON appears in the following section on Target ID which links to the Clang Offload Bundler documentation.

tra added a subscriber: tra.May 10 2021, 2:28 PM
tra added inline comments.
llvm/docs/AMDGPUUsage.rst
484–485

@t-tye: What does it mean for the process to have SRAMECC (or XNACK) setting ?

The description of the target features implies that SRAMECC/XNACK are properties of the hardware, so I suspect it's a typo.
Is it supposed to be executed on a processor instead?

If the features are indeed something that's specific for particular GPU,
are there any tools/or docs which would tell me which particular set of features is needed for the GPU I have?
What determines the specific on/off values for the features? GPU's BIOS?

E.g. gfx908 lists sramecc and xnack as supported, but does not tell me which specific combination of them I need to use to build for a MI100 GPU.
For older GPUs, the fixed feature set described for object V2 provided useful list of the features, but it does not include newer GPUs.