1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #include "mlir/Dialect/SCF/SCF.h" // from @llvm-project 17 #include "mlir/Dialect/SCF/Transforms.h" // from @llvm-project 18 #include "tensorflow/compiler/mlir/tools/kernel_gen/transforms/passes.h" 19 20 namespace mlir { 21 namespace kernel_gen { 22 namespace transforms { 23 namespace { 24 25 #define GEN_PASS_CLASSES 26 #include "tensorflow/compiler/mlir/tools/kernel_gen/transforms/kernel_gen_passes.h.inc" 27 28 struct FuseInnerParallelLoopsPass 29 : FuseInnerParallelLoopsPassBase<FuseInnerParallelLoopsPass> { runOnFunctionmlir::kernel_gen::transforms::__anon1a0630c00111::FuseInnerParallelLoopsPass30 void runOnFunction() override { 31 getFunction().walk([](mlir::scf::ParallelOp op) { 32 mlir::scf::naivelyFuseParallelOps(op.region()); 33 }); 34 } 35 }; 36 37 } // namespace 38 CreateFuseInnerParallelLoopsPass()39std::unique_ptr<mlir::FunctionPass> CreateFuseInnerParallelLoopsPass() { 40 return std::make_unique<FuseInnerParallelLoopsPass>(); 41 } 42 43 } // namespace transforms 44 } // namespace kernel_gen 45 } // namespace mlir 46