Skip to content
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

Update llvm-project to llvm/llvm-project@01d233ff403823389f848 #3011

Merged
Merged
Show file tree
Hide file tree
Changes from 14 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 docs/BuildOnLinuxOSX.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Firstly, install MLIR (as a part of LLVM-Project):
``` bash
git clone -n https://github.com/llvm/llvm-project.git
# Check out a specific branch that is known to work with ONNX-MLIR.
cd llvm-project && git checkout 00128a20eec27246719d73ba427bf821883b00b4 && cd ..
cd llvm-project && git checkout 01d233ff403823389f8480897e41aea84ecbb3d3 && cd ..
```

[same-as-file]: <> (utils/build-mlir.sh)
Expand Down
2 changes: 1 addition & 1 deletion docs/BuildOnWindows.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Install MLIR (as a part of LLVM-Project):
```shell
git clone -n https://github.com/llvm/llvm-project.git
# Check out a specific branch that is known to work with ONNX-MLIR.
cd llvm-project && git checkout 00128a20eec27246719d73ba427bf821883b00b4 && cd ..
cd llvm-project && git checkout 01d233ff403823389f8480897e41aea84ecbb3d3 && cd ..
```

[same-as-file]: <> (utils/build-mlir.cmd)
Expand Down
10 changes: 4 additions & 6 deletions src/Conversion/KrnlToAffine/ConvertKrnlToAffine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,20 +814,18 @@ AffineTypeConverter::AffineTypeConverter() {
addConversion([](Type type) { return type; });

addSourceMaterialization([&](OpBuilder &builder, Type resultType,
ValueRange inputs,
Location loc) -> std::optional<Value> {
ValueRange inputs, Location loc) -> Value {
if (inputs.size() != 1)
return std::nullopt;
return Value();

return builder.create<UnrealizedConversionCastOp>(loc, resultType, inputs)
.getResult(0);
});

addTargetMaterialization([&](OpBuilder &builder, Type resultType,
ValueRange inputs,
Location loc) -> std::optional<Value> {
ValueRange inputs, Location loc) -> Value {
if (inputs.size() != 1)
return std::nullopt;
return Value();

return builder.create<UnrealizedConversionCastOp>(loc, resultType, inputs)
.getResult(0);
Expand Down
10 changes: 4 additions & 6 deletions src/Conversion/ONNXToKrnl/ONNXToKrnlCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,20 +547,18 @@ KrnlTypeConverter::KrnlTypeConverter() {
});

addSourceMaterialization([&](OpBuilder &builder, Type resultType,
ValueRange inputs,
Location loc) -> std::optional<Value> {
ValueRange inputs, Location loc) -> Value {
if (inputs.size() != 1)
return std::nullopt;
return Value();

return builder.create<UnrealizedConversionCastOp>(loc, resultType, inputs)
.getResult(0);
});

addTargetMaterialization([&](OpBuilder &builder, Type resultType,
ValueRange inputs,
Location loc) -> std::optional<Value> {
ValueRange inputs, Location loc) -> Value {
if (inputs.size() != 1)
return std::nullopt;
return Value();

return builder.create<UnrealizedConversionCastOp>(loc, resultType, inputs)
.getResult(0);
Expand Down
19 changes: 11 additions & 8 deletions src/Dialect/Mlir/DialectBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ Value MathBuilder::constant(Type type, double val) const {
b().create<arith::ConstantOp>(loc(), b().getF64FloatAttr(val));
})
.Case<IntegerType>([&](IntegerType elementType) {
assert(val == (int64_t)val && "value is ambiguous");
assert(val == static_cast<int64_t>(val) && "value is ambiguous");
unsigned width = elementType.getWidth();

if (width == 1)
Expand All @@ -627,12 +627,14 @@ Value MathBuilder::constant(Type type, double val) const {
// If unsigned, create a signless constant, then cast it to unsigned.
if (elementType.isUnsignedInteger()) {
Type signlessTy = b().getIntegerType(width);
constant = b().create<arith::ConstantOp>(loc(),
b().getIntegerAttr(signlessTy, APInt(width, (int64_t)val)));
constant = b().create<arith::ConstantOp>(
loc(), b().getIntegerAttr(signlessTy,
APInt(width, static_cast<int64_t>(val), false, true)));
constant = castToUnsigned(constant, width);
} else {
constant = b().create<arith::ConstantOp>(loc(),
b().getIntegerAttr(elementType, APInt(width, (int64_t)val)));
constant = b().create<arith::ConstantOp>(
loc(), b().getIntegerAttr(elementType,
APInt(width, static_cast<int64_t>(val), false, true)));
}
}
})
Expand Down Expand Up @@ -695,7 +697,7 @@ TypedAttr MathBuilder::negativeInfAttr(Type type) const {
default:
llvm_unreachable("unsupported element type");
}
attr = b().getIntegerAttr(type, APInt(width, value));
attr = b().getIntegerAttr(type, APInt(width, value, false, true));
Copy link
Collaborator Author

@hamptonm1 hamptonm1 Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to update the APInt with the following boolean values based on the this PR update: llvm/llvm-project#114539

Previously truncation was set to true as default and they changed it to false, we need the truncation on for our lit tests to pass and to be consistent with the previous behavior.

})
.Default([](Type) { llvm_unreachable("unsupported element type"); });
assert(attr != nullptr && "Expecting valid attribute");
Expand Down Expand Up @@ -740,7 +742,7 @@ TypedAttr MathBuilder::positiveInfAttr(Type type) const {
default:
llvm_unreachable("unsupported element type");
}
attr = b().getIntegerAttr(type, APInt(width, value));
attr = b().getIntegerAttr(type, APInt(width, value, false, true));
})
.Default([](Type) { llvm_unreachable("unsupported element type"); });
assert(attr != nullptr && "Expecting valid attribute");
Expand Down Expand Up @@ -2263,7 +2265,8 @@ Value LLVMBuilder::constant(Type type, int64_t val) const {
assert(type.isSignless() &&
"LLVM::ConstantOp requires a signless type.");
constant = b().create<LLVM::ConstantOp>(loc(), type,
b().getIntegerAttr(type, APInt(width, (int64_t)val)));
b().getIntegerAttr(
type, APInt(width, static_cast<int64_t>(val), false, true)));
}
})
.Case<IndexType>([&](Type) {
Expand Down
Loading
Loading