diff --git a/externals/llvm-project b/externals/llvm-project index f0b3b6d15..6c64c8a6f 160000 --- a/externals/llvm-project +++ b/externals/llvm-project @@ -1 +1 @@ -Subproject commit f0b3b6d15b2c0ee2cff2dd31dc075adb5d9a4ff7 +Subproject commit 6c64c8a6f3f77c30745c751d4163ff6bf2fc323b diff --git a/externals/stablehlo b/externals/stablehlo index d40285ef3..6e403b1aa 160000 --- a/externals/stablehlo +++ b/externals/stablehlo @@ -1 +1 @@ -Subproject commit d40285ef3db0687e3f1e2bb0d716d748485a9739 +Subproject commit 6e403b1aa6a71f5eaa09cc720e4ad42f692745e6 diff --git a/lib/Dialect/TorchConversion/Transforms/BackendTypeConversion.cpp b/lib/Dialect/TorchConversion/Transforms/BackendTypeConversion.cpp index 0f2533e06..53de48f21 100644 --- a/lib/Dialect/TorchConversion/Transforms/BackendTypeConversion.cpp +++ b/lib/Dialect/TorchConversion/Transforms/BackendTypeConversion.cpp @@ -57,16 +57,16 @@ static void setupTorchBoolToI1Conversion(ConversionTarget &target, typeConverter.addConversion([](Torch::BoolType type) -> std::optional { return IntegerType::get(type.getContext(), 1); }); - typeConverter.addTargetMaterialization( - [](OpBuilder &builder, IntegerType type, ValueRange inputs, - Location loc) -> std::optional { - // Other builtin integer types could be handled by other materializers. - if (!(type.getWidth() == 1 && type.isSignless())) - return std::nullopt; - assert(inputs.size() == 1); - assert(isa(inputs[0].getType())); - return builder.create(loc, inputs[0]).getResult(); - }); + typeConverter.addTargetMaterialization([](OpBuilder &builder, + IntegerType type, ValueRange inputs, + Location loc) -> Value { + // Other builtin integer types could be handled by other materializers. + if (!(type.getWidth() == 1 && type.isSignless())) + return Value(); + assert(inputs.size() == 1); + assert(isa(inputs[0].getType())); + return builder.create(loc, inputs[0]).getResult(); + }); auto sourceMaterialization = [](OpBuilder &builder, Torch::BoolType type, ValueRange inputs, Location loc) -> Value { assert(inputs.size() == 1); @@ -83,19 +83,19 @@ static void setupTorchIntToI64Conversion(ConversionTarget &target, typeConverter.addConversion([](Torch::IntType type) -> std::optional { return IntegerType::get(type.getContext(), 64); }); - typeConverter.addTargetMaterialization( - [](OpBuilder &builder, IntegerType type, ValueRange inputs, - Location loc) -> std::optional { - // Other builtin integer types could be handled by other materializers. - if (!(type.getWidth() == 64 && type.isSignless())) - return std::nullopt; - // Other input type to be converted to i64 are handled by other - // materializers. - if (!isa(inputs[0].getType())) - return std::nullopt; - assert(inputs.size() == 1); - return builder.createOrFold(loc, inputs[0]); - }); + typeConverter.addTargetMaterialization([](OpBuilder &builder, + IntegerType type, ValueRange inputs, + Location loc) -> Value { + // Other builtin integer types could be handled by other materializers. + if (!(type.getWidth() == 64 && type.isSignless())) + return Value(); + // Other input type to be converted to i64 are handled by other + // materializers. + if (!isa(inputs[0].getType())) + return Value(); + assert(inputs.size() == 1); + return builder.createOrFold(loc, inputs[0]); + }); auto sourceMaterialization = [](OpBuilder &builder, Torch::IntType type, ValueRange inputs, Location loc) -> Value { assert(inputs.size() == 1); @@ -112,13 +112,13 @@ static void setupTorchFloatToF64Conversion(ConversionTarget &target, typeConverter.addConversion([](Torch::FloatType type) -> std::optional { return Float64Type::get(type.getContext()); }); - typeConverter.addTargetMaterialization( - [](OpBuilder &builder, Float64Type type, ValueRange inputs, - Location loc) -> std::optional { - assert(inputs.size() == 1); - assert(isa(inputs[0].getType())); - return builder.create(loc, inputs[0]).getResult(); - }); + typeConverter.addTargetMaterialization([](OpBuilder &builder, + Float64Type type, ValueRange inputs, + Location loc) -> Value { + assert(inputs.size() == 1); + assert(isa(inputs[0].getType())); + return builder.create(loc, inputs[0]).getResult(); + }); auto sourceMaterialization = [](OpBuilder &builder, Torch::FloatType type, ValueRange inputs, Location loc) -> Value { assert(inputs.size() == 1); @@ -137,19 +137,19 @@ static void setupTorchGeneratorToI64Conversion(ConversionTarget &target, [](Torch::GeneratorType type) -> std::optional { return IntegerType::get(type.getContext(), 64); }); - typeConverter.addTargetMaterialization( - [](OpBuilder &builder, IntegerType type, ValueRange inputs, - Location loc) -> std::optional { - // Other builtin integer types could be handled by other materializers. - if (!(type.getWidth() == 64 && type.isSignless())) - return std::nullopt; - // Other input type to be converted to i64 are handled by other - // materializers. - if (!isa(inputs[0].getType())) - return std::nullopt; - assert(inputs.size() == 1); - return builder.create(loc, inputs[0]).getResult(); - }); + typeConverter.addTargetMaterialization([](OpBuilder &builder, + IntegerType type, ValueRange inputs, + Location loc) -> Value { + // Other builtin integer types could be handled by other materializers. + if (!(type.getWidth() == 64 && type.isSignless())) + return Value(); + // Other input type to be converted to i64 are handled by other + // materializers. + if (!isa(inputs[0].getType())) + return Value(); + assert(inputs.size() == 1); + return builder.create(loc, inputs[0]).getResult(); + }); auto sourceMaterialization = [](OpBuilder &builder, Torch::GeneratorType type, ValueRange inputs, Location loc) -> Value { assert(inputs.size() == 1);