[Mlir-commits] [mlir] [mlir][transform] Allow passing various library files to interpreter. (PR #67120)
Ingo Müller
llvmlistbot at llvm.org
Fri Oct 6 00:55:54 PDT 2023
================
@@ -611,53 +613,131 @@ LogicalResult transform::detail::interpreterBaseRunOnOperationImpl(
LogicalResult transform::detail::interpreterBaseInitializeImpl(
MLIRContext *context, StringRef transformFileName,
- StringRef transformLibraryFileName,
+ ArrayRef<std::string> transformLibraryPaths,
std::shared_ptr<OwningOpRef<ModuleOp>> &sharedTransformModule,
std::shared_ptr<OwningOpRef<ModuleOp>> &transformLibraryModule,
function_ref<std::optional<LogicalResult>(OpBuilder &, Location)>
moduleBuilder) {
- OwningOpRef<ModuleOp> parsedTransformModule;
- if (failed(parseTransformModuleFromFile(context, transformFileName,
- parsedTransformModule)))
- return failure();
- if (parsedTransformModule && failed(mlir::verify(*parsedTransformModule)))
- return failure();
+ auto unknownLoc = UnknownLoc::get(context);
- OwningOpRef<ModuleOp> parsedLibraryModule;
- if (failed(parseTransformModuleFromFile(context, transformLibraryFileName,
- parsedLibraryModule)))
- return failure();
- if (parsedLibraryModule && failed(mlir::verify(*parsedLibraryModule)))
- return failure();
+ // Parse module from file.
+ OwningOpRef<ModuleOp> moduleFromFile;
+ {
+ auto loc = FileLineColLoc::get(context, transformFileName, 0, 0);
+ if (failed(parseTransformModuleFromFile(context, transformFileName,
+ moduleFromFile)))
+ return emitError(loc) << "failed to parse transform module";
+ if (moduleFromFile && failed(mlir::verify(*moduleFromFile)))
+ return emitError(loc) << "failed to verify transform module";
+ }
- if (parsedTransformModule) {
- sharedTransformModule = std::make_shared<OwningOpRef<ModuleOp>>(
- std::move(parsedTransformModule));
+ // Assemble list of library files.
+ SmallVector<std::string> libraryFileNames;
+ for (const std::string &path : transformLibraryPaths) {
+ auto loc = FileLineColLoc::get(context, transformFileName, 0, 0);
----------------
ingomueller-net wrote:
Good catch! Fixed in latest commit.
https://github.com/llvm/llvm-project/pull/67120
More information about the Mlir-commits
mailing list