MLIR 22.0.0git
PreloadLibraryPass.cpp
Go to the documentation of this file.
1//===- PreloadLibraryPass.cpp - Pass to preload a transform library -------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
12
13using namespace mlir;
14
15namespace mlir {
16namespace transform {
17#define GEN_PASS_DEF_PRELOADLIBRARYPASS
18#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
19} // namespace transform
20} // namespace mlir
21
22namespace {
23class PreloadLibraryPass
24 : public transform::impl::PreloadLibraryPassBase<PreloadLibraryPass> {
25public:
26 using Base::Base;
27
28 void runOnOperation() override {
29 OwningOpRef<ModuleOp> mergedParsedLibraries;
31 &getContext(), transformLibraryPaths, mergedParsedLibraries)))
32 return signalPassFailure();
33 // TODO: investigate using a resource blob if some ownership mode allows it.
34 auto *dialect =
35 getContext().getOrLoadDialect<transform::TransformDialect>();
36 if (failed(
37 dialect->loadIntoLibraryModule(std::move(mergedParsedLibraries))))
38 signalPassFailure();
39 }
40};
41} // namespace
b getContext())
detail::InFlightRemark failed(Location loc, RemarkOpts opts)
Report an optimization remark that failed.
Definition Remarks.h:561
LogicalResult assembleTransformLibraryFromPaths(MLIRContext *context, ArrayRef< std::string > transformLibraryPaths, OwningOpRef< ModuleOp > &transformModule)
Utility to parse, verify, aggregate and link the content of all mlir files nested under transformLibr...
Include the generated interface declarations.