[Mlir-commits] [mlir] [mlir][LLVM] Add the `ConvertToLLVMAttrInterface` and `ConvertToLLVMOpInterface` interfaces (PR #99566)
Mehdi Amini
llvmlistbot at llvm.org
Fri Jul 26 16:17:35 PDT 2024
================
@@ -104,20 +99,33 @@ class ConvertToLLVMPass
auto *iface = dyn_cast<ConvertToLLVMPatternInterface>(dialect);
if (!iface)
continue;
- iface->populateConvertToLLVMConversionPatterns(*target, *typeConverter,
- tempPatterns);
+ interfaces->push_back(iface);
}
}
- this->patterns =
- std::make_unique<FrozenRewritePatternSet>(std::move(tempPatterns));
- this->target = target;
- this->typeConverter = typeConverter;
+ this->interfaces = interfaces;
return success();
}
void runOnOperation() final {
- if (failed(applyPartialConversion(getOperation(), *target, *patterns)))
+ MLIRContext *context = &getContext();
+ RewritePatternSet patterns(context);
+ ConversionTarget target(*context);
+ target.addLegalDialect<LLVM::LLVMDialect>();
+ LLVMTypeConverter typeConverter(context);
----------------
joker-eph wrote:
> However, let's say the cost of that initialization is C. In the previous version C is paid only once. In this version the overall cost is C * threads, so the overall computation time does increase. However, on a thread per thread basis the cost might not be as impactful.
I believe the cost is `C * thread * N` where N is the number of invocation of the pass-pipeline: if I setup a compilation server my pass-pipeline could be initialized once and used to compiled many modules.
https://github.com/llvm/llvm-project/pull/99566
More information about the Mlir-commits
mailing list