[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
Tue Feb 12 11:10:22 PST 2019


ashi1 updated this revision to Diff 186519.
ashi1 added a comment.
Herald added a subscriber: jdoerfert.

Changed patch to us handleTargetFeatures, to consume all -m options passed into clang.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57977/new/

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
@@ -162,9 +162,26 @@
   // 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",
                         "-disable-promote-alloca-to-lds",
-                        Args.MakeArgString("-mcpu=" + SubArchName), "-o"};
+                        Args.MakeArgString("-mcpu=" + SubArchName)};
+
+  // Extract all the -m options
+  std::vector<llvm::StringRef> Features;
+  handleTargetFeaturesGroup(
+    Args, Features, options::OPT_m_amdgpu_Features_Group);
+
+  // Add features to mattr such as code-object-v3 and xnack
+  std::string MAttrString = "-mattr=";
+  for(auto OneFeature : Features) {
+    MAttrString.append(Args.MakeArgString(OneFeature));
+    if (OneFeature != Features.back())
+      MAttrString.append(",");
+  }
+  LlcArgs.push_back(Args.MakeArgString(MAttrString));
+
+  // Add output filename
+  LlcArgs.push_back("-o");
   std::string LlcOutputFileName =
       C.getDriver().GetTemporaryPath(OutputFilePrefix, "o");
   const char *LlcOutputFile =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57977.186519.patch
Type: text/x-patch
Size: 1379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190212/44b7b151/attachment-0001.bin>


More information about the cfe-commits mailing list