[MLIR][HLO] Cleanup CMakeLists and comments.

- Cleanup CMakeLists file to remove unused argument and use a new function for
  setting up lmhlo and lmhlo_gpu dialect targets.
- Fix inconsistently formatted copyright comment and fix header include guards.

PiperOrigin-RevId: 358865838
This commit is contained in:
Rahul Joshi 2021-02-22 11:35:38 -08:00 committed by TensorFlow MLIR Team
parent 5adb7c6e12
commit 0da7ea2545
3 changed files with 48 additions and 50 deletions

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
# #
# Need a separate function because of the .cc vs .cpp used in the one provided by MLIR # Need a separate function because of the .cc vs .cpp used in the one provided by MLIR
function(add_mlir_hlo_dialect dialect dialect_namespace) function(add_mlir_hlo_dialect dialect)
set(LLVM_TARGET_DEFINITIONS ${dialect}.td) set(LLVM_TARGET_DEFINITIONS ${dialect}.td)
mlir_tablegen(${dialect}.h.inc -gen-op-decls) mlir_tablegen(${dialect}.h.inc -gen-op-decls)
mlir_tablegen(${dialect}.cc.inc -gen-op-defs) mlir_tablegen(${dialect}.cc.inc -gen-op-defs)
@ -24,7 +24,7 @@ function(add_mlir_hlo_dialect dialect dialect_namespace)
add_dependencies(mlir-headers MLIR${dialect}IncGen) add_dependencies(mlir-headers MLIR${dialect}IncGen)
endfunction() endfunction()
add_mlir_hlo_dialect(chlo_ops chlo) add_mlir_hlo_dialect(chlo_ops)
set(LLVM_TARGET_DEFINITIONS hlo_ops.td) set(LLVM_TARGET_DEFINITIONS hlo_ops.td)
mlir_tablegen(hlo_ops.h.inc -gen-op-decls) mlir_tablegen(hlo_ops.h.inc -gen-op-decls)
@ -35,25 +35,23 @@ mlir_tablegen(hlo_ops_base_enums.h.inc -gen-enum-decls)
mlir_tablegen(hlo_ops_base_enums.cc.inc -gen-enum-defs) mlir_tablegen(hlo_ops_base_enums.cc.inc -gen-enum-defs)
add_public_tablegen_target(MLIRhlo_opsIncGen) add_public_tablegen_target(MLIRhlo_opsIncGen)
set(LLVM_TARGET_DEFINITIONS lhlo_ops.td) function(add_mlir_hlo_dialect_separate_files dialect has_enums)
mlir_tablegen(lhlo_ops.h.inc -gen-op-decls) set(LLVM_TARGET_DEFINITIONS ${dialect}.td)
mlir_tablegen(lhlo_ops.cc.inc -gen-op-defs) mlir_tablegen(${dialect}.h.inc -gen-op-decls)
set(LLVM_TARGET_DEFINITIONS lhlo_ops_structs.td) mlir_tablegen(${dialect}.cc.inc -gen-op-defs)
mlir_tablegen(lhlo_ops_structs.h.inc -gen-struct-attr-decls) set(LLVM_TARGET_DEFINITIONS ${dialect}_structs.td)
mlir_tablegen(lhlo_ops_structs.cc.inc -gen-struct-attr-defs) mlir_tablegen(${dialect}_structs.h.inc -gen-struct-attr-decls)
add_public_tablegen_target(MLIRlhlo_opsIncGen) mlir_tablegen(${dialect}_structs.cc.inc -gen-struct-attr-defs)
add_dependencies(mlir-headers MLIRlhlo_opsIncGen) if(${has_enums})
set(LLVM_TARGET_DEFINITIONS ${dialect}_enums.td)
mlir_tablegen(${dialect}_enums.h.inc -gen-enum-decls)
mlir_tablegen(${dialect}_enums.cc.inc -gen-enum-defs)
endif()
add_public_tablegen_target(MLIR${dialect}IncGen)
add_dependencies(mlir-headers MLIR${dialect}IncGen)
endfunction()
set(LLVM_TARGET_DEFINITIONS lhlo_gpu_ops.td) add_mlir_hlo_dialect_separate_files(lhlo_ops NO)
mlir_tablegen(lhlo_gpu_ops.h.inc -gen-op-decls) add_mlir_hlo_dialect_separate_files(lhlo_gpu_ops YES)
mlir_tablegen(lhlo_gpu_ops.cc.inc -gen-op-defs)
set(LLVM_TARGET_DEFINITIONS lhlo_gpu_ops_structs.td)
mlir_tablegen(lhlo_gpu_ops_structs.h.inc -gen-struct-attr-decls)
mlir_tablegen(lhlo_gpu_ops_structs.cc.inc -gen-struct-attr-defs)
set(LLVM_TARGET_DEFINITIONS lhlo_gpu_ops_enums.td)
mlir_tablegen(lhlo_gpu_ops_enums.h.inc -gen-enum-decls)
mlir_tablegen(lhlo_gpu_ops_enums.cc.inc -gen-enum-defs)
add_public_tablegen_target(MLIRlhlo_gpu_opsIncGen)
add_dependencies(mlir-headers MLIRlhlo_gpu_opsIncGen)
add_mlir_interface(infer_fusibility_op_interface) add_mlir_interface(infer_fusibility_op_interface)

View File

@ -1,17 +1,17 @@
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
* You may obtain a copy of the License at You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and See the License for the specific language governing permissions and
* limitations under the License. limitations under the License.
* ==============================================================================*/ ==============================================================================*/
// This file defines enums used in the LMHLO_GPU dialect. // This file defines enums used in the LMHLO_GPU dialect.

View File

@ -1,22 +1,22 @@
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
* You may obtain a copy of the License at You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and See the License for the specific language governing permissions and
* limitations under the License. limitations under the License.
* ==============================================================================*/ ==============================================================================*/
// This file defines structures used in the LMHLO_GPU dialect. // This file defines structures used in the LMHLO_GPU dialect.
#ifndef THIRD_PARTY_TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_LHLO_GPU_OPS_STRUCTS_H_ #ifndef TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_LHLO_GPU_OPS_STRUCTS_H_
#define THIRD_PARTY_TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_LHLO_GPU_OPS_STRUCTS_H_ #define TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_LHLO_GPU_OPS_STRUCTS_H_
#include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/BuiltinTypes.h"
@ -27,4 +27,4 @@
// #includes above. // #includes above.
#include "mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_structs.h.inc" #include "mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_structs.h.inc"
#endif // THIRD_PARTY_TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_LHLO_GPU_OPS_STRUCTS_H_ #endif // TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_LHLO_GPU_OPS_STRUCTS_H_