This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch refactor
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 93d086f69410a13b850d0c9761f6bb9ec9abdc89
Author: Siyuan Feng <[email protected]>
AuthorDate: Mon Feb 17 14:21:44 2025 +0800

    remove vitis ai
---
 CMakeLists.txt                                   |   2 -
 cmake/config.cmake                               |   9 -
 cmake/modules/LibInfo.cmake                      |   1 -
 cmake/modules/contrib/VitisAI.cmake              |  47 -----
 docker/Dockerfile.ci_cpu                         |   4 -
 docker/Dockerfile.demo_vitis_ai                  |  59 ------
 docker/bash.sh                                   |  21 ---
 docker/install/ubuntu_install_vitis_ai_core.sh   |  39 ----
 python/gen_requirements.py                       |  11 --
 python/tvm/contrib/target/vitis_ai.py            | 220 -----------------------
 python/tvm/testing/utils.py                      |   4 -
 rust/tvm-rt/Cargo.toml                           |   1 -
 rust/tvm-sys/Cargo.toml                          |   1 -
 rust/tvm-sys/build.rs                            |   3 -
 src/runtime/contrib/vitis_ai/vitis_ai_runtime.cc | 195 --------------------
 src/runtime/contrib/vitis_ai/vitis_ai_runtime.h  | 120 -------------
 src/support/libinfo.cc                           |   1 -
 tests/scripts/task_config_build_cpu.sh           |   1 -
 18 files changed, 739 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb8039a264..5a7e1241d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -116,7 +116,6 @@ tvm_option(USE_TENSORRT_RUNTIME "Build with TensorRT 
runtime" OFF)
 tvm_option(USE_NNAPI_CODEGEN "Build with NNAPI Codegen support" OFF)
 tvm_option(USE_NNAPI_RUNTIME "Build with NNAPI runtime" OFF)
 tvm_option(USE_RUST_EXT "Build with Rust based compiler extensions, STATIC, 
DYNAMIC, or OFF" OFF)
-tvm_option(USE_VITIS_AI "Build with VITIS-AI Codegen support" OFF)
 tvm_option(SUMMARIZE "Print CMake option summary after configuring" OFF)
 tvm_option(USE_CLML "Build with CLML Codegen support" OFF)
 tvm_option(USE_CLML_GRAPH_EXECUTOR "Build with CLML graph runtime" OFF)
@@ -500,7 +499,6 @@ include(cmake/modules/contrib/ONNX.cmake)
 include(cmake/modules/contrib/ArmComputeLib.cmake)
 include(cmake/modules/contrib/TensorRT.cmake)
 include(cmake/modules/contrib/NNAPI.cmake)
-include(cmake/modules/contrib/VitisAI.cmake)
 include(cmake/modules/contrib/Verilator.cmake)
 include(cmake/modules/contrib/UMA.cmake)
 include(cmake/modules/contrib/MSC.cmake)
diff --git a/cmake/config.cmake b/cmake/config.cmake
index 791751ac98..e5f85380d2 100644
--- a/cmake/config.cmake
+++ b/cmake/config.cmake
@@ -138,12 +138,6 @@ set(USE_IOS_RPC OFF)
 # Whether embed stackvm into the runtime
 set(USE_STACKVM_RUNTIME OFF)
 
-# Whether enable tiny embedded graph executor.
-set(USE_GRAPH_EXECUTOR ON)
-
-# Whether enable tiny graph executor with CUDA Graph
-set(USE_GRAPH_EXECUTOR_CUDA_GRAPH OFF)
-
 # Whether enable pipeline executor.
 set(USE_PIPELINE_EXECUTOR OFF)
 
@@ -285,9 +279,6 @@ set(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR OFF)
 set(USE_TENSORRT_CODEGEN OFF)
 set(USE_TENSORRT_RUNTIME OFF)
 
-# Whether use VITIS-AI codegen
-set(USE_VITIS_AI OFF)
-
 # Build Verilator codegen and runtime
 set(USE_VERILATOR OFF)
 
diff --git a/cmake/modules/LibInfo.cmake b/cmake/modules/LibInfo.cmake
index cfea9b20d8..70ae86fc79 100644
--- a/cmake/modules/LibInfo.cmake
+++ b/cmake/modules/LibInfo.cmake
@@ -123,7 +123,6 @@ function(add_lib_info src_file)
     TVM_INFO_USE_THREADS="${USE_THREADS}"
     TVM_INFO_USE_THRUST="${USE_THRUST}"
     TVM_INFO_USE_CURAND="${USE_CURAND}"
-    TVM_INFO_USE_VITIS_AI="${USE_VITIS_AI}"
     TVM_INFO_USE_VULKAN="${USE_VULKAN}"
     TVM_INFO_USE_CLML="${USE_CLML}"
     TVM_INFO_USE_CLML_GRAPH_EXECUTOR="${USE_CLML_GRAPH_EXECUTOR}"
diff --git a/cmake/modules/contrib/VitisAI.cmake 
b/cmake/modules/contrib/VitisAI.cmake
deleted file mode 100644
index 5fd07dc2e9..0000000000
--- a/cmake/modules/contrib/VitisAI.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-
-if(USE_VITIS_AI)
-  set(PYXIR_SHARED_LIB libpyxir.so)
-  find_package(PythonInterp 3.7 REQUIRED)
-  if(NOT PYTHON)
-    find_program(PYTHON NAMES python3 python3.8)
-  endif()
-  execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
-    "import pyxir as px; print(px.get_include_dir()); print(px.get_lib_dir());"
-    RESULT_VARIABLE __result
-    OUTPUT_VARIABLE __output
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-  if(__result MATCHES 0)
-    string(REGEX REPLACE ";" "\\\\;" __values ${__output})
-    string(REGEX REPLACE "\r?\n" ";"    __values ${__values})
-    list(GET __values 0 PYXIR_INCLUDE_DIR)
-    list(GET __values 1 PYXIR_LIB_DIR)
-  else()
-    message(FATAL_ERROR "Can't build TVM with Vitis-AI because PyXIR can't be 
found")
-  endif()
-  message(STATUS "Build with contrib.vitisai")
-  include_directories(${PYXIR_INCLUDE_DIR})
-  tvm_file_glob(GLOB VAI_CONTRIB_SRC src/runtime/contrib/vitis_ai/*.cc)
-  tvm_file_glob(GLOB COMPILER_VITIS_AI_SRCS
-                src/relay/backend/contrib/vitis_ai/*)
-  list(APPEND COMPILER_SRCS ${COMPILER_VITIS_AI_SRCS})
-  link_directories(${PYXIR_LIB_DIR})
-  list(APPEND TVM_RUNTIME_LINKER_LIBS "pyxir")
-  list(APPEND RUNTIME_SRCS ${VAI_CONTRIB_SRC})
-endif(USE_VITIS_AI)
diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu
index d41a7e6e1b..5ba1dd7214 100644
--- a/docker/Dockerfile.ci_cpu
+++ b/docker/Dockerfile.ci_cpu
@@ -101,10 +101,6 @@ RUN bash /install/ubuntu_install_jax.sh "cpu"
 COPY install/ubuntu_download_arm_compute_lib_binaries.sh 
/install/ubuntu_download_arm_compute_lib_binaries.sh
 RUN bash /install/ubuntu_download_arm_compute_lib_binaries.sh
 
-# Vitis-AI PyXIR CI deps
-COPY install/ubuntu_install_vitis_ai_packages_ci.sh 
/install/ubuntu_install_vitis_ai_packages_ci.sh
-RUN bash /install/ubuntu_install_vitis_ai_packages_ci.sh
-
 # PaddlePaddle deps
 COPY install/ubuntu_install_paddle.sh /install/ubuntu_install_paddle.sh
 RUN bash /install/ubuntu_install_paddle.sh
diff --git a/docker/Dockerfile.demo_vitis_ai b/docker/Dockerfile.demo_vitis_ai
deleted file mode 100644
index 8cafc653fb..0000000000
--- a/docker/Dockerfile.demo_vitis_ai
+++ /dev/null
@@ -1,59 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-
-# Main Vitis AI docker env
-FROM xilinx/vitis-ai:1.4.916
-
-COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
-
-RUN apt-get update --fix-missing
-
-COPY install/ubuntu_setup_tz.sh /install/ubuntu_setup_tz.sh
-RUN bash /install/ubuntu_setup_tz.sh
-
-COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
-RUN bash /install/ubuntu_install_core.sh
-
-# Install Vitis-AI ubuntu dependencies
-COPY install/ubuntu_install_vitis_ai_core.sh 
/install/ubuntu_install_vitis_ai_core.sh
-RUN bash /install/ubuntu_install_vitis_ai_core.sh
-
-ENV TVM_VENV /venv/apache-tvm-py3.9
-COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
-RUN bash /install/ubuntu_install_python.sh 3.9
-ENV PATH ${TVM_VENV}/bin:$PATH
-ENV PYTHONNOUSERSITE 1  # Disable .local directory from affecting CI.
-
-COPY install/ubuntu_install_python_package.sh 
/install/ubuntu_install_python_package.sh
-RUN bash /install/ubuntu_install_python_package.sh
-
-COPY install/ubuntu_install_llvm.sh /install/ubuntu_install_llvm.sh
-RUN bash /install/ubuntu_install_llvm.sh
-
-ENV PATH $PATH:$CARGO_HOME/bin:/usr/lib/go-1.10/bin
-
-# ANTLR deps
-COPY install/ubuntu_install_java.sh /install/ubuntu_install_java.sh
-RUN bash /install/ubuntu_install_java.sh
-
-# Install dependencies inside vitis-ai-tensorflow conda
-RUN . $VAI_ROOT/conda/etc/profile.d/conda.sh && \
-    conda activate vitis-ai-tensorflow && \
-    pip install --no-cache-dir antlr4-python3-runtime && bash 
/install/ubuntu_install_python_package.sh
-
-ENV USER="root"
diff --git a/docker/bash.sh b/docker/bash.sh
index f83becbf61..5303aadb94 100755
--- a/docker/bash.sh
+++ b/docker/bash.sh
@@ -460,27 +460,6 @@ if [[ "${DOCKER_IMAGE_NAME}" == *"ci"* ]]; then
     DOCKER_ENV+=( --env PYTHONPATH="${REPO_MOUNT_POINT}"/python )
 fi
 
-
-
-# If the Vitis-AI docker image is selected, expose the Xilinx FPGA
-# devices and required volumes containing e.g. DSA's and overlays
-if [[ "${DOCKER_IMAGE_NAME}" == *"demo_vitis_ai"* && -d "/dev/shm" && -d 
"/opt/xilinx/dsa" && -d "/opt/xilinx/overlaybins" ]]; then
-    DOCKER_MOUNT+=( --volume /dev/shm:/dev/shm
-                    --volume /opt/xilinx/dsa:/opt/xilinx/dsa
-                    --volume /opt/xilinx/overlaybins:/opt/xilinx/overlaybins
-                  )
-
-    XCLMGMT_DRIVER="$(find /dev -name xclmgmt\*)"
-    for DRIVER in "${XCLMGMT_DRIVER}"; do
-       DOCKER_DEVICES+=( --device="${DRIVER}" )
-    done
-
-    RENDER_DRIVER="$(find /dev/dri -name renderD\*)"
-    for DRIVER in "${RENDER_DRIVER}"; do
-        DOCKER_DEVICES+=( --device="${DRIVER}" )
-    done
-fi
-
 # Add ROCm devices and set ROCM_ENABLED=1 which is used in the 
with_the_same_user script
 # to add the user to the video group
 if [[ "${DOCKER_IMAGE_NAME}" == *"rocm"* && -d "/dev/dri" ]]; then
diff --git a/docker/install/ubuntu_install_vitis_ai_core.sh 
b/docker/install/ubuntu_install_vitis_ai_core.sh
deleted file mode 100755
index 2e395b45da..0000000000
--- a/docker/install/ubuntu_install_vitis_ai_core.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-
-set -e
-set -u
-set -o pipefail
-
-export PYXIR_HOME=/opt/pyxir
-mkdir "$PYXIR_HOME"
-
-# install libraries for building Vitis-AI on ubuntu
-apt-get update && apt-install-and-clear -y \
-    graphviz \
-    gnupg2 \
-    gpg-agent \
-    gcc-aarch64-linux-gnu
-
-
-. $VAI_ROOT/conda/etc/profile.d/conda.sh
-conda activate vitis-ai-tensorflow
-pip3 install progressbar h5py==2.10.0
-
-git clone --recursive --branch rel-v0.3.1 --depth 1 
https://github.com/Xilinx/pyxir.git "${PYXIR_HOME}"
-cd "${PYXIR_HOME}" && python3 setup.py install --use_vart_cloud_dpu 
--use_dpuczdx8g_vart
diff --git a/python/gen_requirements.py b/python/gen_requirements.py
index d22544db48..aafa35d08f 100644
--- a/python/gen_requirements.py
+++ b/python/gen_requirements.py
@@ -170,17 +170,6 @@ REQUIREMENTS_BY_PIECE: RequirementsByPieceType = [
             ],
         ),
     ),
-    # Vitis AI requirements
-    (
-        "vitis-ai",
-        (
-            "Requirements for the Vitis AI codegen",
-            [
-                "h5py",
-                "progressbar",
-            ],
-        ),
-    ),
     # XGBoost, useful for autotuning on some targets.
     (
         "xgboost",
diff --git a/python/tvm/contrib/target/vitis_ai.py 
b/python/tvm/contrib/target/vitis_ai.py
deleted file mode 100644
index 1ab52ed724..0000000000
--- a/python/tvm/contrib/target/vitis_ai.py
+++ /dev/null
@@ -1,220 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-# pylint: disable=invalid-name, unused-argument, import-outside-toplevel
-
-"""Utility to offload (sub-)models to Vitis-AI"""
-
-import warnings
-import importlib
-
-from tvm.relay.expr import Tuple, Call, TupleGetItem
-import tvm._ffi
-
-# Placeholder for PyXIR module
-pyxir = None
-
-
-def vitis_ai_available():
-    """Return whether Vitis AI tools are available"""
-    pyxir_spec = importlib.util.find_spec("pyxir")
-    if not tvm.get_global_func("tvm.vitis_ai_runtime.from_xgraph", True) or 
pyxir_spec is None:
-        return False
-    return True
-
-
-class CodegenVitisAI:
-
-    """Traverse Relay expression and convert into PyXIR XGraph format
-
-    Parameters
-    ----------
-    function : Function
-        The Relay function
-    dpu_target : str
-        The Vitis AI DPU target identifier
-    """
-
-    def __init__(self, function, dpu_target):
-        global pyxir
-        try:
-            if pyxir is None:
-                pyxir = __import__("pyxir")
-                __import__("pyxir.frontend.tvm")
-        except ImportError:
-            # add "from None" to silence
-            # "During handling of the above exception, another exception 
occurred"
-            raise ImportError(
-                "The pyxir package is required for the Vitis AI backend. "
-                "Please install it first. "
-                "Help: (https://tvm.apache.org/docs/deploy/vitis_ai.html) "
-            ) from None
-
-        self.function = function
-        self.dpu_target = dpu_target
-        self.params = {}
-
-    def build(self):
-        """ "Convert the Relay expression to a PyXIR XGraph to instantiate
-        the Vitis AI runtime
-
-        Returns
-        -------
-        xgraph_str : str
-            Serialized XGraph
-        """
-        xgraph = pyxir.frontend.tvm.from_relay(
-            self.function, params=self.params, postprocessing=None
-        )
-        xgraph = pyxir.partition(xgraph, targets=[self.dpu_target])
-        output_relay_ids = self.get_output_names()
-        layers = xgraph.get_layers()
-
-        # Get the output tensor names using XGraph and output Relay ids
-        out_tensor_names = ["unknown_name"] * len(output_relay_ids)
-        for layer in layers:
-            if not layer.internal:
-                for relay_id in layer.attrs["relay_id"]:
-                    if relay_id in output_relay_ids:
-                        out_tensor_names[output_relay_ids.index(relay_id)] = 
layer.name
-                        break
-        if any([name == "unkown_name" for name in out_tensor_names]):
-            raise ValueError(
-                "During codegeneration the loading of subexpression"
-                " failed due to output tensor name mismatch in Relay PyXIR 
interface."
-            )
-        xgraph.meta_attrs["tvm_out_tensors"] = out_tensor_names
-        xgraph_str = pyxir.get_xgraph_str(xgraph)
-        return xgraph_str
-
-    def get_output_names(self):
-        """Get output names from Relay expression"""
-        func = self.function
-        output_relay_ids = []
-        expr = func.body
-        if isinstance(expr, Tuple):
-            for field in expr.fields:
-                output_relay_ids.append(hash(field))
-        elif isinstance(expr, Call):
-            output_relay_ids.append(hash(expr))
-        elif isinstance(expr, TupleGetItem):
-            output_relay_ids.append(hash(expr.tuple_value))
-        else:
-            raise ValueError(f"Vitis-AI codegen does not support {type(expr)} 
as output")
-        return output_relay_ids
-
-
-@tvm._ffi.register_func("relay.ext.vitis_ai")
-def vitis_ai_compiler(ref):
-    """Create a Vitis-AI runtime from the provided Relay expression"""
-    assert isinstance(ref, tvm.relay.function.Function)
-
-    name = str(ref.attrs.global_symbol)
-
-    pass_context = tvm.get_global_func("transform.GetCurrentPassContext")()
-
-    cfg = (
-        pass_context.config["relay.ext.vitis_ai.options"]
-        if "relay.ext.vitis_ai.options" in pass_context.config
-        else None
-    )
-
-    # Backward compatibility with old pass context configs
-    if cfg is None:
-        warnings.warn(
-            "You are using a deprecated way of passing build configs (e.g."
-            " `relay.ext.vitis_ai.options.target`). Check out the Vitis AI "
-            " documentation here: 
https://tvm.apache.org/docs/deploy/vitis_ai.html";
-            " to switch to recommended way for passing build configs."
-        )
-
-        # The target Vitis-AI accelerator device
-        dpu_target = (
-            str(pass_context.config["relay.ext.vitis_ai.options.target"])
-            if "relay.ext.vitis_ai.options.target" in pass_context.config
-            else None
-        )
-
-        # (Optional configs) The build and work directories to be used by 
Vitis-AI
-        vai_build_dir = (
-            str(pass_context.config["relay.ext.vitis_ai.options.build_dir"])
-            if "relay.ext.vitis_ai.options.build_dir" in pass_context.config
-            else tvm.contrib.utils.tempdir().relpath("")
-        )
-        vai_work_dir = (
-            str(pass_context.config["relay.ext.vitis_ai.options.work_dir"])
-            if "relay.ext.vitis_ai.options.work_dir" in pass_context.config
-            else tvm.contrib.utils.tempdir().relpath("")
-        )
-
-        # (Optional configs) Export and load PyXIR runtime module to file if 
provided. This is
-        #   used to compile and quantize a model on the host and deploy it at 
the edge
-        export_runtime_module = (
-            
str(pass_context.config["relay.ext.vitis_ai.options.export_runtime_module"])
-            if "relay.ext.vitis_ai.options.export_runtime_module" in 
pass_context.config
-            else ""
-        )
-        load_runtime_module = (
-            
str(pass_context.config["relay.ext.vitis_ai.options.load_runtime_module"])
-            if "relay.ext.vitis_ai.options.load_runtime_module" in 
pass_context.config
-            else ""
-        )
-    else:
-        dpu_target = cfg.dpu if cfg.dpu else None
-        # (Optional configs) The build and work directories to be used by 
Vitis AI
-        vai_build_dir = cfg.build_dir if cfg.build_dir else 
tvm.contrib.utils.tempdir().relpath("")
-
-        # (Optional configs) Export and load PyXIR runtime module to file if 
provided. This is
-        #   used to compile and quantize a model on the host and deploy it at 
the edge
-        vai_work_dir = cfg.work_dir if cfg.work_dir else 
tvm.contrib.utils.tempdir().relpath("")
-        export_runtime_module = cfg.export_runtime_module
-        load_runtime_module = cfg.load_runtime_module
-
-    # Config checks
-    if load_runtime_module and dpu_target is not None:
-        warnings.warn(
-            "Both `load_runtime_module` and `dpu` configs were specified."
-            " The `load_runtime_module` points to a prebuilt runtime module 
with"
-            " an internal DPU target so the `dpu` config will be ignored"
-        )
-    if load_runtime_module and "relay.ext.vitis_ai.options.build_dir" in 
pass_context.config:
-        warnings.warn(
-            "Both `load_runtime_module` and `build_dir` configs were 
specified."
-            " The `load_runtime_module` points to a prebuilt runtime module 
with"
-            " an internal build directory so the `build_dir` config will be 
ignored"
-        )
-    if load_runtime_module and "relay.ext.vitis_ai.options.work_dir" in 
pass_context.config:
-        warnings.warn(
-            "Both `load_runtime_module` and `work_dir` configs were specified."
-            " The `load_runtime_module` points to a prebuilt runtime module 
with"
-            " an internal work directory so the `work_dir` config will be 
ignored"
-        )
-
-    # If load_runtime_module is not set, we will build the PyXIR runtime 
module from scratch
-    if load_runtime_module == "":
-        # Convert Relay expression into XGraph and do partitioning inside PyXIR
-        codegen = CodegenVitisAI(ref, dpu_target)
-        xgraph_str = codegen.build()
-
-        runtime_func = "tvm.vitis_ai_runtime.from_xgraph"
-        fcreate = tvm._ffi.get_global_func(runtime_func)
-        return fcreate(
-            name, xgraph_str, dpu_target, vai_build_dir, vai_work_dir, 
export_runtime_module
-        )
-
-    runtime_func = "tvm.vitis_ai_runtime.from_rt_mod"
-    fcreate = tvm._ffi.get_global_func(runtime_func)
-    return fcreate(name, load_runtime_module, export_runtime_module)
diff --git a/python/tvm/testing/utils.py b/python/tvm/testing/utils.py
index b3123a20d3..b01f7bf5dc 100644
--- a/python/tvm/testing/utils.py
+++ b/python/tvm/testing/utils.py
@@ -1022,10 +1022,6 @@ requires_aprofile_aem_fvp = Feature(
     compile_time_check=_aprofile_aem_fvp_compile_time_check,
 )
 
-# Mark a test as requiring Vitis AI to run
-requires_vitis_ai = Feature("vitis_ai", "Vitis AI", cmake_flag="USE_VITIS_AI")
-
-
 # check cpu features
 def _has_cpu_feat(features):
     cpu = codegen.llvm_get_system_cpu()
diff --git a/rust/tvm-rt/Cargo.toml b/rust/tvm-rt/Cargo.toml
index 789c15a6be..cb8c560c3e 100644
--- a/rust/tvm-rt/Cargo.toml
+++ b/rust/tvm-rt/Cargo.toml
@@ -74,7 +74,6 @@ use-arm-compute-lib = ["tvm-sys/use-arm-compute-lib"]
 use-arm-compute-lib-graph-runtime = 
["tvm-sys/use-arm-compute-lib-graph-runtime"]
 use-tensorrt-codegen = ["tvm-sys/use-tensorrt-codegen"]
 use-tensorrt-runtime = ["tvm-sys/use-tensorrt-runtime"]
-use-vitis-ai = ["tvm-sys/use-vitis-ai"]
 build-static-runtime = ["tvm-sys/build-static-runtime"]
 
 [dependencies]
diff --git a/rust/tvm-sys/Cargo.toml b/rust/tvm-sys/Cargo.toml
index 70daf3b388..03e1d4e13d 100644
--- a/rust/tvm-sys/Cargo.toml
+++ b/rust/tvm-sys/Cargo.toml
@@ -67,7 +67,6 @@ use-arm-compute-lib = []
 use-arm-compute-lib-graph-runtime = []
 use-tensorrt-codegen = []
 use-tensorrt-runtime = []
-use-vitis-ai = []
 build-static-runtime = []
 
 [dependencies]
diff --git a/rust/tvm-sys/build.rs b/rust/tvm-sys/build.rs
index eb2c1ee3a2..3b19f56fb1 100644
--- a/rust/tvm-sys/build.rs
+++ b/rust/tvm-sys/build.rs
@@ -186,9 +186,6 @@ fn find_using_tvm_build() -> Result<TVMInstall> {
     if cfg!(feature = "use-tensorrt-runtime") {
         build_config.settings.use_tensorrt_runtime = 
CMakeSetting::from_str("on").ok();
     }
-    if cfg!(feature = "use-vitis-ai") {
-        build_config.settings.use_vitis_ai = Some(true);
-    }
     if cfg!(any(
         feature = "static-linking",
         feature = "build-static-runtime"
diff --git a/src/runtime/contrib/vitis_ai/vitis_ai_runtime.cc 
b/src/runtime/contrib/vitis_ai/vitis_ai_runtime.cc
deleted file mode 100755
index 46246b0295..0000000000
--- a/src/runtime/contrib/vitis_ai/vitis_ai_runtime.cc
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- */
-
-/*!
- * \file vitis_ai_runtime.cc
- */
-
-#include "vitis_ai_runtime.h"
-
-#include <tvm/runtime/registry.h>
-
-#include <cassert>
-#include <fstream>
-#include <streambuf>
-#include <string>
-#include <vector>
-
-using namespace pyxir::runtime;
-
-namespace tvm {
-namespace runtime {
-
-VitisAIRuntime::VitisAIRuntime(const std::string& symbol_name, const 
Array<String> const_names,
-                               const std::string& serialized_rt_mod,
-                               const std::string& export_rt_mod_path)
-    : symbol_name_(symbol_name),
-      const_names_(const_names),
-      export_rt_mod_path_(export_rt_mod_path) {
-  std::istringstream sstream(serialized_rt_mod);
-  rt_mod_.reset(new RuntimeModule());
-  rt_mod_->deserialize(sstream);
-  in_tensor_names_ = rt_mod_->get_in_tensor_names();
-  out_tensor_names_ = rt_mod_->get_out_tensor_names();
-}
-
-VitisAIRuntime::VitisAIRuntime(const std::string& symbol_name, const 
std::string& xgraph_str,
-                               const Array<String> const_names, const 
std::string& dpu_target,
-                               const std::string& build_dir, const 
std::string& work_dir,
-                               const std::string& export_rt_mod_path)
-    : symbol_name_(symbol_name),
-      const_names_(const_names),
-      export_rt_mod_path_(export_rt_mod_path) {
-  std::istringstream xgraph_sstream(xgraph_str);
-  pyxir::XGraphHolder xgraph = std::make_shared<pyxir::graph::XGraph>("");
-  pyxir::read(xgraph, xgraph_sstream);
-  in_tensor_names_ = xgraph->get_input_names();
-  out_tensor_names_ = xgraph->get_meta_attr("tvm_out_tensors").get_strings();
-
-  pyxir::partition(xgraph, std::vector<std::string>{dpu_target}, "");
-
-  pyxir::RunOptionsHolder run_options(new pyxir::runtime::RunOptions());
-  run_options->on_the_fly_quantization = true;
-  run_options->build_dir = build_dir;
-  run_options->export_runtime_module_path = export_rt_mod_path_;
-  if (!work_dir.empty()) run_options->work_dir = work_dir;
-  rt_mod_ =
-      pyxir::build_rt(xgraph, dpu_target, in_tensor_names_, out_tensor_names_, 
"vai", run_options);
-}
-
-Module VitisAIRuntimeCreate(const std::string& name, const std::string& 
xgraph_str,
-                            const std::string& dpu_target, const std::string& 
build_dir,
-                            const std::string& work_dir, const std::string& 
export_rt_mod_path) {
-  Array<String> const_vars;
-  auto exec = make_object<VitisAIRuntime>(name, xgraph_str, const_vars, 
dpu_target, build_dir,
-                                          work_dir, export_rt_mod_path);
-  return Module(exec);
-}
-
-TVM_REGISTER_GLOBAL("tvm.vitis_ai_runtime.from_xgraph").set_body([](TVMArgs 
args, TVMRetValue* rv) {
-  *rv = VitisAIRuntimeCreate(args[0], args[1], args[2], args[3], args[4], 
args[5]);
-});
-
-Module VitisAIRuntimeCreate(const std::string& name, const std::string& 
serialized_rt_mod,
-                            const std::string& export_rt_mod_path) {
-  Array<String> const_vars;
-  auto exec = make_object<VitisAIRuntime>(name, const_vars, serialized_rt_mod, 
export_rt_mod_path);
-  return Module(exec);
-}
-
-TVM_REGISTER_GLOBAL("tvm.vitis_ai_runtime.from_rt_mod").set_body([](TVMArgs 
args, TVMRetValue* rv) {
-  std::string load_rt_mod_path = args[1];
-  assert(!load_rt_mod_path.empty());
-  std::ifstream in_file(load_rt_mod_path);
-  std::stringstream buffer;
-  buffer << in_file.rdbuf();
-  std::string serialized_rt_mod = buffer.str();
-  in_file.close();
-  *rv = VitisAIRuntimeCreate(args[0], serialized_rt_mod, args[2]);
-});
-
-Module VitisAIRuntimeLoadFromBinary(void* strm) {
-  dmlc::Stream* stream = static_cast<dmlc::Stream*>(strm);
-  std::string symbol_name;
-  std::vector<std::string> const_vars;
-  std::string serialized_rt_mod;
-  std::string export_rt_mod_path;
-  stream->Read(&serialized_rt_mod);
-  stream->Read(&export_rt_mod_path);
-  stream->Read(&symbol_name);
-  stream->Read(&const_vars);
-  Array<String> const_names;
-  for (const auto& it : const_vars) {
-    const_names.push_back(it);
-  }
-  auto exec =
-      make_object<VitisAIRuntime>(symbol_name, const_names, serialized_rt_mod, 
export_rt_mod_path);
-  return Module(exec);
-}
-
-TVM_REGISTER_GLOBAL("runtime.module.loadbinary_VitisAIRuntime")
-    .set_body_typed(VitisAIRuntimeLoadFromBinary);
-
-void VitisAIRuntime::SaveToBinary(dmlc::Stream* stream) {
-  std::ostringstream sstream;
-  rt_mod_->serialize(sstream);
-  stream->Write(sstream.str());
-  stream->Write(export_rt_mod_path_);
-  stream->Write(symbol_name_);
-  std::vector<std::string> consts;
-  for (const auto& it : const_names_) {
-    consts.push_back(it);
-  }
-  stream->Write(consts);
-
-  // If export_rt_mod_path_ member variable is set, we will additionally 
export the PyXIR
-  //  runtime_module to the specified file
-  if (!export_rt_mod_path_.empty()) {
-    std::ofstream out_file(export_rt_mod_path_);
-    out_file << sstream.str();
-    out_file.close();
-  }
-}
-
-PackedFunc VitisAIRuntime::GetFunction(const String& name, const 
ObjectPtr<Object>& sptr_to_self) {
-  if (name == "get_symbol") {
-    return PackedFunc(
-        [sptr_to_self, this](TVMArgs args, TVMRetValue* rv) { *rv = 
this->symbol_name_; });
-  } else if (name == "get_const_vars") {
-    return PackedFunc(
-        [sptr_to_self, this](TVMArgs args, TVMRetValue* rv) { *rv = 
this->const_names_; });
-  } else if ("__init_" + this->symbol_name_ == name) {
-    // The function to initialize constant tensors.
-    return PackedFunc([sptr_to_self, this](TVMArgs args, TVMRetValue* rv) {
-      CHECK_EQ(args.size(), 1U);
-      this->initialized_ = true;
-      *rv = 0;
-    });
-  } else if (this->symbol_name_ == name) {
-    return PackedFunc([sptr_to_self, this](TVMArgs args, TVMRetValue* rv) {
-      // Initialize input tensors
-      DLTensor* inputs = args[0];
-      std::vector<pyxir::XBufferHolder> in_tensors;
-      std::vector<ssize_t> in_shape;
-      for (int i = 0; i < inputs->ndim; ++i) 
in_shape.push_back(inputs->shape[i]);
-      in_tensors.push_back(std::shared_ptr<pyxir::XBuffer>(
-          new 
pyxir::XBuffer(reinterpret_cast<void*>(static_cast<float*>(inputs->data)), 4, 
"f",
-                             in_shape.size(), in_shape, false, false)));
-
-      // Initialize output tensors
-      std::vector<pyxir::XBufferHolder> out_tensors;
-      for (unsigned i = 0; i < out_tensor_names_.size(); ++i) {
-        DLTensor* output_tensor = args[args.size() - out_tensor_names_.size() 
+ i];
-        std::vector<ssize_t> out_shape;
-        for (int i = 0; i < output_tensor->ndim; ++i) 
out_shape.push_back(output_tensor->shape[i]);
-        void* output_data = 
reinterpret_cast<void*>(static_cast<float*>(output_tensor->data));
-        out_tensors.push_back(std::shared_ptr<pyxir::XBuffer>(
-            new pyxir::XBuffer(output_data, 4, "f", out_shape.size(), 
out_shape, false, false)));
-      }
-
-      // Execute the subgraph.
-      rt_mod_->execute(in_tensors, out_tensors);
-    });
-  } else {
-    return PackedFunc();
-  }
-}
-
-}  // namespace runtime
-}  // namespace tvm
diff --git a/src/runtime/contrib/vitis_ai/vitis_ai_runtime.h 
b/src/runtime/contrib/vitis_ai/vitis_ai_runtime.h
deleted file mode 100755
index 2cc5918c8f..0000000000
--- a/src/runtime/contrib/vitis_ai/vitis_ai_runtime.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- */
-
-/*!
- * \brief Vitis-AI runtime that can run model
- *        containing only tvm PackedFunc.
- * \file vitis_ai_runtime.h
- */
-#ifndef TVM_RUNTIME_CONTRIB_VITIS_AI_VITIS_AI_RUNTIME_H_
-#define TVM_RUNTIME_CONTRIB_VITIS_AI_VITIS_AI_RUNTIME_H_
-#include <dlpack/dlpack.h>
-#include <tvm/runtime/ndarray.h>
-#include <tvm/runtime/packed_func.h>
-// clang-format off
-#include <memory>
-#include <string>
-#include <vector>
-// clang-format on
-#include <pyxir/pyxir.hpp>
-#include <pyxir/runtime/run_options.hpp>
-
-namespace tvm {
-namespace runtime {
-
-/*!
- * \brief VAI runtime.
- *
- *  This runtime can be accessed in various language via
- *  TVM runtime PackedFunc API.
- */
-class VitisAIRuntime : public ModuleNode {
- public:
-  /*!
-   * \brief Create VitisAI runtime from serialized XGraph
-   * \param symbol_name The name of the function.
-   * \param const_names The names of each constant in the sub-graph.
-   * \param serialized_rt_mod The serialized runtime module.
-   * \param export_rt_mod_path The path to the file to be used for exporting 
the
-   *        PyXIR runtime module.
-   */
-  VitisAIRuntime(const std::string& symbol_name, const Array<String> 
const_names,
-                 const std::string& serialized_rt_mod, const std::string& 
export_rt_mod);
-
-  /*!
-   * \brief Create VitisAI runtime from serialized XGraph
-   * \param symbol_name The name of the function.
-   * \param xgraph_str serialized XGraph representation
-   * \param const_names The names of each constant in the sub-graph.
-   * \param dpu_target The Vitis-AI DPU target identifier (e.g. DPUCADX8G, 
DPUCZDX8G-zcu104).
-   * \param build_dir The directory to be used for Vitis-AI build files.
-   * \param work_dir The directory to be used for Vitis-AI work files.
-   * \param export_rt_mod_path The path to the file to be used for exporting 
the
-   *        PyXIR runtime module.
-   */
-  VitisAIRuntime(const std::string& symbol_name, const std::string& xgraph_str,
-                 const Array<String> const_names, const std::string& 
dpu_target,
-                 const std::string& build_dir, const std::string& work_dir,
-                 const std::string& export_runtime_module_path);
-
-  /*!
-   * \brief Get member function to front-end.
-   * \param name The name of the function.
-   * \param sptr_to_self The pointer to the module node.
-   * \return The corresponding member function.
-   */
-  virtual PackedFunc GetFunction(const String& name, const ObjectPtr<Object>& 
sptr_to_self);
-
-  /*!
-   * \return The type key of the executor.
-   */
-  const char* type_key() const { return "VitisAIRuntime"; }
-
-  /*! \brief Get the property of the runtime module .*/
-  int GetPropertyMask() const final {
-    return ModulePropertyMask::kBinarySerializable | 
ModulePropertyMask::kRunnable;
-  };
-
-  /*!
-   * \brief Serialize the content of the pyxir directory and save it to
-   *        binary stream.
-   * \param stream The binary stream to save to.
-   */
-  void SaveToBinary(dmlc::Stream* stream) final;
-
- private:
-  /*! \brief The only subgraph name for this module */
-  std::string symbol_name_;
-  /*! \brief The required constant names */
-  Array<String> const_names_;
-  /*! \brief The runtime module */
-  pyxir::RtModHolder rt_mod_;
-  /*! \brief The XGraph input tensor names in the order as provided by TVM */
-  std::vector<std::string> in_tensor_names_;
-  /*! \brief The XGraph output tensor names in the order as provided by TVM */
-  std::vector<std::string> out_tensor_names_;
-  /*! \brief The file path for exporting the runtime module if set */
-  std::string export_rt_mod_path_;
-  /*! \brief Whether constant tensors have been initialized */
-  bool initialized_{false};
-};
-
-}  // namespace runtime
-}  // namespace tvm
-#endif  // TVM_RUNTIME_CONTRIB_VITIS_AI_VITIS_AI_RUNTIME_H_
diff --git a/src/support/libinfo.cc b/src/support/libinfo.cc
index d55181aab7..1af5e6e095 100644
--- a/src/support/libinfo.cc
+++ b/src/support/libinfo.cc
@@ -364,7 +364,6 @@ TVM_DLL Map<String, String> GetLibInfo() {
       {"USE_THREADS", TVM_INFO_USE_THREADS},
       {"USE_THRUST", TVM_INFO_USE_THRUST},
       {"USE_CURAND", TVM_INFO_USE_CURAND},
-      {"USE_VITIS_AI", TVM_INFO_USE_VITIS_AI},
       {"USE_VULKAN", TVM_INFO_USE_VULKAN},
       {"USE_CLML", TVM_INFO_USE_CLML},
       {"TVM_CLML_VERSION", TVM_INFO_USE_TVM_CLML_VERSION},
diff --git a/tests/scripts/task_config_build_cpu.sh 
b/tests/scripts/task_config_build_cpu.sh
index f9065ece6e..42d6c06f7a 100755
--- a/tests/scripts/task_config_build_cpu.sh
+++ b/tests/scripts/task_config_build_cpu.sh
@@ -42,7 +42,6 @@ fi
 
 echo set\(USE_TENSORFLOW_PATH \"/tensorflow\"\) >> config.cmake
 echo set\(USE_FLATBUFFERS_PATH \"/flatbuffers\"\) >> config.cmake
-echo set\(USE_VITIS_AI ON\) >> config.cmake
 echo set\(USE_LIBBACKTRACE COMPILE\) >> config.cmake
 echo set\(BACKTRACE_ON_SEGFAULT ON\) >> config.cmake
 echo set\(USE_CCACHE OFF\) >> config.cmake


Reply via email to