• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/GPU/ParallelLoopMapper.h"  // from @llvm-project
17 #include "tensorflow/compiler/mlir/tools/kernel_gen/transforms/passes.h"
18 
19 namespace mlir {
20 namespace kernel_gen {
21 namespace transforms {
22 namespace {
23 
24 #define GEN_PASS_CLASSES
25 #include "tensorflow/compiler/mlir/tools/kernel_gen/transforms/kernel_gen_passes.h.inc"
26 
27 struct MapParallelLoopsPass : MapParallelLoopsPassBase<MapParallelLoopsPass> {
runOnFunctionmlir::kernel_gen::transforms::__anon664a39470111::MapParallelLoopsPass28   void runOnFunction() override {
29     mlir::greedilyMapParallelSCFToGPU(getFunction().getBody());
30   }
31 };
32 
33 }  // namespace
34 
CreateMapParallelLoopsPass()35 std::unique_ptr<mlir::FunctionPass> CreateMapParallelLoopsPass() {
36   return std::make_unique<MapParallelLoopsPass>();
37 }
38 
39 }  // namespace transforms
40 }  // namespace kernel_gen
41 }  // namespace mlir
42