- bumps llvm-project to
6c64c8a6f3
- bumps stablehlo to
6e403b1aa6
- Updates type conversion materialization functions to return Value
after API change in llvm-project.

---------

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>
pull/3826/head
Max191 2024-10-30 11:38:51 -04:00 committed by GitHub
parent 6b58c89914
commit 8b0bf2e293
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 45 deletions

@ -1 +1 @@
Subproject commit f0b3b6d15b2c0ee2cff2dd31dc075adb5d9a4ff7 Subproject commit 6c64c8a6f3f77c30745c751d4163ff6bf2fc323b

2
externals/stablehlo vendored

@ -1 +1 @@
Subproject commit d40285ef3db0687e3f1e2bb0d716d748485a9739 Subproject commit 6e403b1aa6a71f5eaa09cc720e4ad42f692745e6

View File

@ -57,16 +57,16 @@ static void setupTorchBoolToI1Conversion(ConversionTarget &target,
typeConverter.addConversion([](Torch::BoolType type) -> std::optional<Type> { typeConverter.addConversion([](Torch::BoolType type) -> std::optional<Type> {
return IntegerType::get(type.getContext(), 1); return IntegerType::get(type.getContext(), 1);
}); });
typeConverter.addTargetMaterialization( typeConverter.addTargetMaterialization([](OpBuilder &builder,
[](OpBuilder &builder, IntegerType type, ValueRange inputs, IntegerType type, ValueRange inputs,
Location loc) -> std::optional<Value> { Location loc) -> Value {
// Other builtin integer types could be handled by other materializers. // Other builtin integer types could be handled by other materializers.
if (!(type.getWidth() == 1 && type.isSignless())) if (!(type.getWidth() == 1 && type.isSignless()))
return std::nullopt; return Value();
assert(inputs.size() == 1); assert(inputs.size() == 1);
assert(isa<Torch::BoolType>(inputs[0].getType())); assert(isa<Torch::BoolType>(inputs[0].getType()));
return builder.create<ToI1Op>(loc, inputs[0]).getResult(); return builder.create<ToI1Op>(loc, inputs[0]).getResult();
}); });
auto sourceMaterialization = [](OpBuilder &builder, Torch::BoolType type, auto sourceMaterialization = [](OpBuilder &builder, Torch::BoolType type,
ValueRange inputs, Location loc) -> Value { ValueRange inputs, Location loc) -> Value {
assert(inputs.size() == 1); assert(inputs.size() == 1);
@ -83,19 +83,19 @@ static void setupTorchIntToI64Conversion(ConversionTarget &target,
typeConverter.addConversion([](Torch::IntType type) -> std::optional<Type> { typeConverter.addConversion([](Torch::IntType type) -> std::optional<Type> {
return IntegerType::get(type.getContext(), 64); return IntegerType::get(type.getContext(), 64);
}); });
typeConverter.addTargetMaterialization( typeConverter.addTargetMaterialization([](OpBuilder &builder,
[](OpBuilder &builder, IntegerType type, ValueRange inputs, IntegerType type, ValueRange inputs,
Location loc) -> std::optional<Value> { Location loc) -> Value {
// Other builtin integer types could be handled by other materializers. // Other builtin integer types could be handled by other materializers.
if (!(type.getWidth() == 64 && type.isSignless())) if (!(type.getWidth() == 64 && type.isSignless()))
return std::nullopt; return Value();
// Other input type to be converted to i64 are handled by other // Other input type to be converted to i64 are handled by other
// materializers. // materializers.
if (!isa<Torch::IntType>(inputs[0].getType())) if (!isa<Torch::IntType>(inputs[0].getType()))
return std::nullopt; return Value();
assert(inputs.size() == 1); assert(inputs.size() == 1);
return builder.createOrFold<ToI64Op>(loc, inputs[0]); return builder.createOrFold<ToI64Op>(loc, inputs[0]);
}); });
auto sourceMaterialization = [](OpBuilder &builder, Torch::IntType type, auto sourceMaterialization = [](OpBuilder &builder, Torch::IntType type,
ValueRange inputs, Location loc) -> Value { ValueRange inputs, Location loc) -> Value {
assert(inputs.size() == 1); assert(inputs.size() == 1);
@ -112,13 +112,13 @@ static void setupTorchFloatToF64Conversion(ConversionTarget &target,
typeConverter.addConversion([](Torch::FloatType type) -> std::optional<Type> { typeConverter.addConversion([](Torch::FloatType type) -> std::optional<Type> {
return Float64Type::get(type.getContext()); return Float64Type::get(type.getContext());
}); });
typeConverter.addTargetMaterialization( typeConverter.addTargetMaterialization([](OpBuilder &builder,
[](OpBuilder &builder, Float64Type type, ValueRange inputs, Float64Type type, ValueRange inputs,
Location loc) -> std::optional<Value> { Location loc) -> Value {
assert(inputs.size() == 1); assert(inputs.size() == 1);
assert(isa<Torch::FloatType>(inputs[0].getType())); assert(isa<Torch::FloatType>(inputs[0].getType()));
return builder.create<ToF64Op>(loc, inputs[0]).getResult(); return builder.create<ToF64Op>(loc, inputs[0]).getResult();
}); });
auto sourceMaterialization = [](OpBuilder &builder, Torch::FloatType type, auto sourceMaterialization = [](OpBuilder &builder, Torch::FloatType type,
ValueRange inputs, Location loc) -> Value { ValueRange inputs, Location loc) -> Value {
assert(inputs.size() == 1); assert(inputs.size() == 1);
@ -137,19 +137,19 @@ static void setupTorchGeneratorToI64Conversion(ConversionTarget &target,
[](Torch::GeneratorType type) -> std::optional<Type> { [](Torch::GeneratorType type) -> std::optional<Type> {
return IntegerType::get(type.getContext(), 64); return IntegerType::get(type.getContext(), 64);
}); });
typeConverter.addTargetMaterialization( typeConverter.addTargetMaterialization([](OpBuilder &builder,
[](OpBuilder &builder, IntegerType type, ValueRange inputs, IntegerType type, ValueRange inputs,
Location loc) -> std::optional<Value> { Location loc) -> Value {
// Other builtin integer types could be handled by other materializers. // Other builtin integer types could be handled by other materializers.
if (!(type.getWidth() == 64 && type.isSignless())) if (!(type.getWidth() == 64 && type.isSignless()))
return std::nullopt; return Value();
// Other input type to be converted to i64 are handled by other // Other input type to be converted to i64 are handled by other
// materializers. // materializers.
if (!isa<Torch::GeneratorType>(inputs[0].getType())) if (!isa<Torch::GeneratorType>(inputs[0].getType()))
return std::nullopt; return Value();
assert(inputs.size() == 1); assert(inputs.size() == 1);
return builder.create<GeneratorToI64Op>(loc, inputs[0]).getResult(); return builder.create<GeneratorToI64Op>(loc, inputs[0]).getResult();
}); });
auto sourceMaterialization = [](OpBuilder &builder, Torch::GeneratorType type, auto sourceMaterialization = [](OpBuilder &builder, Torch::GeneratorType type,
ValueRange inputs, Location loc) -> Value { ValueRange inputs, Location loc) -> Value {
assert(inputs.size() == 1); assert(inputs.size() == 1);