diff --git a/include/mlir-hlo/Dialect/mhlo/IR/CMakeLists.txt b/include/mlir-hlo/Dialect/mhlo/IR/CMakeLists.txt index 1e412f4..8b50b58 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/CMakeLists.txt +++ b/include/mlir-hlo/Dialect/mhlo/IR/CMakeLists.txt @@ -14,7 +14,7 @@ # limitations under the License. # # 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) mlir_tablegen(${dialect}.h.inc -gen-op-decls) 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) endfunction() -add_mlir_hlo_dialect(chlo_ops chlo) +add_mlir_hlo_dialect(chlo_ops) set(LLVM_TARGET_DEFINITIONS hlo_ops.td) 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) add_public_tablegen_target(MLIRhlo_opsIncGen) -set(LLVM_TARGET_DEFINITIONS lhlo_ops.td) -mlir_tablegen(lhlo_ops.h.inc -gen-op-decls) -mlir_tablegen(lhlo_ops.cc.inc -gen-op-defs) -set(LLVM_TARGET_DEFINITIONS lhlo_ops_structs.td) -mlir_tablegen(lhlo_ops_structs.h.inc -gen-struct-attr-decls) -mlir_tablegen(lhlo_ops_structs.cc.inc -gen-struct-attr-defs) -add_public_tablegen_target(MLIRlhlo_opsIncGen) -add_dependencies(mlir-headers MLIRlhlo_opsIncGen) +function(add_mlir_hlo_dialect_separate_files dialect has_enums) + set(LLVM_TARGET_DEFINITIONS ${dialect}.td) + mlir_tablegen(${dialect}.h.inc -gen-op-decls) + mlir_tablegen(${dialect}.cc.inc -gen-op-defs) + set(LLVM_TARGET_DEFINITIONS ${dialect}_structs.td) + mlir_tablegen(${dialect}_structs.h.inc -gen-struct-attr-decls) + mlir_tablegen(${dialect}_structs.cc.inc -gen-struct-attr-defs) + 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) -mlir_tablegen(lhlo_gpu_ops.h.inc -gen-op-decls) -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_hlo_dialect_separate_files(lhlo_ops NO) +add_mlir_hlo_dialect_separate_files(lhlo_gpu_ops YES) add_mlir_interface(infer_fusibility_op_interface) diff --git a/include/mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_enums.h b/include/mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_enums.h index f8c996f..724b413 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_enums.h +++ b/include/mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_enums.h @@ -1,17 +1,17 @@ /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under 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 obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ // This file defines enums used in the LMHLO_GPU dialect. diff --git a/include/mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_structs.h b/include/mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_structs.h index f34dccf..6b94d40 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_structs.h +++ b/include/mlir-hlo/Dialect/mhlo/IR/lhlo_gpu_ops_structs.h @@ -1,22 +1,22 @@ /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under 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 obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ // 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_ -#define 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 TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_LHLO_GPU_OPS_STRUCTS_H_ #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/BuiltinTypes.h" @@ -27,4 +27,4 @@ // #includes above. #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_