From 9faa8b063adcb9dd0f2f4b17cf27cc3d4a402d40 Mon Sep 17 00:00:00 2001 From: Matthias Gehre Date: Fri, 23 Aug 2024 14:23:03 +0200 Subject: [PATCH] Remove unused python module --- python/CMakeLists.txt | 36 -------------- python/XTenModule.cpp | 40 ---------------- python/test/CMakeLists.txt | 29 ------------ python/test/lit.cfg.py | 87 ---------------------------------- python/test/lit.site.cfg.py.in | 58 ----------------------- python/xten/__init__.py | 26 ---------- 6 files changed, 276 deletions(-) delete mode 100644 python/XTenModule.cpp delete mode 100644 python/test/CMakeLists.txt delete mode 100644 python/test/lit.cfg.py delete mode 100644 python/test/lit.site.cfg.py.in delete mode 100644 python/xten/__init__.py diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 40ab85fa..9e86cddc 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -7,42 +7,6 @@ # (c) Copyright 2021 Xilinx, Inc. All Rights reserved. # (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${Python3_INCLUDE_DIRS} - ${pybind11_INCLUDE_DIR} -) -add_library(_xten SHARED - XTenModule.cpp -) -if(MSVC) - target_compile_options(_xten PUBLIC "/EHsc") -endif() - -set_target_properties(_xten PROPERTIES PREFIX "") -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) -get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) - -target_link_libraries(_xten - PRIVATE - XTenTransformPasses - XTenConversionPasses - ${Python3_LIBRARIES} - ${dialect_libs} - ${conversion_libs} - MLIRPass - MLIRIR -) - -install(TARGETS _xten -LIBRARY DESTINATION python COMPONENT python -ARCHIVE DESTINATION python COMPONENT python -RUNTIME DESTINATION bin COMPONENT python) - -install(DIRECTORY xten -DESTINATION python COMPONENT python) - if(MLIR_ENABLE_BINDINGS_PYTHON) include(AddMLIRPython) declare_mlir_python_sources(XTenPythonSources) diff --git a/python/XTenModule.cpp b/python/XTenModule.cpp deleted file mode 100644 index 997905d0..00000000 --- a/python/XTenModule.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===- XTenModule.cpp -------------------------------------------*- C++ -*-===// -// -// This file is licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// - -// (c) Copyright 2021 Xilinx, Inc. All Rights reserved. -// (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. - -// -//===----------------------------------------------------------------------===// - -#include "xten/Transform/Passes.h" -#include "xten/Conversion/Passes.h" - -#include - -#include -#include - -namespace xten { -namespace { - -void InitXTenModuleBindings(pybind11::module m) -{ - m.def("_register_all_passes", []() { - xilinx::xten::registerTransformPasses(); - xilinx::xten::registerConversionPasses(); - }, "register all passes"); - -} - -} // namespace - -void InitXTenBindings(pybind11::module m) { InitXTenModuleBindings(m); } - -} // namespace xten - -PYBIND11_MODULE(_xten, m) { xten::InitXTenBindings(m); } diff --git a/python/test/CMakeLists.txt b/python/test/CMakeLists.txt deleted file mode 100644 index b8d3c38a..00000000 --- a/python/test/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# - -# (c) Copyright 2021 Xilinx, Inc. All Rights reserved. -# (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. - -configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py - MAIN_CONFIG - ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py -) - -set(TEST_DEPENDS - FileCheck count not - _xten - ) - -add_lit_testsuite(check-xten-python "Running the xten-python regression tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${TEST_DEPENDS} - ) -set_target_properties(check-xten-python PROPERTIES FOLDER "Tests") - -add_lit_testsuites(TORCH_MLIR_PYTHON ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${TEST_DEPENDS}) -add_dependencies(check-xten-all check-xten-python) diff --git a/python/test/lit.cfg.py b/python/test/lit.cfg.py deleted file mode 100644 index 4f480da5..00000000 --- a/python/test/lit.cfg.py +++ /dev/null @@ -1,87 +0,0 @@ -# test/lit.cfg.py -*- Python -*- -# -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# - -# (c) Copyright 2021 Xilinx, Inc. All Rights reserved. -# (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. - -import os -import platform -import re -import subprocess -import tempfile - -import lit.formats -import lit.util - -from lit.llvm import llvm_config -from lit.llvm.subst import ToolSubst -from lit.llvm.subst import FindTool - -# Configuration file for the 'lit' test runner. - -# name: The name of this test suite. -config.name = 'XTEN_PYTHON' - -config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell) -config.environment['PYTHONPATH'] \ - = "{}:{}:{}:{}:{}:{}".format( - os.path.join(config.aie_src_root, "python"), - os.path.join(config.aie_obj_root), - os.path.join(config.aie_obj_root, "../npcomp/python"), - os.path.join(config.aie_obj_root, "../peano/python"), - os.path.join(config.aie_src_root, "../air/python"), - os.path.join(config.aie_obj_root, "../air") - ) -#os.environ['PYTHONPATH'] -print("PATH",config.environment['PYTHONPATH']) -if 'TEST_SRC_PATH' in os.environ: - config.environment['TEST_SRC_PATH'] = os.environ['TEST_SRC_PATH'] - -if 'TEST_BUILD_PATH' in os.environ: - config.environment['TEST_BUILD_PATH'] = os.environ['TEST_BUILD_PATH'] -if 'BUILD' in os.environ: - config.environment['BUILD'] = os.environ['BUILD'] - -# suffixes: A list of file extensions to treat as test files. -config.suffixes = ['.py'] - -# test_source_root: The root path where tests are located. -config.test_source_root = os.path.dirname(__file__) - -# test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.aie_obj_root, 'test') - -config.substitutions.append(('%PATH%', config.environment['PATH'])) -config.substitutions.append(('%shlibext', config.llvm_shlib_ext)) -config.substitutions.append(('%PYTHON', config.python_executable)) - - -llvm_config.with_system_environment( - ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP']) - -llvm_config.use_default_substitutions() - -# excludes: A list of directories to exclude from the testsuite. The 'Inputs' -# subdirectories contain auxiliary inputs for various tests in their parent -# directories. -config.excludes = ['Inputs', 'Examples', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt', 'lit.cfg.py'] - -# test_source_root: The root path where tests are located. -config.test_source_root = os.path.dirname(__file__) - -# test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.aie_obj_root, 'test') -config.aie_tools_dir = os.path.join(config.aie_obj_root, 'bin') - -# Tweak the PATH to include the tools dir. -llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True) - -tool_dirs = [config.aie_tools_dir, config.llvm_tools_dir] -tools = [ -] - -llvm_config.add_tool_substitutions(tools, tool_dirs) diff --git a/python/test/lit.site.cfg.py.in b/python/test/lit.site.cfg.py.in deleted file mode 100644 index 9ff829a8..00000000 --- a/python/test/lit.site.cfg.py.in +++ /dev/null @@ -1,58 +0,0 @@ -# -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# - -# (c) Copyright 2021 Xilinx, Inc. All Rights reserved. -# (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. - -@LIT_SITE_CFG_IN_HEADER@ - -import sys - -config.host_triple = "@LLVM_HOST_TRIPLE@" -config.target_triple = "@TARGET_TRIPLE@" -config.llvm_src_root = "@LLVM_SOURCE_DIR@" -config.llvm_obj_root = "@LLVM_BINARY_DIR@" -config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" -config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@" -config.llvm_shlib_dir = "@SHLIBDIR@" -config.llvm_shlib_ext = "@SHLIBEXT@" -config.llvm_exe_ext = "@EXEEXT@" -config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" -config.python_executable = "@Python3_EXECUTABLE@" -config.gold_executable = "@GOLD_EXECUTABLE@" -config.ld64_executable = "@LD64_EXECUTABLE@" -config.enable_shared = @ENABLE_SHARED@ -config.enable_assertions = @ENABLE_ASSERTIONS@ -config.targets_to_build = "@TARGETS_TO_BUILD@" -config.native_target = "@LLVM_NATIVE_ARCH@" -config.llvm_bindings = "@LLVM_BINDINGS@".split(' ') -config.host_os = "@HOST_OS@" -config.host_cc = "@HOST_CC@" -config.host_cxx = "@HOST_CXX@" -# Note: ldflags can contain double-quoted paths, so must use single quotes here. -config.host_ldflags = '@HOST_LDFLAGS@' -config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" -config.llvm_host_triple = '@LLVM_HOST_TRIPLE@' -config.host_arch = "@HOST_ARCH@" -config.aie_src_root = "@CMAKE_SOURCE_DIR@" -config.aie_obj_root = "@CMAKE_BINARY_DIR@" - -# Support substitution of the tools_dir with user parameters. This is -# used when we can't determine the tool dir at configuration time. -try: - config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params - config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params -except KeyError: - e = sys.exc_info()[1] - key, = e.args - lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) - - -import lit.llvm -lit.llvm.initialize(lit_config, config) - -# Let the main config do the real work. -lit_config.load_config(config, "@CMAKE_SOURCE_DIR@/python/test/lit.cfg.py") diff --git a/python/xten/__init__.py b/python/xten/__init__.py deleted file mode 100644 index c8d5b1df..00000000 --- a/python/xten/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# xten/__init__.py -*- Python -*- -# -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# - -# (c) Copyright 2021 Xilinx, Inc. All Rights reserved. -# (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. - -import sys -import json - -def _load_extension(): - import ctypes - flags = sys.getdlopenflags() - sys.setdlopenflags(flags | ctypes.RTLD_GLOBAL) - import _xten - sys.setdlopenflags(flags) - - from mlir._cext_loader import _cext - _cext.globals.append_dialect_search_prefix("acap.dialects") - return _xten - -_cext = _load_extension() -_cext._register_all_passes()