Skip to content

Commit 2c1a71c

Browse files
committed
[BACKEND] Update LLVM version to llvm/llvm-project@b864909
Includes fixes for the following LLVM changes: * llvm/llvm-project@bbe3d64 * llvm/llvm-project@2929a29 * llvm/llvm-project@48babe1
1 parent 91d6b5c commit 2c1a71c

File tree

8 files changed

+35
-16
lines changed

8 files changed

+35
-16
lines changed

cmake/llvm-hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0a83e96f6616c79a2ac63588a550ed420798791f
1+
b8649098a7fcf598406d8d8b7d68891d1444e9c8

test/Conversion/tritongpu_to_llvm.mlir

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// RUN: triton-opt %s -split-input-file --allocate-shared-memory-nv --convert-triton-gpu-to-llvm 2>/dev/null | FileCheck %s --dump-input-context 20
1+
// RUN: triton-opt %s -split-input-file \
2+
// RUN: --allocate-shared-memory-nv --convert-triton-gpu-to-llvm \
3+
// RUN: --reconcile-unrealized-casts 2>/dev/null \
4+
// RUN: | FileCheck %s --dump-input-context 20
25

36
module attributes {"ttg.num-ctas" = 1 : i32, "ttg.num-warps" = 4 : i32} {
47
// CHECK: llvm.func @test_empty_kernel(%arg0: i32, %arg1: !llvm.ptr<1>, %arg2: !llvm.ptr<1>, %arg3: !llvm.ptr<1>)

test/Conversion/tritonnvidiagpu_to_llvm.mlir

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// RUN: triton-opt %s -split-input-file --convert-triton-gpu-to-llvm=compute-capability=90 | FileCheck %s
1+
// RUN: triton-opt %s -split-input-file \
2+
// RUN: --convert-triton-gpu-to-llvm=compute-capability=90 \
3+
// RUN: --reconcile-unrealized-casts \
4+
// RUN: | FileCheck %s
25

36
#shared0 = #ttg.swizzled_shared<{vec = 1, perPhase = 1, maxPhase = 1, order = [0], CTAsPerCGA = [1], CTASplitNum = [1], CTAOrder = [0]}>
47
#smem = #ttg.shared_memory

third_party/amd/lib/TritonAMDGPUToLLVM/AtomicRMWOpsEmitter.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,28 @@ Value AtomicRMWEmitter::atomicIntraWaveReduce(RewriterBase &rewriter,
405405
Value done = b.icmp_eq(chosen, rmwPtr);
406406
Value mask = targetInfo.ballot(rewriter, loc, i64_ty, done);
407407
Value start = loopBody->getArgument(0);
408+
NamedAttribute noundef = rewriter.getNamedAttr(
409+
LLVM::LLVMDialect::getNoUndefAttrName(), rewriter.getUnitAttr());
410+
NamedAttribute lowRange = rewriter.getNamedAttr(
411+
LLVM::LLVMDialect::getRangeAttrName(),
412+
LLVM::ConstantRangeAttr::get(rewriter.getContext(), APInt::getZero(32),
413+
APInt(32, 32)));
414+
NamedAttribute highRange = rewriter.getNamedAttr(
415+
LLVM::LLVMDialect::getRangeAttrName(),
416+
LLVM::ConstantRangeAttr::get(rewriter.getContext(), APInt::getZero(32),
417+
APInt(32, 64)));
408418
Value cnt = b.trunc(i32_ty, generatePopcount64(rewriter, mask));
409419
Value maskLo = b.trunc(i32_ty, mask);
410-
Value mbcntLoRes =
411-
ROCDL::MbcntLoOp::create(rewriter, loc, i32_ty, maskLo, b.i32_val(0),
412-
/*arg_attrs=*/{}, /*res_attrs=*/{});
420+
Value mbcntLoRes = ROCDL::MbcntLoOp::create(
421+
rewriter, loc, i32_ty, maskLo, b.i32_val(0),
422+
/*arg_attrs=*/{}, /*res_attrs=*/
423+
rewriter.getArrayAttr(rewriter.getDictionaryAttr({noundef, lowRange})));
413424
Value maskHi = b.trunc(i32_ty, b.lshr(mask, b.i64_val(32)));
414-
Value idx =
415-
ROCDL::MbcntHiOp::create(rewriter, loc, i32_ty, maskHi, mbcntLoRes,
416-
/*arg_attrs=*/{}, /*res_attrs=*/{});
425+
Value idx = ROCDL::MbcntHiOp::create(
426+
rewriter, loc, i32_ty, maskHi, mbcntLoRes,
427+
/*arg_attrs=*/{},
428+
/*res_attrs=*/
429+
rewriter.getArrayAttr(rewriter.getDictionaryAttr({noundef, highRange})));
417430
Value base = b.add(start, cnt);
418431
Value leader = b.icmp_eq(idx, b.i32_val(0));
419432
cnt = b.sub(cnt, idx);

third_party/amd/lib/TritonAMDGPUToLLVM/TritonGPUToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ struct ConvertTritonAMDGPUToLLVM
256256
loc, arrayTy, /*isConstant=*/false, LLVM::Linkage::External,
257257
"global_smem", /*value=*/Attribute(), /*alignment=*/16,
258258
// Add ROCm support.
259-
static_cast<unsigned>(NVVM::NVVMMemorySpace::kSharedMemorySpace));
259+
static_cast<unsigned>(NVVM::NVVMMemorySpace::Shared));
260260
}
261261
};
262262

