Skip to content

Commit

Permalink
Bump LLVM version to bcb685e1
Browse files Browse the repository at this point in the history
Include fixes for LLVM change 3cd2a0bc

llvm/llvm-project@3cd2a0b
  • Loading branch information
karupayun committed Nov 6, 2023
1 parent 48e6bb7 commit e81f98b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ cloneAndUpdateOperands(RewriterBase &rewriter, Operation *op,
void LoopPipelinerInternal::emitPrologue(RewriterBase &rewriter) {
// Initialize the iteration argument to the loop initiale values.
for (BlockArgument &arg : forOp.getRegionIterArgs()) {
OpOperand &operand = forOp.getOpOperandForRegionIterArg(arg);
OpOperand &operand = *forOp.getTiedLoopInit(arg);
setValueMapping(arg, operand.get(), 0);
}
auto yield = cast<scf::YieldOp>(forOp.getBody()->getTerminator());
Expand Down
6 changes: 3 additions & 3 deletions lib/Dialect/TritonGPU/Transforms/Prefetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ LogicalResult Prefetcher::initialize() {
auto getIncomingOp = [this](Value v) -> Value {
if (auto arg = v.dyn_cast<BlockArgument>())
if (arg.getOwner()->getParentOp() == forOp.getOperation())
return forOp.getOpOperandForRegionIterArg(arg).get();
return forOp.getTiedLoopInit(arg)->get();
return Value();
};

Expand Down Expand Up @@ -298,10 +298,10 @@ scf::ForOp Prefetcher::createNewForOp() {
Operation *firstDot = builder.clone(*dot, mapping);
if (Value a = operand2headPrefetch.lookup(dot.getA()))
firstDot->setOperand(
0, newForOp.getRegionIterArgForOpOperand(*a.use_begin()));
0, newForOp.getTiedLoopRegionIterArg(&*a.use_begin()));
if (Value b = operand2headPrefetch.lookup(dot.getB()))
firstDot->setOperand(
1, newForOp.getRegionIterArgForOpOperand(*b.use_begin()));
1, newForOp.getTiedLoopRegionIterArg(&*b.use_begin()));

// remaining part
int64_t kOff = prefetchWidth;
Expand Down
8 changes: 4 additions & 4 deletions lib/Dialect/TritonGPU/Transforms/RemoveLayoutConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ SmallVector<Value> LayoutPropagation::propagateToUsers(Value value,
for (OpOperand &use : value.getUses()) {
Operation *user = use.getOwner();
if (auto forOp = dyn_cast<scf::ForOp>(user)) {
Value arg = forOp.getRegionIterArgForOpOperand(use);
Value result = forOp.getResultForOpOperand(use);
Value arg = forOp.getTiedLoopRegionIterArg(&use);
Value result = forOp.getTiedLoopResult(&use);
setEncoding({arg, result}, info, changed, user);
continue;
}
Expand Down Expand Up @@ -736,9 +736,9 @@ static void rewriteSlice(SetVector<Value> &slice,
SmallVector<Value> newOperands;
for (auto arg : forOp.getRegionIterArgs()) {
if (slice.count(arg)) {
OpOperand &initVal = forOp.getOpOperandForRegionIterArg(arg);
OpOperand &initVal = *forOp.getTiedLoopInit(arg);
argMapping.push_back(std::make_pair(
forOp.getResultForOpOperand(initVal).getResultNumber(),
forOp.getTiedLoopResult(&initVal).getResultNumber(),
forOp.getInitArgs().size() + newOperands.size()));
newOperands.push_back(mapping.lookup(initVal.get()));
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Dialect/TritonGPU/Transforms/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,10 @@ getConvertBackwardSlice(Value root, SetVector<Value> &slice,
Block *block = blockArg.getOwner();
Operation *parentOp = block->getParentOp();
if (auto forOp = dyn_cast<scf::ForOp>(parentOp)) {
OpOperand &initOperand = forOp.getOpOperandForRegionIterArg(blockArg);
OpOperand *initOperand = forOp.getTiedLoopInit(blockArg);
Value yieldOperand = forOp.getBody()->getTerminator()->getOperand(
blockArg.getArgNumber() - forOp.getNumInductionVars());
queue.push_back({initOperand.get(), encoding});
queue.push_back({initOperand->get(), encoding});
queue.push_back({yieldOperand, encoding});
continue;
}
Expand Down Expand Up @@ -566,7 +566,7 @@ struct ForOpDeadArgElimination : public OpRewritePattern<scf::ForOp> {
Value value = queue.pop_back_val();
if (auto nestedFor = value.getDefiningOp<scf::ForOp>()) {
auto result = value.cast<OpResult>();
OpOperand &forOperand = nestedFor.getOpOperandForResult(result);
OpOperand &forOperand = *nestedFor.getTiedLoopInit(result);
markLive(forOperand.get());
auto nestedYieldOp =
cast<scf::YieldOp>(nestedFor.getBody()->getTerminator());
Expand Down
7 changes: 3 additions & 4 deletions lib/Dialect/TritonNvidiaGPU/Transforms/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ LogicalResult getDependentPointers(Value ptr, DenseSet<Value> &dependentSet,
auto parentOp = blockArg.getOwner()->getParentOp();
if (auto forOp = dyn_cast<scf::ForOp>(parentOp)) {
if (blockArg.getArgNumber() >= forOp.getNumInductionVars()) {
if (failed(getDependentPointers(
forOp.getOpOperandForRegionIterArg(blockArg).get(),
dependentSet, processedSet)))
if (failed(getDependentPointers(forOp.getTiedLoopInit(blockArg)->get(),
dependentSet, processedSet)))
return failure();

unsigned operandIdx =
Expand Down Expand Up @@ -383,7 +382,7 @@ LogicalResult getDependentValues(Value val, DenseSet<Value> &depSet,
if (failed(addControlOperandsForForOp(forOp)))
return failure();
if (blockArg.getArgNumber() >= forOp.getNumInductionVars()) {
Value operand = forOp.getOpOperandForRegionIterArg(blockArg).get();
Value operand = forOp.getTiedLoopInit(blockArg)->get();
if (failed(tryInsertAndPropagate(operand)))
return failure();

Expand Down
2 changes: 1 addition & 1 deletion llvm-hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
01828c4323172db5901ac3e959d52553b2bd74e5
bcb685e11945946335c2dc6265779f0226491b49
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_llvm_package_info():
return Package("llvm", "LLVM-C.lib", "", "LLVM_INCLUDE_DIRS", "LLVM_LIBRARY_DIR", "LLVM_SYSPATH")
# use_assert_enabled_llvm = check_env_flag("TRITON_USE_ASSERT_ENABLED_LLVM", "False")
# release_suffix = "assert" if use_assert_enabled_llvm else "release"
rev = "01828c43"
rev = "bcb685e1"
name = f"llvm-{rev}-{system_suffix}"
url = f"https://tritonlang.blob.core.windows.net/llvm-builds/{name}.tar.gz"
return Package("llvm", name, url, "LLVM_INCLUDE_DIRS", "LLVM_LIBRARY_DIR", "LLVM_SYSPATH")
Expand Down
2 changes: 1 addition & 1 deletion test/lib/Analysis/TestAlias.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct TestAliasPass
}
if (auto forOp = dyn_cast<scf::ForOp>(op)) {
for (auto arg : llvm::enumerate(forOp.getRegionIterArgs())) {
auto operand = forOp.getOpOperandForRegionIterArg(arg.value()).get();
auto operand = forOp.getTiedLoopInit(arg.value())->get();
auto opNames = getAllocOpNames(operand);
auto argName = getValueOperandName(arg.value(), state);
print(argName, opNames, os);
Expand Down

0 comments on commit e81f98b

Please sign in to comment.