From: Cordell Bloor <cgmb@slerp.xyz>
Date: Sun, 9 Apr 2023 00:34:59 -0600
Subject: remove use of pip and virtualenv

The upstream project creates a virtualenv and uses pip to install the
Python dependencies during a build. In the Debian build, all the Python
dependencies are already provided by packages, so there's no need for
all that complexity.

When contributed upstream, this functionality was guarded behind the
cmake option -DBUILD_WITH_PIP=OFF. Tensile_ROOT can also be passed from
d/rules (if necessary) so this patch can be dropped with ROCm 5.7.

Forwarded: yes
Applied-Upstream: https://github.com/ROCmSoftwarePlatform/rocBLAS/commit/4b9b2478472c0475ca08961c19e57d8c39d6f4c7
---
 CMakeLists.txt | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index be5e969..1ea8e9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,32 +132,9 @@ if(NOT SKIP_LIBRARY)
     # we will have expanded "all" for tensile to ensure consistency as we have local rules
     set( Tensile_ARCHITECTURE "${AMDGPU_TARGETS}" CACHE STRING "Tensile to use which architecture?" FORCE)
 
-    if (WIN32)
-      set( Tensile_ROOT "${CMAKE_BINARY_DIR}/virtualenv/Lib/site-packages/Tensile" )
-    endif()
+    set( Tensile_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/tensile/Tensile")
 
-    set( Tensile_TEST_LOCAL_PATH "" CACHE PATH "Use local Tensile directory instead of fetching a GitHub branch" )
-
-    include(virtualenv)
-
-    if (Tensile_TEST_LOCAL_PATH)
-      virtualenv_install(${Tensile_TEST_LOCAL_PATH})
-      message (STATUS "using local Tensile from ${Tensile_TEST_LOCAL_PATH}, copied to ${Tensile_ROOT}")
-    else()
-      # Use the virtual-env setup and download package from specified repot:
-      set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" )
-      file (STRINGS "tensile_tag.txt" read_tensile_tag)
-      set( tensile_tag ${read_tensile_tag} CACHE STRING "Tensile tag to download" )
-      virtualenv_install("git+https://github.com/${tensile_fork}/Tensile.git@${tensile_tag}")
-      message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${tensile_tag}")
-    endif()
-    message(STATUS "Adding ${VIRTUALENV_HOME_DIR} to CMAKE_PREFIX_PATH")
-    list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR})
-    if (TENSILE_VERSION)
-      find_package(Tensile ${TENSILE_VERSION} EXACT REQUIRED HIP LLVM OpenMP PATHS "${INSTALLED_TENSILE_PATH}")
-    else()
-      find_package(Tensile 4.36.0 EXACT REQUIRED HIP LLVM OpenMP PATHS "${INSTALLED_TENSILE_PATH}")
-    endif()
+    find_package(Tensile 4.36.0 EXACT REQUIRED HIP LLVM PATHS "${CMAKE_CURRENT_SOURCE_DIR}/tensile/Tensile/cmake")
   endif()
 endif()
 
