Skip to content

Update llvm version for pack propagation and linalg memory effects helpers #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/llvm-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7042fcc6389c6c103d501b6f39988eafed0d9b5b
37661a17e26d9002ae9ade8c0de3932c22f16360
25 changes: 15 additions & 10 deletions lib/gc/Dialect/Linalgx/LinalgOps.cpp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -525,20 +525,25 @@ private:
static void getGenericEffectsImpl(
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
&effects,
ValueRange results, const ValueRange inputOperands,
ValueRange outputOperands) {
for (auto operand : inputOperands) {
LinalgOp linalgOp) {
for (auto [index, operand] : llvm::enumerate(linalgOp.getDpsInputs())) {
if (!llvm::isa<MemRefType>(operand.getType()))
continue;
effects.emplace_back(MemoryEffects::Read::get(), operand,
SideEffects::DefaultResource::get());
effects.emplace_back(
MemoryEffects::Read::get(), &linalgOp->getOpOperand(index), /*stage=*/0,
/*effectOnFullRegion=*/true, SideEffects::DefaultResource::get());
}
for (auto operand : outputOperands) {
if (!llvm::isa<MemRefType>(operand.getType()))

for (OpOperand &operand : linalgOp.getDpsInitsMutable()) {
if (!llvm::isa<MemRefType>(operand.get().getType()))
continue;
effects.emplace_back(MemoryEffects::Read::get(), operand,
SideEffects::DefaultResource::get());
effects.emplace_back(MemoryEffects::Write::get(), operand,
if (linalgOp.payloadUsesValueFromOperand(&operand)) {
effects.emplace_back(MemoryEffects::Read::get(), &operand, /*stage=*/0,
/*effectOnFullRegion=*/true,
SideEffects::DefaultResource::get());
}
effects.emplace_back(MemoryEffects::Write::get(), &operand, /*stage=*/0,
/*effectOnFullRegion=*/true,
SideEffects::DefaultResource::get());
}
}
15 changes: 5 additions & 10 deletions lib/gc/Dialect/Linalgx/LinalgxOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ void SigmoidOp::getEffects(
&effects) {
if (hasPureTensorSemantics())
return;
getGenericEffectsImpl(effects, getOperation()->getResults(), getDpsInputs(),
getDpsInits());
getGenericEffectsImpl(effects, cast<LinalgOp>(getOperation()));
}

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -188,8 +187,7 @@ void Mm2DVnniOp::getEffects(
&effects) {
if (hasPureTensorSemantics())
return;
getGenericEffectsImpl(effects, getOperation()->getResults(), getDpsInputs(),
getDpsInits());
getGenericEffectsImpl(effects, cast<LinalgOp>(getOperation()));
}

LogicalResult Mm2DVnniOp::verify() {
Expand Down Expand Up @@ -329,8 +327,7 @@ void Mm4DVnniOp::getEffects(
&effects) {
if (hasPureTensorSemantics())
return;
getGenericEffectsImpl(effects, getOperation()->getResults(), getDpsInputs(),
getDpsInits());
getGenericEffectsImpl(effects, cast<LinalgOp>(getOperation()));
}

LogicalResult Mm4DVnniOp::verify() {
Expand Down Expand Up @@ -472,8 +469,7 @@ void BatchReduceMatmulVnniOp::getEffects(
&effects) {
if (hasPureTensorSemantics())
return;
getGenericEffectsImpl(effects, getOperation()->getResults(), getDpsInputs(),
getDpsInits());
getGenericEffectsImpl(effects, cast<LinalgOp>(getOperation()));
}

LogicalResult BatchReduceMatmulVnniOp::verify() {
Expand Down Expand Up @@ -609,8 +605,7 @@ void MultiBatchMatmulOp::getEffects(
&effects) {
if (hasPureTensorSemantics())
return;
getGenericEffectsImpl(effects, getOperation()->getResults(), getDpsInputs(),
getDpsInits());
getGenericEffectsImpl(effects, cast<LinalgOp>(getOperation()));
}

/////// Operations corresponding to library calls defined with Tablegen ////////
Expand Down