[all-commits] [llvm/llvm-project] fc88d9: [clang][amdgpu] Use implicit code object version

Jon Chesterfield via All-commits all-commits at lists.llvm.org
Fri Apr 23 15:53:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fc88d927e30de93bf75aef8cd2a835675fe904bc
      https://github.com/llvm/llvm-project/commit/fc88d927e30de93bf75aef8cd2a835675fe904bc
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2021-04-23 (Fri, 23 Apr 2021)

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

  Log Message:
  -----------
  [clang][amdgpu] Use implicit code object version

[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):

- 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, builds on refactor in D101077

Reviewed By: yaxunl

Differential Revision: https://reviews.llvm.org/D101095




More information about the All-commits mailing list