Skip to content

Commit

Permalink
[mlir][AMDGPU] Actually update the default ABI version, add comments (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
krzysz00 authored Jan 23, 2024
1 parent 5a7d68c commit 80fcc92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -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.">,
Expand Down
6 changes: 4 additions & 2 deletions mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand All @@ -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,
Expand Down

0 comments on commit 80fcc92

Please sign in to comment.