MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ExperimentalRunPassPipeline

Function ExperimentalRunPassPipeline

tensorflow/compiler/mlir/python/mlir.cc:124–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124std::string ExperimentalRunPassPipeline(const std::string &mlir_txt,
125 const std::string &pass_pipeline,
126 bool show_debug_info,
127 TF_Status *status) {
128 mlir::MLIRContext context;
129 mlir::OwningModuleRef module;
130 {
131 mlir::StatusScopedDiagnosticHandler diagnostic_handler(&context);
132 module = mlir::parseSourceString(mlir_txt, &context);
133 if (!module) {
134 Set_TF_Status_from_Status(status, diagnostic_handler.ConsumeStatus());
135 return "// error";
136 }
137 }
138
139 // Run the pass_pipeline on the module.
140 mlir::PassManager pm(&context);
141 std::string error;
142 llvm::raw_string_ostream error_stream(error);
143 if (failed(mlir::parsePassPipeline(pass_pipeline, pm, error_stream))) {
144 TF_SetStatus(status, TF_INVALID_ARGUMENT,
145 ("Invalid pass_pipeline: " + error_stream.str()).c_str());
146 return "// error";
147 }
148
149 mlir::StatusScopedDiagnosticHandler diagnostic_handler(&context);
150 if (failed(pm.run(*module))) {
151 Set_TF_Status_from_Status(status, diagnostic_handler.ConsumeStatus());
152 return "// error";
153 }
154 return MlirModuleToString(*module, show_debug_info);
155}
156
157} // namespace tensorflow

Callers

nothing calls this directly

Calls 6

TF_SetStatusFunction · 0.85
MlirModuleToStringFunction · 0.85
ConsumeStatusMethod · 0.80
c_strMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected