From: Cordell Bloor <cgmb@slerp.xyz>
Date: Sun, 9 Apr 2023 16:35:21 -0600
Subject: move tensile library into versioned subdir

The Tensile library contains optimized kernels that are loaded at
runtime by rocblas, and thus must be a part of the library package.
To ensure that multiple versions of rocblas with different ABI
versions can be installed side-by-side, the library files must be
moved to a path containing the version number.

Forwarded: yes
---
 library/src/tensile_host.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/library/src/tensile_host.cpp b/library/src/tensile_host.cpp
index fbc33f8..524c936 100644
--- a/library/src/tensile_host.cpp
+++ b/library/src/tensile_host.cpp
@@ -84,6 +84,12 @@ namespace fs = std::experimental::filesystem;
 
 #endif // WIN32
 
+#define TO_STR2(x) #x
+#define TO_STR(x) TO_STR2(x)
+#define ROCBLAS_VERSION_STRING TO_STR(ROCBLAS_VERSION_MAJOR) "." \
+                               TO_STR(ROCBLAS_VERSION_MINOR) "." \
+                               TO_STR(ROCBLAS_VERSION_PATCH)
+
 namespace
 {
 #ifndef WIN32
@@ -593,7 +599,9 @@ namespace
 #endif // ifndef ROCBLAS_STATIC_LIB
 
                 // Find the location of the libraries
-                if(TestPath(path + "/../../Tensile/library"))
+                if(TestPath(path + "/rocblas/" ROCBLAS_VERSION_STRING "/library"))
+                    path += "/rocblas/" ROCBLAS_VERSION_STRING "/library";
+                else if(TestPath(path + "/../../Tensile/library"))
                     path += "/../../Tensile/library";
                 else if(TestPath(path + "library"))
                     path += "/library";