third_party/amd/lib/TritonAMDGPUTransforms/CanonicalizePointers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ class ConvertUnimplementedOpUnrealizedCasts
17641764
if (auto integerAttr =
17651765
llvm::dyn_cast_or_null<mlir::IntegerAttr>(maybeAttr)) {
17661766
if (integerAttr.getValue() == 0) {
1767-
rewriter.replaceAllUsesWith(castOp.getResult(0), fatPtrBase);
1767+
rewriter.RewriterBase::replaceAllUsesWith(castOp.getResult(0), fatPtrBase);
17681768
rewriter.eraseOp(castOp);
17691769
return success();
17701770
}
@@ -1774,7 +1774,7 @@ class ConvertUnimplementedOpUnrealizedCasts
17741774
fatPtrs.at({fatPtrBase, fatPtrOffset});
17751775
auto newPtr = createTensorPointer(rewriter, fatPtrBase, fatPtrOffset,
17761776
castOp.getLoc(), fatPtrAttrs);
1777-
rewriter.replaceAllUsesWith(newPtr, fatPtrBase);
1777+
rewriter.RewriterBase::replaceAllUsesWith(newPtr, fatPtrBase);
17781778
rewriter.eraseOp(castOp);
17791779
return success();
17801780
}

third_party/amd/lib/TritonAMDGPUTransforms/Utility.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ int deduceMinCountBetweeOps(Operation *beginOp, Operation *endOp,
2424
deduceMinCountInBlock(ifOp.getElseRegion().front(), countFunc);
2525
count += std::min(minThen, minElse);
2626
} else if (auto forOp = llvm::dyn_cast<scf::ForOp>(op)) {
27-
auto tripCount = constantTripCount(forOp.getLowerBound(),
28-
forOp.getUpperBound(), forOp.getStep())
29-
.value_or(0);
27+
int64_t tripCount = forOp.getStaticTripCount()
28+
.value_or(llvm::APInt(64, 0))
29+
.getZExtValue();
3030
if (tripCount > 0) {
3131
count += tripCount * deduceMinCountInBlock(*forOp.getBody(), countFunc);
3232
}

third_party/nvidia/lib/TritonNVIDIAGPUToLLVM/TritonGPUToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ struct ConvertTritonGPUToLLVM
220220
loc, arrayTy, /*isConstant=*/false, LLVM::Linkage::External,
221221
"global_smem", /*value=*/Attribute(), /*alignment=*/16,
222222
// Add ROCm support.
223-
static_cast<unsigned>(NVVM::NVVMMemorySpace::kSharedMemorySpace));
223+
static_cast<unsigned>(NVVM::NVVMMemorySpace::Shared));
224224
}
225225
};
226226

0 commit comments

Comments
 (0)