Author: Jon Chesterfield Date: 2020-12-17T16:09:33Z New Revision: daf39e3f2dba18bd39cd89a1c91bae126a31d4fe
URL: https://github.com/llvm/llvm-project/commit/daf39e3f2dba18bd39cd89a1c91bae126a31d4fe DIFF: https://github.com/llvm/llvm-project/commit/daf39e3f2dba18bd39cd89a1c91bae126a31d4fe.diff LOG: [amdgpu] Default to code object v3 [amdgpu] Default to code object v3 v4 is not yet readily available, and doesn't appear to be implemented in the back end Reviewed By: t-tye, yaxunl Differential Revision: https://reviews.llvm.org/D93258 Added: Modified: clang/include/clang/Driver/Options.td clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/hip-code-object-version.hip llvm/docs/AMDGPUUsage.rst Removed: ################################################################################ diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index f384e0d993c2..07f15add28ec 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2909,7 +2909,7 @@ def mexec_model_EQ : Joined<["-"], "mexec-model=">, Group<m_wasm_Features_Driver HelpText<"Execution model (WebAssembly only)">; def mcode_object_version_EQ : Joined<["-"], "mcode-object-version=">, Group<m_Group>, - HelpText<"Specify code object ABI version. Defaults to 4. (AMDGPU only)">, + HelpText<"Specify code object ABI version. Defaults to 3. (AMDGPU only)">, MetaVarName<"<version>">, Values<"2,3,4">; def mcode_object_v3_legacy : Flag<["-"], "mcode-object-v3">, Group<m_Group>, diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 72bedc16846d..04d0e0771f70 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1549,7 +1549,7 @@ unsigned tools::getOrCheckAMDGPUCodeObjectVersion( const Driver &D, const llvm::opt::ArgList &Args, bool Diagnose) { const unsigned MinCodeObjVer = 2; const unsigned MaxCodeObjVer = 4; - unsigned CodeObjVer = 4; + unsigned CodeObjVer = 3; // Emit warnings for legacy options even if they are overridden. if (Diagnose) { diff --git a/clang/test/Driver/hip-code-object-version.hip b/clang/test/Driver/hip-code-object-version.hip index 51d9004b0cbf..6e4e96688593 100644 --- a/clang/test/Driver/hip-code-object-version.hip +++ b/clang/test/Driver/hip-code-object-version.hip @@ -53,7 +53,7 @@ // RUN: --offload-arch=gfx906 -nogpulib \ // RUN: %s 2>&1 | FileCheck -check-prefix=VD %s -// VD: "-mllvm" "--amdhsa-code-object-version=4" +// VD: "-mllvm" "--amdhsa-code-object-version=3" // VD: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx906" // Check invalid code object version option. diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst index 6d3fa7021a7a..c8dda47352ab 100644 --- a/llvm/docs/AMDGPUUsage.rst +++ b/llvm/docs/AMDGPUUsage.rst @@ -911,12 +911,12 @@ The AMDGPU backend uses the following ELF header: * ``ELFABIVERSION_AMDGPU_HSA_V3`` is used to specify the version of AMD HSA runtime ABI for code object V3. Specify using the Clang option - ``-mcode-object-version=3``. + ``-mcode-object-version=3``. This is the default code object + version if not specified. * ``ELFABIVERSION_AMDGPU_HSA_V4`` is used to specify the version of AMD HSA runtime ABI for code object V4. Specify using the Clang option - ``-mcode-object-version=4``. This is the default code object - version if not specified. + ``-mcode-object-version=4``. * ``ELFABIVERSION_AMDGPU_PAL`` is used to specify the version of AMD PAL runtime ABI. @@ -2871,10 +2871,6 @@ non-AMD key names should be prefixed by "*vendor-name*.". Code Object V3 Metadata +++++++++++++++++++++++ -.. warning:: - Code object V3 is not the default code object version emitted by this version - of LLVM. - Code object V3 to V4 metadata is specified by the ``NT_AMDGPU_METADATA`` note record (see :ref:`amdgpu-note-records-v3-v4`). @@ -3279,6 +3275,10 @@ same *vendor-name*. Code Object V4 Metadata +++++++++++++++++++++++ +.. warning:: + Code object V4 is not the default code object version emitted by this version + of LLVM. + Code object V4 metadata is the same as :ref:`amdgpu-amdhsa-code-object-metadata-v3` with the changes and additions defined in table :ref:`amdgpu-amdhsa-code-object-metadata-map-table-v3`. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits