-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate LLVM at llvm/llvm-project@ac2a2816e3fe
Updates LLVM usage to match [ac2a2816e3fe](llvm/llvm-project@ac2a2816e3fe) PiperOrigin-RevId: 680981749
- Loading branch information
1 parent
ed705dc
commit 877928f
Showing
14 changed files
with
3,585 additions
and
44 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
--- a/lib/Conversion/TritonGPUToLLVM/ControlFlowOpToLLVM.cpp 2024-03-19 09:23:43.000000000 -0700 | ||
+++ b/lib/Conversion/TritonGPUToLLVM/ControlFlowOpToLLVM.cpp 2024-10-01 02:58:18.000000000 -0700 | ||
@@ -104,9 +104,26 @@ | ||
this->getTypeConverter()->packFunctionResults(resultTypes))) | ||
return nullptr; | ||
} | ||
+ // Add LLVMOp Bundle Attrs | ||
+ // https://github.com/llvm/llvm-project/blob/main/flang/lib/Optimizer/CodeGen/CodeGen.cpp#L113-L131 | ||
+ llvm::SmallVector<mlir::NamedAttribute> newAttrs; | ||
+ newAttrs.reserve(callOp->getAttrs().size() + 2); | ||
+ | ||
+ for (mlir::NamedAttribute attr : callOp->getAttrs()) { | ||
+ if (attr.getName() != "operandSegmentSizes") | ||
+ newAttrs.push_back(attr); | ||
+ } | ||
+ | ||
+ newAttrs.push_back(rewriter.getNamedAttr( | ||
+ "operandSegmentSizes", | ||
+ rewriter.getDenseI32ArrayAttr( | ||
+ {static_cast<int>(promotedOperands.size()), 0}))); | ||
+ newAttrs.push_back(rewriter.getNamedAttr( | ||
+ "op_bundle_sizes", rewriter.getDenseI32ArrayAttr({}))); | ||
+ | ||
auto newCallOp = rewriter.create<LLVM::CallOp>( | ||
callOp.getLoc(), packedResult ? TypeRange(packedResult) : TypeRange(), | ||
- promotedOperands, callOp->getAttrs()); | ||
+ promotedOperands, newAttrs); | ||
return newCallOp; | ||
} | ||
|
||
|
||
--- a/third_party/amd/lib/TritonAMDGPUToLLVM/BuiltinFuncToLLVM.cpp 2024-09-25 10:13:59.000000000 -0700 | ||
+++ b/third_party/amd/lib/TritonAMDGPUToLLVM/BuiltinFuncToLLVM.cpp 2024-09-30 23:51:44.000000000 -0700 | ||
@@ -190,7 +190,8 @@ | ||
auto name = StringAttr::get(callOp.getContext(), "llvm.amdgcn.rcp.f32"); | ||
LLVM::FastmathFlagsAttr defaultFlags{}; | ||
auto rcpOp = rewriter.create<LLVM::CallIntrinsicOp>( | ||
- loc, returnType, name, operands[1], defaultFlags); | ||
+ loc, returnType, name, operands[1], defaultFlags, | ||
+ ::llvm::ArrayRef<::mlir::ValueRange>{} /*op_bundle_operands*/); | ||
|
||
replacementOp = rewriter.create<LLVM::FMulOp>( | ||
loc, returnType, operands[0], rcpOp->getResult(0), defaultFlags); | ||
|
||
|
||
--- a/third_party/amd/lib/TritonAMDGPUToLLVM/DotOpToLLVM/WMMA.cpp 2024-08-20 03:28:55.000000000 -0700 | ||
+++ b/third_party/amd/lib/TritonAMDGPUToLLVM/DotOpToLLVM/WMMA.cpp 2024-09-30 23:51:44.000000000 -0700 | ||
@@ -219,7 +219,8 @@ | ||
} | ||
auto wmmaIntrinsic = rewriter.create<mlir::LLVM::CallIntrinsicOp>( | ||
loc, TypeRange{valC.getType()}, StringAttr::get(loc.getContext(), name), | ||
- operands, defaultFlags); | ||
+ operands, defaultFlags, | ||
+ ::llvm::ArrayRef<::mlir::ValueRange>{} /*op_bundle_operands*/); | ||
|
||
return wmmaIntrinsic.getResult(0); | ||
} | ||
|
||
|
||
--- a/third_party/amd/lib/TritonAMDGPUToLLVM/TargetInfo.cpp 2024-09-16 13:44:40.000000000 -0700 | ||
+++ b/third_party/amd/lib/TritonAMDGPUToLLVM/TargetInfo.cpp 2024-09-30 23:51:44.000000000 -0700 | ||
@@ -72,7 +72,10 @@ | ||
auto stringAttr = rewriter.getStringAttr("llvm.amdgcn.ballot"); | ||
SmallVector<Value> operands = {cmp}; | ||
Value asmResult = | ||
- rewriter.create<LLVM::CallIntrinsicOp>(loc, type, stringAttr, operands) | ||
+ rewriter | ||
+ .create<LLVM::CallIntrinsicOp>( | ||
+ loc, type, stringAttr, operands, ::mlir::LLVM::FastmathFlags{}, | ||
+ ::llvm::ArrayRef<::mlir::ValueRange>{} /*op_bundle_operands*/) | ||
->getResult(0); | ||
return asmResult; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.