From 6d77d4024e3b579486c751a480abd908f9befe07 Mon Sep 17 00:00:00 2001 From: Tai Ly Date: Mon, 21 Apr 2025 17:14:12 +0000 Subject: [PATCH 1/2] Integrate LLVM at llvm/llvm-project@cbbf562d1c2a --- BUILD.bazel | 410 ++++++------------ WORKSPACE.bazel | 4 +- build_tools/llvm_version.txt | 2 +- stablehlo/conversions/tosa/tests/binary.mlir | 2 +- .../transforms/StablehloLegalizeToTosa.pdll | 2 +- stablehlo/tests/BUILD.bazel | 27 +- 6 files changed, 136 insertions(+), 311 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index cc8519036e..2f6325242c 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -58,16 +58,10 @@ cc_library( gentbl_cc_library( name = "base_attr_interfaces_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-attr-interface-decls"], - "stablehlo/dialect/BaseAttrInterfaces.h.inc", - ), - ( - ["-gen-attr-interface-defs"], - "stablehlo/dialect/BaseAttrInterfaces.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/BaseAttrInterfaces.h.inc": ["-gen-attr-interface-decls"], + "stablehlo/dialect/BaseAttrInterfaces.cpp.inc": ["-gen-attr-interface-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/Base.td", deps = [":stablehlo_ops_td_files"], @@ -107,16 +101,10 @@ cc_library( gentbl_cc_library( name = "chlo_attrs_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-attrdef-decls"], - "stablehlo/dialect/ChloAttrs.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "stablehlo/dialect/ChloAttrs.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/ChloAttrs.h.inc": ["-gen-attrdef-decls"], + "stablehlo/dialect/ChloAttrs.cpp.inc": ["-gen-attrdef-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/ChloOps.td", deps = [ @@ -173,16 +161,10 @@ cc_library( gentbl_cc_library( name = "chlo_enums_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "stablehlo/dialect/ChloEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "stablehlo/dialect/ChloEnums.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/ChloEnums.h.inc": ["-gen-enum-decls"], + "stablehlo/dialect/ChloEnums.cpp.inc": ["-gen-enum-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/ChloOps.td", deps = [ @@ -193,23 +175,14 @@ gentbl_cc_library( gentbl_cc_library( name = "chlo_ops_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-op-decls"], - "stablehlo/dialect/ChloOps.h.inc", - ), - ( - ["-gen-op-defs"], - "stablehlo/dialect/ChloOps.cpp.inc", - ), - ( - [ - "-gen-dialect-doc", - "--dialect=chlo", - ], - "stablehlo/dialect/chlo.md", - ), - ], + tbl_outs = { + "stablehlo/dialect/ChloOps.h.inc": ["-gen-op-decls"], + "stablehlo/dialect/ChloOps.cpp.inc": ["-gen-op-defs"], + "stablehlo/dialect/chlo.md": [ + "-gen-dialect-doc", + "--dialect=chlo", + ], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/ChloOps.td", deps = [ @@ -304,12 +277,7 @@ cc_library( gentbl_cc_library( name = "chlo_rewriters_inc_gen", - tbl_outs = [ - ( - ["--gen-rewriters"], - "stablehlo/transforms/ChloDecompositionPatterns.h.inc", - ), - ], + tbl_outs = {"stablehlo/transforms/ChloDecompositionPatterns.h.inc": ["--gen-rewriters"]}, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/transforms/ChloDecompositionPatterns.td", deps = [ @@ -320,12 +288,7 @@ gentbl_cc_library( gentbl_cc_library( name = "stablehlo_aggressive_simplification_inc_gen", - tbl_outs = [ - ( - ["--gen-rewriters"], - "stablehlo/transforms/optimization/StablehloAggressiveSimplificationPatterns.h.inc", - ), - ], + tbl_outs = {"stablehlo/transforms/optimization/StablehloAggressiveSimplificationPatterns.h.inc": ["--gen-rewriters"]}, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/transforms/optimization/StablehloAggressiveSimplificationPatterns.td", deps = [ @@ -335,12 +298,7 @@ gentbl_cc_library( gentbl_cc_library( name = "stablehlo_legalize_deprecated_ops_inc_gen", - tbl_outs = [ - ( - ["--gen-rewriters"], - "stablehlo/transforms/StablehloLegalizeDeprecatedOpsPatterns.h.inc", - ), - ], + tbl_outs = {"stablehlo/transforms/StablehloLegalizeDeprecatedOpsPatterns.h.inc": ["--gen-rewriters"]}, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/transforms/StablehloLegalizeDeprecatedOpsPatterns.td", deps = [ @@ -350,12 +308,7 @@ gentbl_cc_library( gentbl_cc_library( name = "vhlo_rewriters_inc_gen", - tbl_outs = [ - ( - ["--gen-rewriters"], - "stablehlo/transforms/VhloToVersionPatterns.h.inc", - ), - ], + tbl_outs = {"stablehlo/transforms/VhloToVersionPatterns.h.inc": ["--gen-rewriters"]}, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/transforms/VhloToVersionPatterns.td", deps = [ @@ -365,12 +318,7 @@ gentbl_cc_library( gentbl_cc_library( name = "stablehlo_create_compatibility_expander_inc_gen", - tbl_outs = [ - ( - ["--gen-rewriters"], - "stablehlo/transforms/StablehloCompatibilityExpanderPatterns.h.inc", - ), - ], + tbl_outs = {"stablehlo/transforms/StablehloCompatibilityExpanderPatterns.h.inc": ["--gen-rewriters"]}, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/transforms/StablehloCompatibilityExpanderPatterns.td", deps = [ @@ -380,12 +328,7 @@ gentbl_cc_library( gentbl_cc_library( name = "stablehlo_create_complex_math_expander_inc_gen", - tbl_outs = [ - ( - ["--gen-rewriters"], - "stablehlo/transforms/StablehloComplexMathExpanderPatterns.h.inc", - ), - ], + tbl_outs = {"stablehlo/transforms/StablehloComplexMathExpanderPatterns.h.inc": ["--gen-rewriters"]}, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/transforms/StablehloComplexMathExpanderPatterns.td", deps = [ @@ -420,16 +363,10 @@ cc_library( gentbl_cc_library( name = "interpreter_ops_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-op-decls"], - "stablehlo/reference/InterpreterOps.h.inc", - ), - ( - ["-gen-op-defs"], - "stablehlo/reference/InterpreterOps.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/reference/InterpreterOps.h.inc": ["-gen-op-decls"], + "stablehlo/reference/InterpreterOps.cpp.inc": ["-gen-op-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/reference/InterpreterOps.td", deps = [ @@ -451,21 +388,15 @@ td_library( gentbl_cc_library( name = "interpreter_pass_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=InterpreterTransforms", - ], - "stablehlo/reference/InterpreterPasses.h.inc", - ), - ( - [ - "-gen-pass-doc", - ], - "stablehlo/reference/interpreter_passes.md", - ), - ], + tbl_outs = { + "stablehlo/reference/InterpreterPasses.h.inc": [ + "-gen-pass-decls", + "-name=InterpreterTransforms", + ], + "stablehlo/reference/interpreter_passes.md": [ + "-gen-pass-doc", + ], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/reference/InterpreterPasses.td", deps = ["@llvm-project//mlir:PassBaseTdFiles"], @@ -494,21 +425,15 @@ cc_library( gentbl_cc_library( name = "linalg_pass_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=StablehloLinalgTransforms", - ], - "stablehlo/conversions/linalg/transforms/Passes.h.inc", - ), - ( - [ - "-gen-pass-doc", - ], - "stablehlo/conversions/linalg/transforms/stablehlo_linalg_passes.md", - ), - ], + tbl_outs = { + "stablehlo/conversions/linalg/transforms/Passes.h.inc": [ + "-gen-pass-decls", + "-name=StablehloLinalgTransforms", + ], + "stablehlo/conversions/linalg/transforms/stablehlo_linalg_passes.md": [ + "-gen-pass-doc", + ], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/conversions/linalg/transforms/Passes.td", deps = ["@llvm-project//mlir:PassBaseTdFiles"], @@ -901,16 +826,10 @@ cc_library( gentbl_cc_library( name = "stablehlo_attrs_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-attrdef-decls"], - "stablehlo/dialect/StablehloAttrs.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "stablehlo/dialect/StablehloAttrs.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/StablehloAttrs.h.inc": ["-gen-attrdef-decls"], + "stablehlo/dialect/StablehloAttrs.cpp.inc": ["-gen-attrdef-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/StablehloOps.td", deps = [ @@ -1067,16 +986,10 @@ alias( gentbl_cc_library( name = "stablehlo_enums_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "stablehlo/dialect/StablehloEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "stablehlo/dialect/StablehloEnums.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/StablehloEnums.h.inc": ["-gen-enum-decls"], + "stablehlo/dialect/StablehloEnums.cpp.inc": ["-gen-enum-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/StablehloOps.td", deps = [ @@ -1087,22 +1000,16 @@ gentbl_cc_library( gentbl_cc_library( name = "stablehlo_types_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - [ - "-gen-typedef-decls", - "--typedefs-dialect=stablehlo", - ], - "stablehlo/dialect/StablehloTypeDefs.h.inc", - ), - ( - [ - "-gen-typedef-defs", - "--typedefs-dialect=stablehlo", - ], - "stablehlo/dialect/StablehloTypeDefs.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/StablehloTypeDefs.h.inc": [ + "-gen-typedef-decls", + "--typedefs-dialect=stablehlo", + ], + "stablehlo/dialect/StablehloTypeDefs.cpp.inc": [ + "-gen-typedef-defs", + "--typedefs-dialect=stablehlo", + ], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/StablehloOps.td", deps = [ @@ -1113,16 +1020,10 @@ gentbl_cc_library( gentbl_cc_library( name = "stablehlo_ops_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-op-decls"], - "stablehlo/dialect/StablehloOps.h.inc", - ), - ( - ["-gen-op-defs"], - "stablehlo/dialect/StablehloOps.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/StablehloOps.h.inc": ["-gen-op-decls"], + "stablehlo/dialect/StablehloOps.cpp.inc": ["-gen-op-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/StablehloOps.td", deps = [ @@ -1188,20 +1089,14 @@ td_library( gentbl_cc_library( name = "stablehlo_pass_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - ], - "stablehlo/transforms/Passes.h.inc", - ), - ( - [ - "-gen-pass-doc", - ], - "stablehlo/transforms/stablehlo_passes.md", - ), - ], + tbl_outs = { + "stablehlo/transforms/Passes.h.inc": [ + "-gen-pass-decls", + ], + "stablehlo/transforms/stablehlo_passes.md": [ + "-gen-pass-doc", + ], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/transforms/Passes.td", deps = ["@llvm-project//mlir:PassBaseTdFiles"], @@ -1304,21 +1199,15 @@ cc_library( gentbl_cc_library( name = "stablehlo_passes_optimization_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Optimization", - ], - "stablehlo/transforms/optimization/Passes.h.inc", - ), - ( - [ - "-gen-pass-doc", - ], - "stablehlo/transforms/optimization/stablehlo_optimization_passes.md", - ), - ], + tbl_outs = { + "stablehlo/transforms/optimization/Passes.h.inc": [ + "-gen-pass-decls", + "-name=Optimization", + ], + "stablehlo/transforms/optimization/stablehlo_optimization_passes.md": [ + "-gen-pass-doc", + ], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/transforms/optimization/Passes.td", deps = ["@llvm-project//mlir:PassBaseTdFiles"], @@ -1555,19 +1444,13 @@ cc_binary( gentbl_cc_library( name = "tosa_pass_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=StablehloTOSATransforms", - ], - "stablehlo/conversions/tosa/transforms/Passes.h.inc", - ), - ( - ["-gen-pass-doc"], - "stablehlo/conversions/tosa/transforms/stablehlo_tosa_passes.md", - ), - ], + tbl_outs = { + "stablehlo/conversions/tosa/transforms/Passes.h.inc": [ + "-gen-pass-decls", + "-name=StablehloTOSATransforms", + ], + "stablehlo/conversions/tosa/transforms/stablehlo_tosa_passes.md": ["-gen-pass-doc"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/conversions/tosa/transforms/Passes.td", deps = ["@llvm-project//mlir:PassBaseTdFiles"], @@ -1607,12 +1490,7 @@ cc_library( gentbl_cc_library( name = "tosa_pdll_inc_gen", - tbl_outs = [ - ( - ["-x=cpp"], - "stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.pdll.h.inc", - ), - ], + tbl_outs = {"stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.pdll.h.inc": ["-x=cpp"]}, tblgen = "@llvm-project//mlir:mlir-pdll", td_file = "stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.pdll", deps = [ @@ -1710,16 +1588,10 @@ gentbl_filegroup( gentbl_cc_library( name = "vhlo_attr_interfaces_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-attr-interface-decls"], - "stablehlo/dialect/VhloAttrInterfaces.h.inc", - ), - ( - ["-gen-attr-interface-defs"], - "stablehlo/dialect/VhloAttrInterfaces.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/VhloAttrInterfaces.h.inc": ["-gen-attr-interface-decls"], + "stablehlo/dialect/VhloAttrInterfaces.cpp.inc": ["-gen-attr-interface-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloEnums.td", deps = [ @@ -1730,16 +1602,10 @@ gentbl_cc_library( gentbl_cc_library( name = "vhlo_attrs_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-attrdef-decls"], - "stablehlo/dialect/VhloAttrs.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "stablehlo/dialect/VhloAttrs.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/VhloAttrs.h.inc": ["-gen-attrdef-decls"], + "stablehlo/dialect/VhloAttrs.cpp.inc": ["-gen-attrdef-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloOps.td", deps = [ @@ -1750,16 +1616,10 @@ gentbl_cc_library( gentbl_cc_library( name = "vhlo_enums_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "stablehlo/dialect/VhloEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "stablehlo/dialect/VhloEnums.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/VhloEnums.h.inc": ["-gen-enum-decls"], + "stablehlo/dialect/VhloEnums.cpp.inc": ["-gen-enum-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloEnums.td", deps = [ @@ -1770,16 +1630,10 @@ gentbl_cc_library( gentbl_cc_library( name = "vhlo_op_interfaces_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "stablehlo/dialect/VhloOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "stablehlo/dialect/VhloOpInterfaces.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/VhloOpInterfaces.h.inc": ["-gen-op-interface-decls"], + "stablehlo/dialect/VhloOpInterfaces.cpp.inc": ["-gen-op-interface-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloOps.td", deps = [ @@ -1822,16 +1676,10 @@ cc_library( gentbl_cc_library( name = "vhlo_ops_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-op-decls"], - "stablehlo/dialect/VhloOps.h.inc", - ), - ( - ["-gen-op-defs"], - "stablehlo/dialect/VhloOps.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/VhloOps.h.inc": ["-gen-op-decls"], + "stablehlo/dialect/VhloOps.cpp.inc": ["-gen-op-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloOps.td", deps = [ @@ -1884,16 +1732,10 @@ cc_library( gentbl_cc_library( name = "vhlo_type_interfaces_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-type-interface-decls"], - "stablehlo/dialect/VhloTypeInterfaces.h.inc", - ), - ( - ["-gen-type-interface-defs"], - "stablehlo/dialect/VhloTypeInterfaces.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/VhloTypeInterfaces.h.inc": ["-gen-type-interface-decls"], + "stablehlo/dialect/VhloTypeInterfaces.cpp.inc": ["-gen-type-interface-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloTypes.td", deps = [ @@ -1904,16 +1746,10 @@ gentbl_cc_library( gentbl_cc_library( name = "vhlo_types_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-typedef-decls"], - "stablehlo/dialect/VhloTypeDefs.h.inc", - ), - ( - ["-gen-typedef-defs"], - "stablehlo/dialect/VhloTypeDefs.cpp.inc", - ), - ], + tbl_outs = { + "stablehlo/dialect/VhloTypeDefs.h.inc": ["-gen-typedef-decls"], + "stablehlo/dialect/VhloTypeDefs.cpp.inc": ["-gen-typedef-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloOps.td", deps = [ diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index f5a47d9990..f5deb5691a 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -17,9 +17,9 @@ workspace(name = "stablehlo") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -LLVM_COMMIT = "69f59d59cb02c06f1fac93ea5b19c2df9a684109" +LLVM_COMMIT = "cbbf562d1c2a076de83d50fedfee78acfb4d8003" -LLVM_SHA256 = "2fd8dcec1da1c7166d58918d5f6330856edb37351248a5947661055313bb5d46" +LLVM_SHA256 = "3cc178625e6a7857f6b5b16789cedc7503c06925971183747c8420a142f3d05e" http_archive( name = "llvm-raw", diff --git a/build_tools/llvm_version.txt b/build_tools/llvm_version.txt index 5482e4d512..9d0b02af23 100644 --- a/build_tools/llvm_version.txt +++ b/build_tools/llvm_version.txt @@ -1 +1 @@ -69f59d59cb02c06f1fac93ea5b19c2df9a684109 +cbbf562d1c2a076de83d50fedfee78acfb4d8003 diff --git a/stablehlo/conversions/tosa/tests/binary.mlir b/stablehlo/conversions/tosa/tests/binary.mlir index 60342539ef..71c4392adb 100644 --- a/stablehlo/conversions/tosa/tests/binary.mlir +++ b/stablehlo/conversions/tosa/tests/binary.mlir @@ -45,7 +45,7 @@ func.func @concatenate(%arg0 : tensor<3x3xf32>, %arg1 : tensor<3x3xf32>) -> tens // CHECK-LABEL: @divide func.func @divide(%arg0 : tensor<10xi32>, %arg1 : tensor<10xi32>) -> tensor<10xi32> { - // CHECK: tosa.int_div + // CHECK: tosa.intdiv %0 = "stablehlo.divide"(%arg0, %arg1) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi32> return %0 : tensor<10xi32> } diff --git a/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.pdll b/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.pdll index ef849ab9a0..acbeb94430 100644 --- a/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.pdll +++ b/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.pdll @@ -156,7 +156,7 @@ Pattern => Pattern => replace op(input0 : Value<_: Tosa_Int32Tensor>, input1 : Value<_: Tosa_Int32Tensor>) - with op(input0, input1); + with op(input0, input1); Pattern => replace op(input0 : Value<_: Tosa_Tensor>, input1 : Value<_: Tosa_Tensor>) diff --git a/stablehlo/tests/BUILD.bazel b/stablehlo/tests/BUILD.bazel index 6f9cf340d3..64eb62b1e0 100644 --- a/stablehlo/tests/BUILD.bazel +++ b/stablehlo/tests/BUILD.bazel @@ -51,16 +51,10 @@ cc_library( gentbl_cc_library( name = "check_ops_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - ["-gen-op-decls"], - "CheckOps.h.inc", - ), - ( - ["-gen-op-defs"], - "CheckOps.cpp.inc", - ), - ], + tbl_outs = { + "CheckOps.h.inc": ["-gen-op-decls"], + "CheckOps.cpp.inc": ["-gen-op-defs"], + }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "CheckOps.td", deps = [ @@ -108,15 +102,10 @@ cc_library( gentbl_cc_library( name = "test_utils_inc_gen", strip_include_prefix = ".", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=HloTest", - ], - "TestUtils.h.inc", - ), - ], + tbl_outs = {"TestUtils.h.inc": [ + "-gen-pass-decls", + "-name=HloTest", + ]}, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "TestUtils.td", deps = [ From e10ca4c8be7ed7751769860e86a928db17690abf Mon Sep 17 00:00:00 2001 From: Kevin Gleason Date: Mon, 21 Apr 2025 17:21:34 +0000 Subject: [PATCH 2/2] Buildifier fixes --- BUILD.bazel | 38 ++++++++++++++++++------------------- stablehlo/tests/BUILD.bazel | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 2f6325242c..fdc3dec695 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -59,8 +59,8 @@ gentbl_cc_library( name = "base_attr_interfaces_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/BaseAttrInterfaces.h.inc": ["-gen-attr-interface-decls"], "stablehlo/dialect/BaseAttrInterfaces.cpp.inc": ["-gen-attr-interface-defs"], + "stablehlo/dialect/BaseAttrInterfaces.h.inc": ["-gen-attr-interface-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/Base.td", @@ -102,8 +102,8 @@ gentbl_cc_library( name = "chlo_attrs_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/ChloAttrs.h.inc": ["-gen-attrdef-decls"], "stablehlo/dialect/ChloAttrs.cpp.inc": ["-gen-attrdef-defs"], + "stablehlo/dialect/ChloAttrs.h.inc": ["-gen-attrdef-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/ChloOps.td", @@ -162,8 +162,8 @@ gentbl_cc_library( name = "chlo_enums_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/ChloEnums.h.inc": ["-gen-enum-decls"], "stablehlo/dialect/ChloEnums.cpp.inc": ["-gen-enum-defs"], + "stablehlo/dialect/ChloEnums.h.inc": ["-gen-enum-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/ChloOps.td", @@ -176,8 +176,8 @@ gentbl_cc_library( name = "chlo_ops_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/ChloOps.h.inc": ["-gen-op-decls"], "stablehlo/dialect/ChloOps.cpp.inc": ["-gen-op-defs"], + "stablehlo/dialect/ChloOps.h.inc": ["-gen-op-decls"], "stablehlo/dialect/chlo.md": [ "-gen-dialect-doc", "--dialect=chlo", @@ -364,8 +364,8 @@ gentbl_cc_library( name = "interpreter_ops_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/reference/InterpreterOps.h.inc": ["-gen-op-decls"], "stablehlo/reference/InterpreterOps.cpp.inc": ["-gen-op-defs"], + "stablehlo/reference/InterpreterOps.h.inc": ["-gen-op-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/reference/InterpreterOps.td", @@ -827,8 +827,8 @@ gentbl_cc_library( name = "stablehlo_attrs_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/StablehloAttrs.h.inc": ["-gen-attrdef-decls"], "stablehlo/dialect/StablehloAttrs.cpp.inc": ["-gen-attrdef-defs"], + "stablehlo/dialect/StablehloAttrs.h.inc": ["-gen-attrdef-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/StablehloOps.td", @@ -987,8 +987,8 @@ gentbl_cc_library( name = "stablehlo_enums_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/StablehloEnums.h.inc": ["-gen-enum-decls"], "stablehlo/dialect/StablehloEnums.cpp.inc": ["-gen-enum-defs"], + "stablehlo/dialect/StablehloEnums.h.inc": ["-gen-enum-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/StablehloOps.td", @@ -1001,14 +1001,14 @@ gentbl_cc_library( name = "stablehlo_types_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/StablehloTypeDefs.h.inc": [ - "-gen-typedef-decls", - "--typedefs-dialect=stablehlo", - ], "stablehlo/dialect/StablehloTypeDefs.cpp.inc": [ "-gen-typedef-defs", "--typedefs-dialect=stablehlo", ], + "stablehlo/dialect/StablehloTypeDefs.h.inc": [ + "-gen-typedef-decls", + "--typedefs-dialect=stablehlo", + ], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/StablehloOps.td", @@ -1021,8 +1021,8 @@ gentbl_cc_library( name = "stablehlo_ops_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/StablehloOps.h.inc": ["-gen-op-decls"], "stablehlo/dialect/StablehloOps.cpp.inc": ["-gen-op-defs"], + "stablehlo/dialect/StablehloOps.h.inc": ["-gen-op-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/StablehloOps.td", @@ -1589,8 +1589,8 @@ gentbl_cc_library( name = "vhlo_attr_interfaces_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/VhloAttrInterfaces.h.inc": ["-gen-attr-interface-decls"], "stablehlo/dialect/VhloAttrInterfaces.cpp.inc": ["-gen-attr-interface-defs"], + "stablehlo/dialect/VhloAttrInterfaces.h.inc": ["-gen-attr-interface-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloEnums.td", @@ -1603,8 +1603,8 @@ gentbl_cc_library( name = "vhlo_attrs_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/VhloAttrs.h.inc": ["-gen-attrdef-decls"], "stablehlo/dialect/VhloAttrs.cpp.inc": ["-gen-attrdef-defs"], + "stablehlo/dialect/VhloAttrs.h.inc": ["-gen-attrdef-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloOps.td", @@ -1617,8 +1617,8 @@ gentbl_cc_library( name = "vhlo_enums_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/VhloEnums.h.inc": ["-gen-enum-decls"], "stablehlo/dialect/VhloEnums.cpp.inc": ["-gen-enum-defs"], + "stablehlo/dialect/VhloEnums.h.inc": ["-gen-enum-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloEnums.td", @@ -1631,8 +1631,8 @@ gentbl_cc_library( name = "vhlo_op_interfaces_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/VhloOpInterfaces.h.inc": ["-gen-op-interface-decls"], "stablehlo/dialect/VhloOpInterfaces.cpp.inc": ["-gen-op-interface-defs"], + "stablehlo/dialect/VhloOpInterfaces.h.inc": ["-gen-op-interface-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloOps.td", @@ -1677,8 +1677,8 @@ gentbl_cc_library( name = "vhlo_ops_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/VhloOps.h.inc": ["-gen-op-decls"], "stablehlo/dialect/VhloOps.cpp.inc": ["-gen-op-defs"], + "stablehlo/dialect/VhloOps.h.inc": ["-gen-op-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloOps.td", @@ -1733,8 +1733,8 @@ gentbl_cc_library( name = "vhlo_type_interfaces_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/VhloTypeInterfaces.h.inc": ["-gen-type-interface-decls"], "stablehlo/dialect/VhloTypeInterfaces.cpp.inc": ["-gen-type-interface-defs"], + "stablehlo/dialect/VhloTypeInterfaces.h.inc": ["-gen-type-interface-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloTypes.td", @@ -1747,8 +1747,8 @@ gentbl_cc_library( name = "vhlo_types_inc_gen", strip_include_prefix = ".", tbl_outs = { - "stablehlo/dialect/VhloTypeDefs.h.inc": ["-gen-typedef-decls"], "stablehlo/dialect/VhloTypeDefs.cpp.inc": ["-gen-typedef-defs"], + "stablehlo/dialect/VhloTypeDefs.h.inc": ["-gen-typedef-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "stablehlo/dialect/VhloOps.td", diff --git a/stablehlo/tests/BUILD.bazel b/stablehlo/tests/BUILD.bazel index 64eb62b1e0..a109fea518 100644 --- a/stablehlo/tests/BUILD.bazel +++ b/stablehlo/tests/BUILD.bazel @@ -52,8 +52,8 @@ gentbl_cc_library( name = "check_ops_inc_gen", strip_include_prefix = ".", tbl_outs = { - "CheckOps.h.inc": ["-gen-op-decls"], "CheckOps.cpp.inc": ["-gen-op-defs"], + "CheckOps.h.inc": ["-gen-op-decls"], }, tblgen = "@llvm-project//mlir:mlir-tblgen", td_file = "CheckOps.td",