From 80fcc9247a166ca056f049fc4662417b2ae157ce Mon Sep 17 00:00:00 2001 From: Krzysztof Drewniak Date: Tue, 23 Jan 2024 12:16:18 -0600 Subject: [PATCH] [mlir][AMDGPU] Actually update the default ABI version, add comments (#79185) Much confusion occurred earlier today when updating the fallback `int abi;` in addControlVariables() didn't do anything. THis was because that that value is the fallback for if the ABI version fails to parse ... which it always should, because it has a default value that comes from multiple different places. This commit updates all the places said default variable can come from, namely: 1. The ROCDL target attribute definition 2. The ROCDL target attribute's builders 3. The rocdl-attach-target pass's default option values. With this, the printf test is passing. --- mlir/include/mlir/Dialect/GPU/Transforms/Passes.td | 4 ++-- mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td b/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td index 3e0f6a3022f935..a8235bed6f2764 100644 --- a/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td +++ b/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td @@ -178,8 +178,8 @@ def GpuROCDLAttachTarget: Pass<"rocdl-attach-target", ""> { /*default=*/"\"\"", "Target features.">, Option<"abiVersion", "abi", "std::string", - /*default=*/"\"400\"", - "Optimization level.">, + /*default=*/"\"500\"", + "ABI version.">, Option<"optLevel", "O", "unsigned", /*default=*/"2", "Optimization level.">, diff --git a/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td index 48b830ae34f292..516a984399ff81 100644 --- a/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td @@ -635,7 +635,9 @@ def ROCDL_TargettAttr : StringRefParameter<"Target triple.", "\"amdgcn-amd-amdhsa\"">:$triple, StringRefParameter<"Target chip.", "\"gfx900\"">:$chip, StringRefParameter<"Target chip features.", "\"\"">:$features, - StringRefParameter<"ABI version.", "\"400\"">:$abi, + // Also update the default builder below and rocdl-attach-target in + // Dialect/GPU/Transforms/Passes.td . + StringRefParameter<"ABI version.", "\"500\"">:$abi, OptionalParameter<"DictionaryAttr", "Target specific flags.">:$flags, OptionalParameter<"ArrayAttr", "Files to link to the LLVM module.">:$link ); @@ -647,7 +649,7 @@ def ROCDL_TargettAttr : CArg<"StringRef", "\"amdgcn-amd-amdhsa\"">:$triple, CArg<"StringRef", "\"gfx900\"">:$chip, CArg<"StringRef", "\"\"">:$features, - CArg<"StringRef", "\"400\"">:$abiVersion, + CArg<"StringRef", "\"500\"">:$abiVersion, CArg<"DictionaryAttr", "nullptr">:$targetFlags, CArg<"ArrayAttr", "nullptr">:$linkFiles), [{ return Base::get($_ctxt, optLevel, triple, chip, features, abiVersion,