[PATCH] D101095: [clang][amdgpu] Use implicit code object version

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 22 11:23:49 PDT 2021


JonChesterfield created this revision.
JonChesterfield added reviewers: yaxunl, t-tye, kzhuravl, ronlieb, b-sumner, pdhaliwal.
Herald added subscribers: pengfei, tpr, dstuttard.
JonChesterfield requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, wdng.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

[clang][amdgpu] Use implicit code object version

At present, clang always passes amdhsa-code-object-version on to -cc1. That is
great for certainty over what object version is being used when debugging.

Unfortunately, the command line argument is in AMDGPUBaseInfo.cpp in the amdgpu
target. If clang is used with an llvm compiled with DLLVM_TARGETS_TO_BUILD
that excludes amdgpu, this will be diagnosed (as discovered via D98658 <https://reviews.llvm.org/D98658>):

- Unknown command line argument '--amdhsa-code-object-version=4'

This means that clang, built only for X86, can be used to compile the nvptx
devicertl for openmp but not the amdgpu one. That would shortly spawn fragile
logic in the devicertl cmake to try to guess whether the clang used will work.

This change omits the amdhsa-code-object-version parameter when it matches the
default that AMDGPUBaseInfo.cpp specifies, with a comment to indicate why. As
this is the only part of clang's codegen for amdgpu that depends on the target
in the back end it suffices to build the openmp runtime on most (all?) systems.

It is a non-functional change, though observable in the updated tests and when
compiling with -###. It may cause minor disruption to the amd-stg-open branch.

Revision of D98746 <https://reviews.llvm.org/D98746>, builds on refactor in D101077 <https://reviews.llvm.org/D101077>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101095

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/test/Driver/hip-autolink.hip
  clang/test/Driver/hip-code-object-version.hip
  clang/test/Driver/hip-device-compile.hip
  clang/test/Driver/hip-host-cpu-features.hip
  clang/test/Driver/hip-rdc-device-only.hip
  clang/test/Driver/hip-target-id.hip
  clang/test/Driver/hip-toolchain-mllvm.hip
  clang/test/Driver/hip-toolchain-no-rdc.hip
  clang/test/Driver/hip-toolchain-opt.hip
  clang/test/Driver/hip-toolchain-rdc-separate.hip
  clang/test/Driver/hip-toolchain-rdc-static-lib.hip
  clang/test/Driver/hip-toolchain-rdc.hip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101095.339735.patch
Type: text/x-patch
Size: 25088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210422/9d7cfb35/attachment-0001.bin>


More information about the cfe-commits mailing list