aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2021-02-07 00:15:07 +0800
committerBenda Xu <heroxbd@gentoo.org>2021-02-07 00:19:49 +0800
commit53da9141ac01271e8abb862025df966e852d68a4 (patch)
tree0db2e28f0ca3606805e1969e49af34c5bdbfa4e9 /dev-util/Tensile/files
parentnet-misc/cernbox-client: Bump to 2.7.5.3180. (diff)
downloadsci-53da9141ac01271e8abb862025df966e852d68a4.tar.gz
sci-53da9141ac01271e8abb862025df966e852d68a4.tar.bz2
sci-53da9141ac01271e8abb862025df966e852d68a4.zip
dev-util/Tensile: move to standard directories.
Let cmake to be able to locate Tensile. Move source code out of the python site-packages tree. Reported-by: Yiyang Wu <xgreenlandforwyy@gmail.com>, Alexey Chernov Closes: https://bugs.gentoo.org/768474 Package-Manager: Portage-3.0.12, Repoman-3.0.1 Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'dev-util/Tensile/files')
-rw-r--r--dev-util/Tensile/files/Tensile-4.0.0-cmake.patch38
-rw-r--r--dev-util/Tensile/files/Tensile-4.0.0-locate-commands.patch62
-rw-r--r--dev-util/Tensile/files/Tensile-4.0.0-output-currentISA.patch22
-rw-r--r--dev-util/Tensile/files/Tensile-4.0.0-setup.py-cmake.patch13
4 files changed, 135 insertions, 0 deletions
diff --git a/dev-util/Tensile/files/Tensile-4.0.0-cmake.patch b/dev-util/Tensile/files/Tensile-4.0.0-cmake.patch
new file mode 100644
index 000000000..0c39f747c
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.0.0-cmake.patch
@@ -0,0 +1,38 @@
+Index: Tensile-rocm-4.0.0/Tensile/cmake/TensileConfig.cmake
+===================================================================
+--- Tensile-rocm-4.0.0.orig/Tensile/cmake/TensileConfig.cmake
++++ Tensile-rocm-4.0.0/Tensile/cmake/TensileConfig.cmake
+@@ -26,7 +26,7 @@ if(NOT DEFINED Tensile_ROOT)
+ get_filename_component(Tensile_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+ get_filename_component(Tensile_PREFIX "${Tensile_PREFIX}" PATH)
+
+-execute_process(COMMAND "${Tensile_PREFIX}/bin/TensileGetPath" OUTPUT_VARIABLE Tensile_ROOT)
++execute_process(COMMAND "TensileGetPath" OUTPUT_VARIABLE Tensile_ROOT)
+ endif()
+ list(APPEND CMAKE_MODULE_PATH "${Tensile_ROOT}/Source/cmake/")
+ list(APPEND CMAKE_MODULE_PATH "${Tensile_ROOT}/Source/")
+@@ -93,7 +93,7 @@ function(TensileCreateLibraryFiles
+ set(Tensile_MERGE_FILES OFF)
+ endif()
+
+- set(Script "${Tensile_ROOT}/bin/TensileCreateLibrary")
++ set(Script "TensileCreateLibrary")
+ message(STATUS "Tensile script: ${Script}")
+
+ set(Options "--new-client-only" "--no-legacy-components")
+Index: Tensile-rocm-4.0.0/Tensile/Source/TensileCreateLibrary.cmake
+===================================================================
+--- Tensile-rocm-4.0.0.orig/Tensile/Source/TensileCreateLibrary.cmake
++++ Tensile-rocm-4.0.0/Tensile/Source/TensileCreateLibrary.cmake
+@@ -52,10 +52,7 @@ function(TensileCreateLibraryCmake
+ message(STATUS "Tensile_ARCHITECTURE from TensileCreateLibraryCmake : ${Tensile_ARCHITECTURE}")
+ message(STATUS "Tensile_LIBRARY_FORMAT from TensileCreateLibraryCmake : ${Tensile_LIBRARY_FORMAT}")
+
+- execute_process(COMMAND chmod 755 ${Tensile_ROOT}/bin/TensileCreateLibrary)
+- execute_process(COMMAND chmod 755 ${Tensile_ROOT}/bin/Tensile)
+-
+- set(Tensile_CREATE_COMMAND "${Tensile_ROOT}/bin/TensileCreateLibrary")
++ set(Tensile_CREATE_COMMAND "TensileCreateLibrary")
+
+ set(Tensile_SOURCE_PATH "${PROJECT_BINARY_DIR}/Tensile")
+ message(STATUS "Tensile_SOURCE_PATH=${Tensile_SOURCE_PATH}")
diff --git a/dev-util/Tensile/files/Tensile-4.0.0-locate-commands.patch b/dev-util/Tensile/files/Tensile-4.0.0-locate-commands.patch
new file mode 100644
index 000000000..78d467349
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.0.0-locate-commands.patch
@@ -0,0 +1,62 @@
+Index: Tensile-rocm-4.0.0/Tensile/Common.py
+===================================================================
+--- Tensile-rocm-4.0.0.orig/Tensile/Common.py
++++ Tensile-rocm-4.0.0/Tensile/Common.py
+@@ -155,7 +155,7 @@ globalParameters["PrintTensorRef"] = 0
+ globalParameters["PrintIndexAssignments"] = 0 # Print the tensor index assignment info
+ globalParameters["PrintTensorRef"] = 0 # Print reference tensor. 0x1=after init; 0x2=after copy-back; 0x3=both
+ globalParameters["PrintWinnersOnly"] = False # Only print the solutions which become the fastest
+-globalParameters["PrintCodeCommands"] = False # print the commands used to generate the code objects (asm,link,hip-clang, etc)
++globalParameters["PrintCodeCommands"] = True # print the commands used to generate the code objects (asm,link,hip-clang, etc)
+
+ # TODO - remove this when NewClient is mainstream
+ globalParameters["OldClientSourceTmp"] = True # Use an intermediate sourceTmp dir to detect file changes and minimize rebuilds on old client
+@@ -1521,14 +1521,14 @@ def assignGlobalParameters( config ):
+ print2(" %24s: %8s (unspecified)" % (key, defaultValue))
+
+ # ROCm Agent Enumerator Path
+- globalParameters["ROCmAgentEnumeratorPath"] = locateExe("/opt/rocm/bin", "rocm_agent_enumerator")
++ globalParameters["ROCmAgentEnumeratorPath"] = locateExe("", "rocm_agent_enumerator")
+ if "CxxCompiler" in config:
+ globalParameters["CxxCompiler"] = config["CxxCompiler"]
+
+ if "TENSILE_ROCM_ASSEMBLER_PATH" in os.environ:
+ globalParameters["AssemblerPath"] = os.environ.get("TENSILE_ROCM_ASSEMBLER_PATH")
+ elif globalParameters["AssemblerPath"] is None and globalParameters["CxxCompiler"] == "hipcc":
+- globalParameters["AssemblerPath"] = locateExe("/opt/rocm/llvm/bin", "clang++")
++ globalParameters["AssemblerPath"] = locateExe("", "clang++")
+ elif globalParameters["AssemblerPath"] is None and globalParameters["CxxCompiler"] == "hcc":
+ globalParameters["AssemblerPath"] = locateExe("/opt/rocm/bin", "hcc")
+
+@@ -1536,8 +1536,8 @@ def assignGlobalParameters( config ):
+ if globalParameters["CxxCompiler"] == "hcc":
+ globalParameters["ExtractKernelPath"] = locateExe("/opt/rocm/bin", "extractkernel")
+ else:
+- globalParameters["ExtractKernelPath"] = locateExe("/opt/rocm/hip/bin", "extractkernel")
+- globalParameters["ClangOffloadBundlerPath"] = locateExe("/opt/rocm/llvm/bin", "clang-offload-bundler")
++ globalParameters["ExtractKernelPath"] = locateExe("", "extractkernel")
++ globalParameters["ClangOffloadBundlerPath"] = locateExe("", "clang-offload-bundler")
+
+ if "ROCmAgentEnumeratorPath" in config:
+ globalParameters["ROCmAgentEnumeratorPath"] = config["ROCmAgentEnumeratorPath"]
+@@ -1579,20 +1579,6 @@ def assignGlobalParameters( config ):
+ # Due to platform.linux_distribution() being deprecated, just try to run dpkg regardless.
+ # The alternative would be to install the `distro` package.
+ # See https://docs.python.org/3.7/library/platform.html#platform.linux_distribution
+- try:
+- if globalParameters["CxxCompiler"] == "hipcc":
+- output = subprocess.run(["dpkg", "-l", "hip-rocclr"], check=True, stdout=subprocess.PIPE).stdout.decode()
+- elif globalParameters["CxxCompiler"] == "hcc":
+- output = subprocess.run(["dpkg", "-l", "hcc"], check=True, stdout=subprocess.PIPE).stdout.decode()
+-
+- for line in output.split('\n'):
+- if 'hipcc' in line:
+- globalParameters['HipClangVersion'] = line.split()[2]
+- elif 'hcc' in line:
+- globalParameters['HccVersion'] = line.split()[2]
+-
+- except (subprocess.CalledProcessError, OSError) as e:
+- printWarning("Error: {} looking for package {}: {}".format('dpkg', 'hip-rocclr', e))
+
+ for key in config:
+ value = config[key]
diff --git a/dev-util/Tensile/files/Tensile-4.0.0-output-currentISA.patch b/dev-util/Tensile/files/Tensile-4.0.0-output-currentISA.patch
new file mode 100644
index 000000000..a00f9fdca
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.0.0-output-currentISA.patch
@@ -0,0 +1,22 @@
+Index: Tensile-rocm-4.0.0/Tensile/TensileCreateLibrary.py
+===================================================================
+--- Tensile-rocm-4.0.0.orig/Tensile/TensileCreateLibrary.py
++++ Tensile-rocm-4.0.0/Tensile/TensileCreateLibrary.py
+@@ -132,7 +132,7 @@ def buildSourceCodeObjectFile(CxxCompile
+ return globalParameters["AsmCaps"][arch]["SupportedISA"] and \
+ globalParameters["AsmCaps"][arch]["SupportedSource"]
+
+- archs = ['gfx'+''.join(map(str,arch)) for arch in globalParameters['SupportedISA'] \
++ archs = ['gfx'+''.join(map(str,arch)) for arch in [globalParameters['CurrentISA']] \
+ if isSupported(arch)]
+
+ archFlags = ['--amdgpu-target=' + arch for arch in archs]
+@@ -1004,7 +1004,7 @@ def buildObjectFileNames(solutionWriter,
+ kernelHelperOjbNmaes = [ko.getKernelName() for ko in kernelHelperOjbs]
+
+ # Source based kernels are built for all supported architectures
+- sourceArchs = ['gfx'+''.join(map(str,arch)) for arch in globalParameters['SupportedISA'] \
++ sourceArchs = ['gfx'+''.join(map(str,arch)) for arch in [globalParameters['CurrentISA']] \
+ if isSupported(arch)]
+
+ # Asm based kernels target the configured ISA
diff --git a/dev-util/Tensile/files/Tensile-4.0.0-setup.py-cmake.patch b/dev-util/Tensile/files/Tensile-4.0.0-setup.py-cmake.patch
new file mode 100644
index 000000000..e020842b2
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.0.0-setup.py-cmake.patch
@@ -0,0 +1,13 @@
+Index: Tensile-rocm-4.0.0/setup.py
+===================================================================
+--- Tensile-rocm-4.0.0.orig/setup.py
++++ Tensile-rocm-4.0.0/setup.py
+@@ -30,8 +30,6 @@ setup(
+ install_requires=readRequirementsFromTxt(),
+ python_requires='>=3.5',
+ packages=["Tensile"],
+- package_data={ "Tensile": ["Tensile/cmake/*"] },
+- data_files=[ ("cmake", ["Tensile/cmake/TensileConfig.cmake", "Tensile/cmake/TensileConfigVersion.cmake"]) ],
+ include_package_data=True,
+ entry_points={"console_scripts": [
+ # user runs a benchmark