[PATCH] D57977: [HIP] compile option code-object-v3 propagate to llc

Aaron Enye Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 8 14:21:39 PST 2019


ashi1 created this revision.
ashi1 added reviewers: yaxunl, kzhuravl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch allows the compile option -mcode-object-v3 to be set by default, unless the -mno-code-object-v3 is added to the compile options.


Repository:
  rC Clang

https://reviews.llvm.org/D57977

Files:
  lib/Driver/ToolChains/HIP.cpp


Index: lib/Driver/ToolChains/HIP.cpp
===================================================================
--- lib/Driver/ToolChains/HIP.cpp
+++ lib/Driver/ToolChains/HIP.cpp
@@ -157,12 +157,20 @@
     Compilation &C, const JobAction &JA, const InputInfoList &Inputs,
     const llvm::opt::ArgList &Args, llvm::StringRef SubArchName,
     llvm::StringRef OutputFilePrefix, const char *InputFileName) const {
+
+  llvm::StringRef CodeObjectVersion;
+  // Add Code Object Version
+  if (Args.hasArg(options::OPT_mno_code_object_v3))
+    CodeObjectVersion = "-mattr=-code-object-v3";
+  else
+    CodeObjectVersion = "-mattr=+code-object-v3";
+
   // Construct llc command.
   // FIXME: -disable-promote-alloca-to-lds is a workaround for issues in
   // AMDGPUPromoteAlloca pass which cause invalid memory access in PyTorch.
   // Remove this once the issue is fixed.
   ArgStringList LlcArgs{InputFileName, "-mtriple=amdgcn-amd-amdhsa",
-                        "-filetype=obj", "-mattr=-code-object-v3",
+                        "-filetype=obj", Args.MakeArgString(CodeObjectVersion),
                         "-disable-promote-alloca-to-lds",
                         Args.MakeArgString("-mcpu=" + SubArchName), "-o"};
   std::string LlcOutputFileName =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57977.186048.patch
Type: text/x-patch
Size: 1253 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190208/308eb104/attachment.bin>


More information about the cfe-commits mailing list