This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Support -mcpu=native for OpenCL
ClosedPublic

Authored by yaxunl on Jul 5 2023, 10:47 AM.

Details

Summary

When -mcpu=native is specified, try detecting GPU
on the system by using amdgpu-arch tool. If it
fails to detect GPU, emit an error about GPU
not detected. If multiple GPUs are detected,
use the first GPU and emit a warning.

Diff Detail

Event Timeline

yaxunl created this revision.Jul 5 2023, 10:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2023, 10:47 AM
yaxunl requested review of this revision.Jul 5 2023, 10:47 AM

Seems reasonable. I assume that there isn't a way to add a portable test.

arsenm added inline comments.Jul 5 2023, 3:39 PM
clang/include/clang/Basic/DiagnosticDriverKinds.td
86

s/architecture/architectures/

Maybe should stick to the "device" terminology opencl uses

yaxunl added a comment.Jul 5 2023, 8:47 PM

Seems reasonable. I assume that there isn't a way to add a portable test.

Right. It is difficult to test it with lit tests, but we will test it with internal CI.

yaxunl marked an inline comment as done.Jul 5 2023, 9:04 PM
yaxunl added inline comments.
clang/include/clang/Basic/DiagnosticDriverKinds.td
86

multiple devices is ambiguous since it could mean multiple devices of the same GPU architecture. multiple architectures is not ambiguous.

yaxunl updated this revision to Diff 537575.Jul 5 2023, 9:06 PM
yaxunl marked an inline comment as done.

revised by comments

arsenm accepted this revision.Jul 13 2023, 6:17 AM
This revision is now accepted and ready to land.Jul 13 2023, 6:17 AM
This revision was landed with ongoing or failed builds.Jul 13 2023, 1:22 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 1:22 PM
Herald added a subscriber: ldrumm. · View Herald Transcript