Prune unused code from bazel_to_cmake. (#9188)
History, thanks to `git log -S [search_string]`:
* `iree_e2e_cartesian_product_test_suite` was replaced with other test suites in https://github.com/google/iree/pull/8078
* `spirv_kernel_cc_library` is unused since https://github.com/google/iree/pull/1533
* `MLIRExecutionEngine` is unused since https://github.com/google/iree/commit/49dc151dd5539197f4a8174992c508cbb3a78af6
diff --git a/build_tools/bazel_to_cmake/bazel_to_cmake_converter.py b/build_tools/bazel_to_cmake/bazel_to_cmake_converter.py
index d988040..3ee6f8a 100644
--- a/build_tools/bazel_to_cmake/bazel_to_cmake_converter.py
+++ b/build_tools/bazel_to_cmake/bazel_to_cmake_converter.py
@@ -162,28 +162,6 @@
return _convert_string_list_block(list_name, targets, sort=True, quote=False)
-# Copied from integrations/tensorflow/e2e/iree_e2e_cartesian_product_test_suite.bzl
-def _normalize_dictionary(dictionary):
- """Wraps every value of dictionary in a list if it isn't one already."""
- for key, value in dictionary.items():
- if type(value) != type([]):
- dictionary[key] = [value]
- return dictionary
-
-
-def _dictionary_product(dictionary):
- """Returns a named cartesian product of dictionary's values."""
-
- # Converts {'a': [1, 2], 'b': [3, 4]} into
- # [{'a': 1, 'b': 3}, {'a': 1, 'b': 4}, {'a': 2, 'b': 3}, {'a': 2, 'b': 4}]
- product = [[]]
- for values in dictionary.values():
- # Iteratively grow the elements of the product.
- product = [element + [value] for element in product for value in values]
- dicts = [{k: v for k, v in zip(dictionary, element)} for element in product]
- return dicts
-
-
class BuildFileFunctions(object):
"""Object passed to `exec` that has handlers for BUILD file functions."""
@@ -439,15 +417,6 @@
f"{flatten_block}"
f" PUBLIC\n)\n\n")
- def spirv_kernel_cc_library(self, name, srcs):
- name_block = _convert_string_arg_block("NAME", name, quote=False)
- srcs_block = _convert_srcs_block(srcs)
-
- self.converter.body += (f"iree_spirv_kernel_cc_library(\n"
- f"{name_block}"
- f"{srcs_block}"
- f")\n\n")
-
def iree_bytecode_module(self,
name,
src,
@@ -677,64 +646,6 @@
f"{target_cpu_features_variants_block}"
f")\n\n")
- def iree_e2e_cartesian_product_test_suite(self,
- name,
- matrix,
- failing_configurations=None,
- tags=None,
- data=None,
- **kwargs):
- # Note kwargs deps, size, python_version are unused
- if data is not None:
- self._convert_unimplemented_function(
- "iree_e2e_cartesian_product_test_suite", name + " has data")
-
- matrix_keys = matrix.keys()
-
- name_block = _convert_string_arg_block("NAME", name, quote=False)
- matrix_keys_block = _convert_string_list_block("MATRIX_KEYS", matrix_keys)
- labels_block = _convert_string_list_block("LABELS", tags)
-
- value_strings = []
- for key in matrix_keys:
- # ensure matching order
- values = matrix[key]
- if not isinstance(values, list):
- values = [values]
- if not values:
- self._convert_unimplemented_function(
- "iree_e2e_cartesian_product_test_suite",
- name + f" has empty list for matrix key {key}")
- value_strings.append(";".join(str(value) for value in values))
- matrix_values_block = _convert_string_list_block("MATRIX_VALUES",
- value_strings)
-
- # Copied from integrations/tensorflow/e2e/iree_e2e_cartesian_product_test_suite.bzl
- failing_configurations_block = ""
- if failing_configurations is not None:
- failing_matrix_configurations = []
- for failing_configuration in failing_configurations:
- failing_configuration = _normalize_dictionary(failing_configuration)
-
- failing_matrix_configurations.extend(
- _dictionary_product(failing_configuration))
-
- failing_configuration_strings = []
- for failing_configuration in failing_matrix_configurations:
- failing_config_string = ",".join(
- str(failing_configuration.get(key, "")) for key in matrix_keys)
- failing_configuration_strings.append(failing_config_string)
- failing_configurations_block = _convert_string_list_block(
- "FAILING_CONFIGURATIONS", failing_configuration_strings)
-
- self.converter.body += (f"iree_e2e_cartesian_product_test_suite(\n"
- f"{name_block}"
- f"{matrix_keys_block}"
- f"{matrix_values_block}"
- f"{failing_configurations_block}"
- f"{labels_block}"
- f")\n\n")
-
def native_test(self, name, src, args=None, data=None, tags=None):
if data is not None:
self._convert_unimplemented_function("native_test", name + " has data")
diff --git a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
index 8554c89..df73456 100644
--- a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
+++ b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
@@ -45,7 +45,6 @@
"@llvm-project//mlir:CFGTransforms": ["MLIRSCFToControlFlow"],
"@llvm-project//mlir:ComplexDialect": ["MLIRComplex"],
"@llvm-project//mlir:DialectUtils": [""],
- "@llvm-project//mlir:ExecutionEngineUtils": ["MLIRExecutionEngine"],
"@llvm-project//mlir:GPUDialect": ["MLIRGPUOps"],
"@llvm-project//mlir:GPUTransforms": ["MLIRGPUTransforms"],
"@llvm-project//mlir:LinalgInterfaces": ["MLIRLinalg"],
@@ -67,7 +66,6 @@
"@llvm-project//mlir:SPIRVDialect": ["MLIRSPIRV"],
"@llvm-project//mlir:TosaDialect": ["MLIRTosa"],
"@llvm-project//mlir:ToLLVMIRTranslation": ["MLIRTargetLLVMIRExport"],
- "@llvm-project//mlir:mlir_c_runner_utils": ["MLIRExecutionEngine"],
"@llvm-project//mlir:mlir-translate": ["mlir-translate"],
"@llvm-project//mlir:MlirTableGenMain": ["MLIRTableGen"],
"@llvm-project//mlir:MlirOptLib": ["MLIROptLib"],