Skip to content

Commit

Permalink
Dump MLIR only in debug mode (#10422)
Browse files Browse the repository at this point in the history
可以减少一点点编译时间
  • Loading branch information
haoyang9804 authored Jan 28, 2024
1 parent bf9ae02 commit 8f055f3
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,9 @@ LogicalResult ApplyRoundTripPatterns(RoundTripOneFlowJobWrapperInterface& job_wr
if (shouldPrintGraphviz) {
job_wrapper.DumpLog("RoundTripOneFlowJob.optimized.mlir.dot", graphviz);
}
DumpMLIR(job_wrapper, module.get(), "RoundTripOneFlowJob.optimized");
if (::oneflow::ParseBooleanFromEnv("ONEFLOW_MLIR_DUMPMLIR", false)) {
DumpMLIR(job_wrapper, module.get(), "RoundTripOneFlowJob.optimized");
}
return success();
}

Expand Down Expand Up @@ -904,7 +906,9 @@ void RoundTripOneFlowJob(
JobImporter imp(job_wrapper, &context, module.get());
// TODO: Add flag in job desc to decide whether to run mlir optimizer
if (succeeded(imp.ProcessJob())) {
DumpMLIR(job_wrapper, module.get(), "RoundTripOneFlowJob.imported");
if (::oneflow::ParseBooleanFromEnv("ONEFLOW_MLIR_DUMPMLIR", false)) {
DumpMLIR(job_wrapper, module.get(), "RoundTripOneFlowJob.imported");
}
if (failed(ApplyRoundTripPatterns(job_wrapper, &context, module))) { exit(EXIT_FAILURE); }
if (::oneflow::ParseBooleanFromEnv("ONEFLOW_MLIR_STDOUT", false)
&& job_wrapper.IsLastIRPass()) {
Expand Down

0 comments on commit 8f055f3

Please sign in to comment.