[Mlir-commits] [mlir] [mlir][Target] Make nvptxcompiler passed options high priority to keep consistent with ptxas behavior (PR #121036)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Dec 24 00:21:32 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-llvm
Author: Zichen Lu (MikaOvO)
<details>
<summary>Changes</summary>
When using `ptxas` to do ptx->cubin, the options passed (via `cmd`) have higher priority than the gpuModule target (such as `opt-level`). When using `nvptxcompiler`, it is the opposite and we need to be consistent.
---
Full diff: https://github.com/llvm/llvm-project/pull/121036.diff
1 Files Affected:
- (modified) mlir/lib/Target/LLVM/NVVM/Target.cpp (+2-1)
``````````diff
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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/121036
More information about the Mlir-commits
mailing list