[Mlir-commits] [mlir] [mlir][Target] Make nvptxcompiler passed options high priority to keep consistent with ptxas behavior (PR #121036)

Zichen Lu llvmlistbot at llvm.org
Mon Jan 6 23:58:34 PST 2025


https://github.com/MikaOvO updated https://github.com/llvm/llvm-project/pull/121036

>From ed42c7e2cc44f0e3ef42189adc25a32efba2ee73 Mon Sep 17 00:00:00 2001
From: Zichen Lu <mikaovo2000 at gmail.com>
Date: Tue, 24 Dec 2024 16:17:00 +0800
Subject: [PATCH] [mlir][Target] Make nvptxcompiler passed options high
 priority to be consistent with ptxas

---
 mlir/lib/Target/LLVM/NVVM/Target.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mlir/lib/Target/LLVM/NVVM/Target.cpp b/mlir/lib/Target/LLVM/NVVM/Target.cpp
index bca26e3a0e84a9..0f630f56af301e 100644
--- a/mlir/lib/Target/LLVM/NVVM/Target.cpp
+++ b/mlir/lib/Target/LLVM/NVVM/Target.cpp
@@ -484,7 +484,8 @@ NVPTXSerializer::compileToBinaryNVPTX(const std::string &ptxCode) {
   std::string optLevel = std::to_string(this->optLevel);
   std::pair<llvm::BumpPtrAllocator, SmallVector<const char *>> cmdOpts =
       targetOptions.tokenizeCmdOptions();
-  cmdOpts.second.append(
+  cmdOpts.second.insert(
+      cmdOpts.second.begin(),
       {"-arch", getTarget().getChip().data(), "--opt-level", optLevel.c_str()});
 
   // Create the compiler handle.



More information about the Mlir-commits mailing list