Merge pull request #195403 from Flakebi/rocm

authored by Bernardo Meurer and committed by GitHub 2196a95e d0c935df

+456 -164
+12 -7
pkgs/development/compilers/hip/default.nix
··· 29 29 let 30 30 hip = stdenv.mkDerivation rec { 31 31 pname = "hip"; 32 - version = "5.2.3"; 32 + version = "5.3.0"; 33 33 34 34 src = fetchFromGitHub { 35 35 owner = "ROCm-Developer-Tools"; 36 36 repo = "HIP"; 37 37 rev = "rocm-${version}"; 38 - hash = "sha256-QaN666Rku2Tkio2Gm5/3RD8D5JgmCZLe0Yun1fGxa8U="; 38 + hash = "sha256-UAodlVUiTU4n/EyvTIuQekTGh4izmBjKCRXOHXVKY4M="; 39 39 }; 40 40 41 41 patches = [ ··· 102 102 description = "C++ Heterogeneous-Compute Interface for Portability"; 103 103 homepage = "https://github.com/ROCm-Developer-Tools/HIP"; 104 104 license = licenses.mit; 105 - maintainers = with maintainers; [ lovesegfault ]; 105 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 106 106 platforms = platforms.linux; 107 107 }; 108 108 }; 109 109 in 110 110 stdenv.mkDerivation rec { 111 111 pname = "hip"; 112 - version = "5.2.3"; 112 + version = "5.3.0"; 113 113 114 114 src = fetchFromGitHub { 115 115 owner = "ROCm-Developer-Tools"; 116 116 repo = "hipamd"; 117 117 rev = "rocm-${version}"; 118 - hash = "sha256-9YZBFn1jpOiX0X9rcpsFDNhas9vfxNkNnbsWSi7unPU="; 118 + hash = "sha256-gZGZiDP/HbdmzLQkG9Jq9lyMP9hoD6UzTMiX9cUmQNA="; 119 119 }; 120 120 121 121 nativeBuildInputs = [ cmake python3 makeWrapper perl ]; ··· 133 133 patches = [ 134 134 (substituteAll { 135 135 src = ./hipamd-config-paths.patch; 136 - inherit llvm hip; 136 + inherit clang llvm hip; 137 137 rocm_runtime = rocm-runtime; 138 138 }) 139 139 ]; 140 + 141 + prePatch = '' 142 + sed -e 's,#!/bin/bash,#!${stdenv.shell},' \ 143 + -i src/hip_embed_pch.sh 144 + ''; 140 145 141 146 preConfigure = '' 142 147 export HIP_CLANG_PATH=${clang}/bin ··· 189 194 description = "C++ Heterogeneous-Compute Interface for Portability"; 190 195 homepage = "https://github.com/ROCm-Developer-Tools/hipamd"; 191 196 license = licenses.mit; 192 - maintainers = with maintainers; [ lovesegfault ]; 197 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 193 198 platforms = platforms.linux; 194 199 }; 195 200 }
+4 -5
pkgs/development/compilers/hip/hip-config-paths.patch
··· 2 2 index 1a72643a..7f35031f 100644 3 3 --- a/hip-lang-config.cmake.in 4 4 +++ b/hip-lang-config.cmake.in 5 - @@ -72,8 +72,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH) 5 + @@ -71,8 +71,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH) 6 6 7 7 8 8 #need _IMPORT_PREFIX to be set #FILE_REORG_BACKWARD_COMPATIBILITY ··· 13 13 find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h 14 14 HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS} 15 15 ${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG} 16 - @@ -88,10 +88,7 @@ endif() 16 + @@ -87,9 +87,7 @@ endif() 17 17 #if HSA is not under ROCm then provide CMAKE_PREFIX_PATH=<HSA_PATH> 18 18 find_path(HSA_HEADER hsa/hsa.h 19 19 PATHS 20 20 - "${_IMPORT_PREFIX}/../include" #FILE_REORG_BACKWARD_COMPATIBILITY 21 21 - "${_IMPORT_PREFIX}/include" 22 22 - "${ROCM_PATH}/include" 23 - - /opt/rocm/include 24 23 + "@rocm_runtime@/include" 25 24 ) 26 25 27 - if (HSA_HEADER-NOTFOUND) 28 - @@ -99,7 +96,7 @@ if (HSA_HEADER-NOTFOUND) 26 + if (NOT HSA_HEADER) 27 + @@ -97,7 +94,7 @@ if (HSA_HEADER-NOTFOUND) 29 28 endif() 30 29 31 30 get_filename_component(HIP_COMPILER_INSTALL_PATH ${CMAKE_HIP_COMPILER} DIRECTORY)
+27 -1
pkgs/development/compilers/hip/hipamd-config-paths.patch
··· 7 7 endif() 8 8 else() 9 9 - set(HIP_CLANG_ROOT "${ROCM_PATH}/llvm") 10 - + set(HIP_CLANG_ROOT "@llvm@") 10 + + set(HIP_CLANG_ROOT "@clang@") 11 11 endif() 12 12 if(NOT HIP_CXX_COMPILER) 13 13 set(HIP_CXX_COMPILER ${CMAKE_CXX_COMPILER}) ··· 45 45 ) 46 46 endif() 47 47 endif() 48 + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt 49 + index 83866d83..4125d3aa 100644 50 + --- a/src/CMakeLists.txt 51 + +++ b/src/CMakeLists.txt 52 + @@ -178,7 +178,7 @@ if(__HIP_ENABLE_PCH) 53 + ${ROCM_PATH}/llvm) 54 + # find_package(LLVM) returns the lib/cmake/llvm location. We require the root. 55 + if(NOT DEFINED HIP_LLVM_ROOT) 56 + - set(HIP_LLVM_ROOT "${LLVM_DIR}/../../..") 57 + + set(HIP_LLVM_ROOT "@clang@") 58 + endif() 59 + 60 + execute_process(COMMAND sh -c "${CMAKE_CURRENT_SOURCE_DIR}/hip_embed_pch.sh ${HIP_COMMON_INCLUDE_DIR} ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/include ${HIP_LLVM_ROOT}" COMMAND_ECHO STDERR RESULT_VARIABLE EMBED_PCH_RC) 61 + diff --git a/src/hip_embed_pch.sh b/src/hip_embed_pch.sh 62 + index 0a1572b2..aa855d63 100755 63 + --- a/src/hip_embed_pch.sh 64 + +++ b/src/hip_embed_pch.sh 65 + @@ -149,7 +149,7 @@ EOF 66 + 67 + $LLVM_DIR/bin/clang -cc1 -O3 -emit-pch -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -std=c++17 -fgnuc-version=4.2.1 -o $tmp/hip_wave64.pch -x hip-cpp-output - <$tmp/pch_wave64.cui && 68 + 69 + - $LLVM_DIR/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj && 70 + + @llvm@/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj && 71 + 72 + rm -rf $tmp 73 + }
+2 -2
pkgs/development/compilers/llvm/rocm/default.nix
··· 1 1 { stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }: 2 2 3 3 let 4 - version = "5.2.3"; 4 + version = "5.3.0"; 5 5 src = fetchFromGitHub { 6 6 owner = "RadeonOpenCompute"; 7 7 repo = "llvm-project"; 8 8 rev = "rocm-${version}"; 9 - hash = "sha256-sudH8hnjReyuCFm2CBEPd8W88SjAARgCd1MTIJaDjTI="; 9 + hash = "sha256-MN7W4Gl6+a1nCozdn9gMzIXOiBPquoOP87x26boeSCA="; 10 10 }; 11 11 in rec { 12 12 clang = wrapCCWith rec {
+3 -3
pkgs/development/libraries/rocclr/default.nix
··· 7 7 8 8 stdenv.mkDerivation rec { 9 9 pname = "rocclr"; 10 - version = "5.2.3"; 10 + version = "5.3.0"; 11 11 12 12 src = fetchFromGitHub { 13 13 owner = "ROCm-Developer-Tools"; 14 14 repo = "ROCclr"; 15 15 rev = "rocm-${version}"; 16 - hash = "sha256-DER6PBYXmZRgwFNVU5rpn87HrXMR+HnQf8cwHioUals="; 16 + hash = "sha256-l14+l8FkiFmGuRZ9dyD/PEYH9nHVRRg1vMXMnVhg3K4="; 17 17 }; 18 18 19 19 patches = [ ··· 53 53 description = "Source package of the Radeon Open Compute common language runtime"; 54 54 homepage = "https://github.com/ROCm-Developer-Tools/ROCclr"; 55 55 license = licenses.mit; 56 - maintainers = with maintainers; [ lovesegfault ]; 56 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 57 57 # rocclr seems to have some AArch64 ifdefs, but does not seem 58 58 # to be supported yet by the build infrastructure. Recheck in 59 59 # the future.
+236 -95
pkgs/development/libraries/rocm-comgr/cmake.patch
··· 1 1 diff --git a/CMakeLists.txt b/CMakeLists.txt 2 - index eac270a..27610ec 100644 2 + index 62b857b..d21c7f4 100644 3 3 --- a/CMakeLists.txt 4 4 +++ b/CMakeLists.txt 5 - @@ -53,10 +53,6 @@ set(SOURCES 6 - 7 - if(COMGR_BUILD_SHARED_LIBS) 8 - add_library(amd_comgr SHARED ${SOURCES}) 9 - - # Windows doesn't have a strip utility, so CMAKE_STRIP won't be set. 10 - - if((CMAKE_BUILD_TYPE STREQUAL "Release") AND NOT ("${CMAKE_STRIP}" STREQUAL "")) 11 - - add_custom_command(TARGET amd_comgr POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:amd_comgr>) 12 - - endif() 13 - else() 14 - add_library(amd_comgr STATIC ${SOURCES}) 15 - endif() 16 - @@ -141,8 +137,8 @@ if (UNIX) 5 + @@ -147,8 +147,8 @@ if (UNIX) 17 6 list(APPEND AMD_COMGR_PUBLIC_LINKER_OPTIONS -pthread) 18 7 if (NOT APPLE AND COMGR_BUILD_SHARED_LIBS) 19 8 configure_file( ··· 24 13 list(APPEND AMD_COMGR_PRIVATE_LINKER_OPTIONS 25 14 "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/src/exportmap") 26 15 # When building a shared library with -fsanitize=address we can't be 27 - @@ -154,6 +150,9 @@ if (UNIX) 28 - -Wl,--no-undefined) 29 - endif() 30 - endif() 31 - + 32 - + # Strip in release build 33 - + set_target_properties(amd_comgr PROPERTIES LINK_FLAGS_RELEASE -s) 34 - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 35 - list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS 36 - "/wd4244" #[[Suppress 'argument' : conversion from 'type1' to 'type2', possible loss of data]] 37 - @@ -169,10 +168,6 @@ endif() 16 + @@ -175,10 +175,6 @@ endif() 38 17 # the shared header. 39 18 list(APPEND AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS AMD_COMGR_EXPORT) 40 19 ··· 45 24 include(bc2h) 46 25 include(opencl_pch) 47 26 include(DeviceLibs) 48 - @@ -203,8 +198,11 @@ target_compile_definitions(amd_comgr 49 - PRIVATE "${AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS}") 50 - target_include_directories(amd_comgr 51 - PUBLIC 52 - - $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> 53 - - $<INSTALL_INTERFACE:include>) 54 - + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>) 55 - + 27 + @@ -212,10 +208,14 @@ target_include_directories(amd_comgr 28 + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> 29 + $<INSTALL_INTERFACE:include>) 30 + 56 31 +configure_file( 57 32 + include/amd_comgr.h.in 58 33 + include/amd_comgr.h @ONLY) 59 - 34 + + 60 35 set(AMD_COMGR_CONFIG_NAME amd_comgr-config.cmake) 61 36 set(AMD_COMGR_TARGETS_NAME amd_comgr-targets.cmake) 62 - @@ -220,29 +218,30 @@ if (NOT COMGR_BUILD_SHARED_LIBS) 37 + set(AMD_COMGR_VERSION_NAME amd_comgr-config-version.cmake) 38 + -set(AMD_COMGR_PACKAGE_PREFIX ${CMAKE_INSTALL_LIBDIR}/cmake/amd_comgr) 39 + +set(AMD_COMGR_PACKAGE_PREFIX cmake/amd_comgr) 40 + 41 + # Generate the build-tree package. 42 + set(AMD_COMGR_PREFIX_CODE) 43 + @@ -226,13 +226,13 @@ if (NOT COMGR_BUILD_SHARED_LIBS) 63 44 endif() 64 45 65 46 set(AMD_COMGR_TARGETS_PATH 66 47 - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 67 - -set(AMD_COMGR_VERSION_PATH 48 + + "${CMAKE_CURRENT_BINARY_DIR}/lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 49 + set(AMD_COMGR_VERSION_PATH 68 50 - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_VERSION_NAME}") 69 - -export(TARGETS amd_comgr 51 + + "${CMAKE_CURRENT_BINARY_DIR}/lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_VERSION_NAME}") 52 + export(TARGETS amd_comgr 70 53 - FILE "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 71 - + "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 54 + + FILE "lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 72 55 configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in" 73 56 - "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_CONFIG_NAME}" 74 - + ${AMD_COMGR_CONFIG_NAME} 57 + + "lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_CONFIG_NAME}" 75 58 @ONLY) 76 - -write_basic_package_version_file("${AMD_COMGR_VERSION_PATH}" 77 - +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_VERSION_NAME}" 59 + write_basic_package_version_file("${AMD_COMGR_VERSION_PATH}" 78 60 VERSION "${amd_comgr_VERSION}" 79 - COMPATIBILITY SameMajorVersion) 80 - 81 - install(TARGETS amd_comgr 82 - EXPORT amd_comgr_export 83 - - COMPONENT amd-comgr 84 - - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 85 - - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 86 - - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) 87 - + COMPONENT amd-comgr) 88 - +install(EXPORT amd_comgr_export 89 - + DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}" 90 - + FILE "${AMD_COMGR_TARGETS_NAME}") 61 + @@ -266,7 +266,7 @@ install(FILES 62 + set(AMD_COMGR_PREFIX_CODE " 63 + # Derive absolute install prefix from config file path. 64 + get_filename_component(AMD_COMGR_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") 65 + -string(REGEX REPLACE "/" ";" count "${AMD_COMGR_PACKAGE_PREFIX}") 66 + +string(REGEX REPLACE "/" ";" count "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}") 67 + foreach(p ${count}) 68 + set(AMD_COMGR_PREFIX_CODE "${AMD_COMGR_PREFIX_CODE} 69 + get_filename_component(AMD_COMGR_PREFIX \"\${AMD_COMGR_PREFIX}\" PATH)") 70 + @@ -278,20 +278,20 @@ if (NOT COMGR_BUILD_SHARED_LIBS) 71 + string(APPEND AMD_COMGR_PREFIX_CODE "find_dependency(LLD REQUIRED)\n") 72 + endif() 91 73 74 + -set(AMD_COMGR_TARGETS_PATH "\${AMD_COMGR_PREFIX}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 75 + +set(AMD_COMGR_TARGETS_PATH "\${AMD_COMGR_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 76 + configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in" 77 + - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install" 78 + + "${AMD_COMGR_CONFIG_NAME}.install" 79 + @ONLY) 92 80 install(FILES 93 - "${CMAKE_CURRENT_BINARY_DIR}/include/amd_comgr.h" 94 - COMPONENT amd-comgr 95 - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 96 - +install(FILES 97 - + "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}" 98 - + "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_VERSION_NAME}" 99 - + COMPONENT amd-comgr 100 - + DESTINATION ${AMD_COMGR_PACKAGE_PREFIX}) 81 + "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install" 82 + - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}" 83 + + DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}" 84 + RENAME "${AMD_COMGR_CONFIG_NAME}") 85 + install(EXPORT amd_comgr_export 86 + - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}" 87 + + DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}" 88 + FILE "${AMD_COMGR_TARGETS_NAME}") 89 + install(FILES 90 + "${AMD_COMGR_VERSION_PATH}" 91 + - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}") 92 + + DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}") 93 + 94 + if(TARGET clangFrontendTool) 95 + set(CLANG_LIBS 96 + diff --git a/cmake/DeviceLibs.cmake b/cmake/DeviceLibs.cmake 97 + index 27e9546..dfe1b57 100644 98 + --- a/cmake/DeviceLibs.cmake 99 + +++ b/cmake/DeviceLibs.cmake 100 + @@ -1,8 +1,7 @@ 101 + set(INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) 102 + 103 + set(GEN_LIBRARY_INC_FILE ${INC_DIR}/libraries.inc) 104 + - 105 + -file(WRITE ${GEN_LIBRARY_INC_FILE} "// Automatically generated file; DO NOT EDIT.\n") 106 + +set(GEN_LIBRARY_DEFS_INC_FILE ${INC_DIR}/libraries_defs.inc) 107 + 108 + # cmake does not provide a way to query targets produced by a project, 109 + # so we have to make one up. Ordinarily, individual library target 110 + @@ -23,6 +22,7 @@ if(NOT AMD_DEVICE_LIBS_TARGETS) 111 + message(FATAL_ERROR "Could not find list of device libraries") 112 + endif() 113 + 114 + +set(TARGETS_INCLUDES "") 115 + foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 116 + set(header ${AMDGCN_LIB_TARGET}.inc) 117 + 118 + @@ -54,75 +54,52 @@ foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 119 + add_custom_target(${AMDGCN_LIB_TARGET}_header DEPENDS ${INC_DIR}/${header}) 120 + add_dependencies(amd_comgr ${AMDGCN_LIB_TARGET}_header) 101 121 102 - install(FILES 103 - "README.md" 104 - @@ -251,37 +250,6 @@ install(FILES 105 - COMPONENT amd-comgr 106 - DESTINATION ${CMAKE_INSTALL_DATADIR}/amd_comgr) 122 + - file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"${header}\"\n") 123 + + list(APPEND TARGETS_INCLUDES "#include \"${header}\"") 124 + +endforeach() 125 + + 126 + +list(JOIN TARGETS_INCLUDES "\n" TARGETS_INCLUDES) 127 + +file(GENERATE OUTPUT ${GEN_LIBRARY_INC_FILE} CONTENT "${TARGETS_INCLUDES}") 128 + + 129 + +foreach(OPENCL_VERSION 1.2 2.0) 130 + + string(REPLACE . _ OPENCL_UNDERSCORE_VERSION ${OPENCL_VERSION}) 131 + + add_custom_command(OUTPUT ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc 132 + + COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl${OPENCL_VERSION}-c.pch 133 + + ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc 134 + + opencl${OPENCL_UNDERSCORE_VERSION}_c 135 + + DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl${OPENCL_VERSION}-c.pch 136 + + COMMENT "Generating opencl${OPENCL_VERSION}-c.inc" 137 + + ) 138 + + set_property(DIRECTORY APPEND PROPERTY 139 + + ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc) 140 + + add_custom_target(opencl${OPENCL_VERSION}-c.inc_target DEPENDS ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc) 141 + + add_dependencies(amd_comgr opencl${OPENCL_VERSION}-c.inc_target) 142 + endforeach() 107 143 108 - -# Generate the install-tree package. 109 - -set(AMD_COMGR_PREFIX_CODE " 110 - -# Derive absolute install prefix from config file path. 111 - -get_filename_component(AMD_COMGR_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") 112 - -string(REGEX REPLACE "/" ";" count "${AMD_COMGR_PACKAGE_PREFIX}") 113 - -foreach(p ${count}) 114 - - set(AMD_COMGR_PREFIX_CODE "${AMD_COMGR_PREFIX_CODE} 115 - -get_filename_component(AMD_COMGR_PREFIX \"\${AMD_COMGR_PREFIX}\" PATH)") 116 - -endforeach() 144 + -add_custom_command(OUTPUT ${INC_DIR}/opencl1.2-c.inc 145 + - COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.pch 146 + - ${INC_DIR}/opencl1.2-c.inc 147 + - opencl1_2_c 148 + - DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.pch 149 + - COMMENT "Generating opencl1.2-c.inc" 150 + -) 151 + -set_property(DIRECTORY APPEND PROPERTY 152 + - ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl1.2-c.inc) 153 + -add_custom_target(opencl1.2-c.inc_target DEPENDS ${INC_DIR}/opencl1.2-c.inc) 154 + -add_dependencies(amd_comgr opencl1.2-c.inc_target) 155 + -file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"opencl1.2-c.inc\"\n") 117 156 - 118 - -if (NOT COMGR_BUILD_SHARED_LIBS) 119 - - string(APPEND AMD_COMGR_PREFIX_CODE "\ninclude(CMakeFindDependencyMacro)\n") 120 - - string(APPEND AMD_COMGR_PREFIX_CODE "find_dependency(Clang REQUIRED)\n") 121 - - string(APPEND AMD_COMGR_PREFIX_CODE "find_dependency(LLD REQUIRED)\n") 122 - -endif() 157 + -add_custom_command(OUTPUT ${INC_DIR}/opencl2.0-c.inc 158 + - COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.pch 159 + - ${INC_DIR}/opencl2.0-c.inc 160 + - opencl2_0_c 161 + - DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.pch 162 + - COMMENT "Generating opencl2.0-c.inc" 163 + -) 164 + -set_property(DIRECTORY APPEND PROPERTY 165 + - ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl2.0-c.inc) 166 + -add_custom_target(opencl2.0-c.inc_target DEPENDS ${INC_DIR}/opencl2.0-c.inc) 167 + -add_dependencies(amd_comgr opencl2.0-c.inc_target) 168 + -file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"opencl2.0-c.inc\"\n") 123 169 - 124 - -set(AMD_COMGR_TARGETS_PATH "\${AMD_COMGR_PREFIX}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 125 - -configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in" 126 - - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install" 127 - - @ONLY) 128 - -install(FILES 129 - - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install" 130 - - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}" 131 - - RENAME "${AMD_COMGR_CONFIG_NAME}") 132 - -install(EXPORT amd_comgr_export 133 - - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}" 134 - - FILE "${AMD_COMGR_TARGETS_NAME}") 135 - -install(FILES 136 - - "${AMD_COMGR_VERSION_PATH}" 137 - - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}") 170 + -# Generate function to select libraries for a given GFXIP number. 171 + -file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"llvm/ADT/StringRef.h\"\n") 172 + -file(APPEND ${GEN_LIBRARY_INC_FILE} 173 + - "static std::tuple<const char*, const void*, size_t> get_oclc_isa_version(llvm::StringRef gfxip) {") 174 + +set(TARGETS_DEFS "") 175 + +list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_TARGET\n#define AMD_DEVICE_LIBS_TARGET(t)\n#endif") 176 + +list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_GFXIP\n#define AMD_DEVICE_LIBS_GFXIP(t, g)\n#endif") 177 + +list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_FUNCTION\n#define AMD_DEVICE_LIBS_FUNCTION(t, f)\n#endif") 178 + +list(APPEND TARGETS_DEFS "") 179 + foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 180 + + list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_TARGET(${AMDGCN_LIB_TARGET})") 181 + + # Generate function to select libraries for a given GFXIP number. 182 + if (${AMDGCN_LIB_TARGET} MATCHES "^oclc_isa_version_.+$") 183 + string(REGEX REPLACE "^oclc_isa_version_(.+)$" "\\1" gfxip ${AMDGCN_LIB_TARGET}) 184 + - file(APPEND ${GEN_LIBRARY_INC_FILE} 185 + - "if (gfxip == \"${gfxip}\") return std::make_tuple(\"${AMDGCN_LIB_TARGET}.bc\", ${AMDGCN_LIB_TARGET}_lib, ${AMDGCN_LIB_TARGET}_lib_size);") 186 + + list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_GFXIP(${AMDGCN_LIB_TARGET}, \"${gfxip}\")") 187 + endif() 188 + -endforeach() 189 + -file(APPEND ${GEN_LIBRARY_INC_FILE} 190 + - "return std::make_tuple(nullptr, nullptr, 0); }") 138 191 - 139 - set(CLANG_LIBS 140 - clangFrontendTool) 192 + -# Generate function to select libraries for given feature. 193 + -foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 194 + + # Generate function to select libraries for given feature. 195 + if (${AMDGCN_LIB_TARGET} MATCHES "^oclc_.*_on$") 196 + string(REGEX REPLACE "^oclc_(.*)_on" "\\1" function ${AMDGCN_LIB_TARGET}) 197 + - file(APPEND ${GEN_LIBRARY_INC_FILE} 198 + - "static std::tuple<const char*, const void*, size_t> get_oclc_${function}(bool on) { \ 199 + - return std::make_tuple( \ 200 + - on ? \"oclc_${function}_on_lib.bc\" : \"oclc_${function}_off_lib.bc\", \ 201 + - on ? oclc_${function}_on_lib : oclc_${function}_off_lib, \ 202 + - on ? oclc_${function}_on_lib_size : oclc_${function}_off_lib_size \ 203 + - ); }") 204 + + list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_FUNCTION(${AMDGCN_LIB_TARGET}, ${function})") 205 + endif() 206 + endforeach() 207 + 208 + -# Generate function yield all libraries. 209 + -file(APPEND ${GEN_LIBRARY_INC_FILE} "\n#include \"llvm/ADT/ArrayRef.h\"\n") 210 + -file(APPEND ${GEN_LIBRARY_INC_FILE} 211 + - "llvm::ArrayRef<std::tuple<llvm::StringRef, llvm::StringRef>> COMGR::getDeviceLibraries() { \ 212 + - static std::tuple<llvm::StringRef, llvm::StringRef> DeviceLibs[] = {") 213 + -foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 214 + - file(APPEND ${GEN_LIBRARY_INC_FILE} 215 + - "{\"${AMDGCN_LIB_TARGET}.bc\", llvm::StringRef(reinterpret_cast<const char *>(${AMDGCN_LIB_TARGET}_lib), ${AMDGCN_LIB_TARGET}_lib_size)},") 216 + -endforeach() 217 + -file(APPEND ${GEN_LIBRARY_INC_FILE} 218 + - "}; \ 219 + - return DeviceLibs; \ 220 + - }") 221 + +list(APPEND TARGETS_DEFS "") 222 + +list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_TARGET") 223 + +list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_GFXIP") 224 + +list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_FUNCTION") 225 + + 226 + +list(JOIN TARGETS_DEFS "\n" TARGETS_DEFS) 227 + +file(GENERATE OUTPUT ${GEN_LIBRARY_DEFS_INC_FILE} CONTENT "${TARGETS_DEFS}") 141 228 229 + include_directories(${INC_DIR}) 142 230 diff --git a/cmake/bc2h.cmake b/cmake/bc2h.cmake 143 231 index 146fe2b..9134985 100644 144 232 --- a/cmake/bc2h.cmake ··· 222 310 223 311 add_executable(bc2h ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c) 224 312 if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 313 + diff --git a/src/comgr-device-libs.cpp b/src/comgr-device-libs.cpp 314 + index 4d2b914..80786d1 100644 315 + --- a/src/comgr-device-libs.cpp 316 + +++ b/src/comgr-device-libs.cpp 317 + @@ -35,7 +35,7 @@ 318 + 319 + #include "comgr-device-libs.h" 320 + #include "comgr.h" 321 + -#include "libraries.inc" 322 + +#include "comgr-libraries.h" 323 + #include "llvm/ADT/StringSwitch.h" 324 + #include <cstdint> 325 + 326 + diff --git a/src/comgr-libraries.h b/src/comgr-libraries.h 327 + new file mode 100644 328 + index 0000000..3caa0a0 329 + --- /dev/null 330 + +++ b/src/comgr-libraries.h 331 + @@ -0,0 +1,34 @@ 332 + +#include "libraries.inc" 333 + +#include "opencl1.2-c.inc" 334 + +#include "opencl2.0-c.inc" 335 + +#include "llvm/ADT/StringRef.h" 336 + +#include "llvm/ADT/ArrayRef.h" 337 + + 338 + +static std::tuple<const char*, const void*, size_t> get_oclc_isa_version(llvm::StringRef gfxip) { 339 + +#define AMD_DEVICE_LIBS_GFXIP(target, target_gfxip) \ 340 + + if (gfxip == target_gfxip) return std::make_tuple(#target ".bc", target##_lib, target##_lib_size); 341 + +#include "libraries_defs.inc" 342 + + 343 + + return std::make_tuple(nullptr, nullptr, 0); 344 + +} 345 + + 346 + +#define AMD_DEVICE_LIBS_FUNCTION(target, function) \ 347 + + static std::tuple<const char*, const void*, size_t> get_oclc_##function(bool on) { \ 348 + + return std::make_tuple( \ 349 + + on ? "oclc_" #function "_on_lib.bc" : "oclc_" #function "_off_lib.bc", \ 350 + + on ? oclc_##function##_on_lib : oclc_##function##_off_lib, \ 351 + + on ? oclc_##function##_on_lib_size : oclc_##function##_off_lib_size \ 352 + + ); \ 353 + + } 354 + +#include "libraries_defs.inc" 355 + + 356 + +llvm::ArrayRef<std::tuple<llvm::StringRef, llvm::StringRef>> COMGR::getDeviceLibraries() { 357 + + static std::tuple<llvm::StringRef, llvm::StringRef> DeviceLibs[] = { 358 + +#define AMD_DEVICE_LIBS_TARGET(target) \ 359 + + {#target ".bc", llvm::StringRef(reinterpret_cast<const char *>(target##_lib), target##_lib_size)}, 360 + +#include "libraries_defs.inc" 361 + + }; 362 + + return DeviceLibs; 363 + +} 364 + + 365 + +
+3 -4
pkgs/development/libraries/rocm-comgr/default.nix
··· 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "rocm-comgr"; 5 - version = "5.2.0"; 5 + version = "5.3.0"; 6 6 7 7 src = fetchFromGitHub { 8 8 owner = "RadeonOpenCompute"; 9 9 repo = "ROCm-CompilerSupport"; 10 10 rev = "rocm-${version}"; 11 - hash = "sha256-5C5bRdrt3xZAlRgtiIRTMAuwsFvVM4Win96P5+Pf5ZM="; 11 + hash = "sha256-LQyMhqcWm8zqt6138fnT7EOq/F8bG3Iuf04PTemVQmg="; 12 12 }; 13 13 14 14 sourceRoot = "source/lib/comgr"; ··· 18 18 buildInputs = [ clang rocm-device-libs llvm ]; 19 19 20 20 cmakeFlags = [ 21 - "-DCMAKE_BUILD_TYPE=Release" 22 21 "-DCMAKE_C_COMPILER=${clang}/bin/clang" 23 22 "-DCMAKE_CXX_COMPILER=${clang}/bin/clang++" 24 23 "-DCMAKE_PREFIX_PATH=${llvm}/lib/cmake/llvm" ··· 39 38 description = "APIs for compiling and inspecting AMDGPU code objects"; 40 39 homepage = "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/tree/amd-stg-open/lib/comgr"; 41 40 license = licenses.ncsa; 42 - maintainers = with maintainers; [ lovesegfault ]; 41 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 43 42 platforms = platforms.linux; 44 43 }; 45 44 }
+43
pkgs/development/libraries/rocm-device-libs/cmake.patch
··· 1 + diff --git a/cmake/Packages.cmake b/cmake/Packages.cmake 2 + index 07c60eb..c736b3e 100644 3 + --- a/cmake/Packages.cmake 4 + +++ b/cmake/Packages.cmake 5 + @@ -12,24 +12,29 @@ set_target_properties(${target} PROPERTIES 6 + IMPORTED_LOCATION \"${target_path}\")") 7 + endforeach() 8 + configure_file(AMDDeviceLibsConfig.cmake.in 9 + - ${PACKAGE_PREFIX}/AMDDeviceLibsConfig.cmake 10 + + lib/cmake/AMDDeviceLibs/AMDDeviceLibsConfig.cmake 11 + @ONLY) 12 + 13 + 14 + set(install_path_suffix "amdgcn/bitcode") 15 + 16 + # Generate the install-tree package. 17 + -# We do not know the absolute path to the intall tree until we are installed, 18 + -# so we calculate it dynamically in AMD_DEVICE_LIBS_PREFIX_CODE and use 19 + -# relative paths in the target imports in AMD_DEVICE_LIBS_TARGET_CODE. 20 + -set(AMD_DEVICE_LIBS_PREFIX_CODE " 21 + +if(IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}") 22 + + set(AMD_DEVICE_LIBS_PREFIX_CODE "set(AMD_DEVICE_LIBS_PREFIX \"${CMAKE_INSTALL_PREFIX}\")") 23 + +else() 24 + + # We do not know the absolute path to the install tree until we are installed, 25 + + # so we calculate it dynamically in AMD_DEVICE_LIBS_PREFIX_CODE and use 26 + + # relative paths in the target imports in AMD_DEVICE_LIBS_TARGET_CODE. 27 + + set(AMD_DEVICE_LIBS_PREFIX_CODE " 28 + # Derive absolute install prefix from config file path. 29 + get_filename_component(AMD_DEVICE_LIBS_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") 30 + -string(REGEX REPLACE "/" ";" count "${PACKAGE_PREFIX}") 31 + -foreach(p ${count}) 32 + - set(AMD_DEVICE_LIBS_PREFIX_CODE "${AMD_DEVICE_LIBS_PREFIX_CODE} 33 + + string(REGEX REPLACE "/" ";" count "${PACKAGE_PREFIX}") 34 + + foreach(p ${count}) 35 + + set(AMD_DEVICE_LIBS_PREFIX_CODE "${AMD_DEVICE_LIBS_PREFIX_CODE} 36 + get_filename_component(AMD_DEVICE_LIBS_PREFIX \"\${AMD_DEVICE_LIBS_PREFIX}\" PATH)") 37 + -endforeach() 38 + + endforeach() 39 + +endif() 40 + + 41 + set(AMD_DEVICE_LIBS_TARGET_CODE) 42 + foreach(target ${AMDGCN_LIB_LIST}) 43 + get_target_property(target_name ${target} ARCHIVE_OUTPUT_NAME)
+5 -3
pkgs/development/libraries/rocm-device-libs/default.nix
··· 8 8 9 9 stdenv.mkDerivation rec { 10 10 pname = "rocm-device-libs"; 11 - version = "5.2.0"; 11 + version = "5.3.0"; 12 12 13 13 src = fetchFromGitHub { 14 14 owner = "RadeonOpenCompute"; 15 15 repo = "ROCm-Device-Libs"; 16 16 rev = "rocm-${version}"; 17 - hash = "sha256-TBCSznHyiaiOcBR9irybCnOgfqPiNNn4679PCQwrLhA="; 17 + hash = "sha256-rKMe0B/pkDek/ZU37trnJNa8aqvlwxobPb1+VTx/bJU="; 18 18 }; 19 19 20 20 nativeBuildInputs = [ cmake ]; ··· 27 27 "-DCLANG=${clang}/bin/clang" 28 28 ]; 29 29 30 + patches = [ ./cmake.patch ]; 31 + 30 32 passthru.updateScript = writeScript "update.sh" '' 31 33 #!/usr/bin/env nix-shell 32 34 #!nix-shell -i bash -p curl jq common-updater-scripts ··· 38 40 description = "Set of AMD-specific device-side language runtime libraries"; 39 41 homepage = "https://github.com/RadeonOpenCompute/ROCm-Device-Libs"; 40 42 license = licenses.ncsa; 41 - maintainers = with maintainers; [ lovesegfault ]; 43 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 42 44 platforms = platforms.linux; 43 45 }; 44 46 }
+3 -3
pkgs/development/libraries/rocm-opencl-runtime/default.nix
··· 22 22 23 23 stdenv.mkDerivation rec { 24 24 pname = "rocm-opencl-runtime"; 25 - version = "5.2.1"; 25 + version = "5.3.0"; 26 26 27 27 src = fetchFromGitHub { 28 28 owner = "RadeonOpenCompute"; 29 29 repo = "ROCm-OpenCL-Runtime"; 30 30 rev = "rocm-${version}"; 31 - hash = "sha256-Mk7Wssz34Uxtb9PRIEGrTn/tXtqxLMrq0damA/p/DsY="; 31 + hash = "sha256-QvAF25Zfq9d1M/KIsr2S+Ggxzqw/MQ2OVcm9ZNfjTa8="; 32 32 }; 33 33 34 34 nativeBuildInputs = [ cmake rocm-cmake ]; ··· 79 79 description = "OpenCL runtime for AMD GPUs, part of the ROCm stack"; 80 80 homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime"; 81 81 license = with licenses; [ asl20 mit ]; 82 - maintainers = with maintainers; [ acowley lovesegfault ]; 82 + maintainers = with maintainers; [ acowley lovesegfault Flakebi ]; 83 83 platforms = platforms.linux; 84 84 }; 85 85 }
+16 -9
pkgs/development/libraries/rocm-runtime/default.nix
··· 4 4 , writeScript 5 5 , addOpenGLRunpath 6 6 , cmake 7 + , pkg-config 7 8 , xxd 8 9 , elfutils 10 + , libdrm 9 11 , llvm 10 12 , numactl 11 13 , rocm-device-libs ··· 13 15 14 16 stdenv.mkDerivation rec { 15 17 pname = "rocm-runtime"; 16 - version = "5.2.0"; 18 + version = "5.3.0"; 17 19 18 20 src = fetchFromGitHub { 19 21 owner = "RadeonOpenCompute"; 20 22 repo = "ROCR-Runtime"; 21 23 rev = "rocm-${version}"; 22 - hash = "sha256-TY0YPgNzxBLXAj7fncLQ01cSJyydveOLHrimCmLS32o="; 24 + hash = "sha256-26E7vA2JlC50zmpaQfDrFMlgjAqmfTdp9/A8g5caDqI="; 23 25 }; 24 26 25 27 sourceRoot = "source/src"; 26 28 27 - nativeBuildInputs = [ cmake xxd ]; 29 + nativeBuildInputs = [ cmake pkg-config xxd ]; 28 30 29 - buildInputs = [ elfutils llvm numactl ]; 31 + buildInputs = [ elfutils libdrm llvm numactl ]; 30 32 31 - cmakeFlags = [ 32 - "-DBITCODE_DIR=${rocm-device-libs}/amdgcn/bitcode" 33 - "-DCMAKE_PREFIX_PATH=${rocm-thunk}" 34 - ]; 33 + cmakeFlags = [ "-DCMAKE_PREFIX_PATH=${rocm-thunk}" ]; 35 34 36 35 postPatch = '' 37 36 patchShebangs image/blit_src/create_hsaco_ascii_file.sh 37 + patchShebangs core/runtime/trap_handler/create_trap_handler_header.sh 38 + 39 + substituteInPlace CMakeLists.txt \ 40 + --replace 'hsa/include/hsa' 'include/hsa' 41 + 42 + # We compile clang before rocm-device-libs, so patch it in afterwards 43 + substituteInPlace image/blit_src/CMakeLists.txt \ 44 + --replace '-cl-denorms-are-zero' '-cl-denorms-are-zero --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode' 38 45 ''; 39 46 40 47 fixupPhase = '' ··· 52 59 description = "Platform runtime for ROCm"; 53 60 homepage = "https://github.com/RadeonOpenCompute/ROCR-Runtime"; 54 61 license = with licenses; [ ncsa ]; 55 - maintainers = with maintainers; [ lovesegfault ]; 62 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 56 63 }; 57 64 }
+3 -3
pkgs/development/libraries/rocm-thunk/default.nix
··· 9 9 10 10 stdenv.mkDerivation rec { 11 11 pname = "rocm-thunk"; 12 - version = "5.2.1"; 12 + version = "5.3.0"; 13 13 14 14 src = fetchFromGitHub { 15 15 owner = "RadeonOpenCompute"; 16 16 repo = "ROCT-Thunk-Interface"; 17 17 rev = "rocm-${version}"; 18 - hash = "sha256-iXhlEofPAQNxeZzDgdF1DdflIKfSI7rHGTqOybHnnHM="; 18 + hash = "sha256-cM78Bx6uYsxhvdqSVNgmqOUYQnUJVCA7mNpRNNSFv6k="; 19 19 }; 20 20 21 21 preConfigure = '' ··· 48 48 description = "Radeon open compute thunk interface"; 49 49 homepage = "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface"; 50 50 license = with licenses; [ bsd2 mit ]; 51 - maintainers = with maintainers; [ lovesegfault ]; 51 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 52 52 }; 53 53 }
+3 -3
pkgs/development/tools/build-managers/rocm-cmake/default.nix
··· 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "rocm-cmake"; 5 - version = "5.2.0"; 5 + version = "5.3.0"; 6 6 7 7 src = fetchFromGitHub { 8 8 owner = "RadeonOpenCompute"; 9 9 repo = "rocm-cmake"; 10 10 rev = "rocm-${version}"; 11 - hash = "sha256-2YALk3G5BhrsXZZHjGSSuk8tCi5sNGuB2VB4uvozyZo="; 11 + hash = "sha256-AOn3SLprHdeo2FwojQdhRAttUHuaWkO6WlymK8Q8lbc="; 12 12 }; 13 13 14 14 nativeBuildInputs = [ cmake ]; ··· 24 24 description = "CMake modules for common build tasks for the ROCm stack"; 25 25 homepage = "https://github.com/RadeonOpenCompute/rocm-cmake"; 26 26 license = licenses.mit; 27 - maintainers = with maintainers; [ ]; 27 + maintainers = with maintainers; [ Flakebi ]; 28 28 platforms = platforms.unix; 29 29 }; 30 30 }
+3 -3
pkgs/development/tools/rocminfo/default.nix
··· 7 7 # compilers to determine the desired target. 8 8 , defaultTargets ? []}: 9 9 stdenv.mkDerivation rec { 10 - version = "5.1.1"; 10 + version = "5.3.0"; 11 11 pname = "rocminfo"; 12 12 src = fetchFromGitHub { 13 13 owner = "RadeonOpenCompute"; 14 14 repo = "rocminfo"; 15 15 rev = "rocm-${version}"; 16 - sha256 = "sha256-x+QJJtUvgtNS4116tJFWdJOUS8yV4o10mbTAUuxerkE="; 16 + sha256 = "sha256-4wZTm5AZgG8xEd6uYqxWq4bWZgcSYZ2WYA1z4RAPF8U="; 17 17 }; 18 18 19 19 enableParallelBuilding = true; ··· 48 48 description = "ROCm Application for Reporting System Info"; 49 49 homepage = "https://github.com/RadeonOpenCompute/rocminfo"; 50 50 license = licenses.ncsa; 51 - maintainers = with maintainers; [ lovesegfault ]; 51 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 52 52 platforms = platforms.linux; 53 53 }; 54 54 }
+89
pkgs/tools/system/rocm-smi/cmake.patch
··· 1 + diff --git a/rocm_smi-backward-compat.cmake b/rocm_smi-backward-compat.cmake 2 + index aa8fd9c..59afce5 100644 3 + --- a/rocm_smi-backward-compat.cmake 4 + +++ b/rocm_smi-backward-compat.cmake 5 + @@ -72,7 +72,12 @@ function(generate_wrapper_header) 6 + set(include_guard "${include_guard}COMGR_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H") 7 + #set #include statement 8 + get_filename_component(file_name ${header_file} NAME) 9 + - set(include_statements "${include_statements}#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/${ROCM_SMI}/${file_name}\"\n") 10 + + if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR}) 11 + + set(include_dir "${CMAKE_INSTALL_INCLUDEDIR}") 12 + + else() 13 + + set(include_dir "../../../${CMAKE_INSTALL_INCLUDEDIR}") 14 + + endif() 15 + + set(include_statements "${include_statements}#include \"${include_dir}/${ROCM_SMI}/${file_name}\"\n") 16 + configure_file(${RSMI_WRAPPER_DIR}/header.hpp.in ${RSMI_WRAPPER_INC_DIR}/${file_name}) 17 + unset(include_guard) 18 + unset(include_statements) 19 + @@ -90,7 +95,12 @@ function(generate_wrapper_header) 20 + set(include_guard "${include_guard}COMGR_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H") 21 + #set #include statement 22 + get_filename_component(file_name ${header_file} NAME) 23 + - set(include_statements "${include_statements}#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/${OAM_TARGET_NAME}/${file_name}\"\n") 24 + + if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR}) 25 + + set(include_dir "${CMAKE_INSTALL_INCLUDEDIR}") 26 + + else() 27 + + set(include_dir "../../../${CMAKE_INSTALL_INCLUDEDIR}") 28 + + endif() 29 + + set(include_statements "${include_statements}#include \"${include_dir}/${OAM_TARGET_NAME}/${file_name}\"\n") 30 + configure_file(${RSMI_WRAPPER_DIR}/header.hpp.in ${OAM_WRAPPER_INC_DIR}/${file_name}) 31 + unset(include_guard) 32 + unset(include_statements) 33 + @@ -123,11 +133,16 @@ function(create_library_symlink) 34 + set(library_files "${LIB_RSMI}") 35 + endif() 36 + 37 + + if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR}) 38 + + set(install_libdir "${CMAKE_INSTALL_LIBDIR}") 39 + + else() 40 + + set(install_libdir "../../${CMAKE_INSTALL_LIBDIR}") 41 + + endif() 42 + foreach(file_name ${library_files}) 43 + add_custom_target(link_${file_name} ALL 44 + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 45 + COMMAND ${CMAKE_COMMAND} -E create_symlink 46 + - ../../${CMAKE_INSTALL_LIBDIR}/${file_name} ${RSMI_WRAPPER_LIB_DIR}/${file_name}) 47 + + ${install_libdir}/${file_name} ${RSMI_WRAPPER_LIB_DIR}/${file_name}) 48 + endforeach() 49 + 50 + file(MAKE_DIRECTORY ${OAM_WRAPPER_LIB_DIR}) 51 + @@ -151,11 +166,16 @@ function(create_library_symlink) 52 + set(library_files "${LIB_OAM}") 53 + endif() 54 + 55 + + if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR}) 56 + + set(install_libdir "${CMAKE_INSTALL_LIBDIR}") 57 + + else() 58 + + set(install_libdir "../../${CMAKE_INSTALL_LIBDIR}") 59 + + endif() 60 + foreach(file_name ${library_files}) 61 + add_custom_target(link_${file_name} ALL 62 + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 63 + COMMAND ${CMAKE_COMMAND} -E create_symlink 64 + - ../../${CMAKE_INSTALL_LIBDIR}/${file_name} ${OAM_WRAPPER_LIB_DIR}/${file_name}) 65 + + ${install_libdir}/${file_name} ${OAM_WRAPPER_LIB_DIR}/${file_name}) 66 + endforeach() 67 + 68 + endfunction() 69 + diff --git a/rocm_smi/CMakeLists.txt b/rocm_smi/CMakeLists.txt 70 + index c594eeb..d3ed39d 100755 71 + --- a/rocm_smi/CMakeLists.txt 72 + +++ b/rocm_smi/CMakeLists.txt 73 + @@ -105,10 +105,15 @@ endif () 74 + #file reorganization changes 75 + #rocm_smi.py moved to libexec/rocm_smi. so creating rocm-smi symlink 76 + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) 77 + +if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBEXECDIR}) 78 + + set(install_libexecdir "${CMAKE_INSTALL_LIBEXECDIR}") 79 + +else() 80 + + set(install_libexecdir "../${CMAKE_INSTALL_LIBEXECDIR}") 81 + +endif() 82 + add_custom_target(link-rocm-smi ALL 83 + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 84 + COMMAND ${CMAKE_COMMAND} -E create_symlink 85 + - ../${CMAKE_INSTALL_LIBEXECDIR}/${ROCM_SMI}/rocm_smi.py ${CMAKE_CURRENT_BINARY_DIR}/bin/rocm-smi) 86 + + ${install_libexecdir}/${ROCM_SMI}/rocm_smi.py ${CMAKE_CURRENT_BINARY_DIR}/bin/rocm-smi) 87 + 88 + ## Add the install directives for the runtime library. 89 + install(TARGETS ${ROCM_SMI_TARGET}
+4 -23
pkgs/tools/system/rocm-smi/default.nix
··· 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "rocm-smi"; 5 - version = "5.2.3"; 5 + version = "5.3.0"; 6 6 7 7 src = fetchFromGitHub { 8 8 owner = "RadeonOpenCompute"; 9 9 repo = "rocm_smi_lib"; 10 10 rev = "rocm-${version}"; 11 - hash = "sha256-D3ZH6xJe2C9rUCsJPOf9QlStecU90/iYi4wrXVvPff0="; 11 + hash = "sha256-UbGbkH2vhQ9gv3sSoG+mXap+MdcrP61TN5DcP5F/5nQ="; 12 12 }; 13 13 14 14 nativeBuildInputs = [ cmake wrapPython ]; 15 15 16 - postPatch = '' 17 - # Upstream ROCm is installed in an /opt directory. For this reason, 18 - # it does not completely follow FHS layout, creating top-level 19 - # rocm_smi, oam, and bindings top-level directories. Since rocm-smi 20 - # is a package that is typically installed, we change the paths to 21 - # follow FHS more closely. 22 - 23 - # rocm_smi libraries and headers go into lib and include. Bindings 24 - # go into lib/rocm_smi/bindings. 25 - substituteInPlace rocm_smi/CMakeLists.txt \ 26 - --replace "DESTINATION rocm_smi/" "DESTINATION " \ 27 - --replace "DESTINATION bindings" "DESTINATION lib/rocm_smi/bindings" \ 28 - --replace "../rocm_smi/bindings/rsmiBindings.py" "../lib/rocm_smi/bindings/rsmiBindings.py" \ 29 - --replace 'DESTINATION ''${ROCM_SMI}/' "DESTINATION " 30 - 31 - # oam libraries and headers go into lib and include. 32 - substituteInPlace oam/CMakeLists.txt \ 33 - --replace "DESTINATION oam/" "DESTINATION " \ 34 - --replace 'DESTINATION ''${OAM_NAME}/' "DESTINATION " 35 - ''; 16 + patches = [ ./cmake.patch ]; 36 17 37 18 postInstall = '' 38 19 wrapPythonProgramsIn $out ··· 49 30 description = "System management interface for AMD GPUs supported by ROCm"; 50 31 homepage = "https://github.com/RadeonOpenCompute/rocm_smi_lib"; 51 32 license = with licenses; [ mit ]; 52 - maintainers = with maintainers; [ lovesegfault ]; 33 + maintainers = with maintainers; [ lovesegfault Flakebi ]; 53 34 platforms = [ "x86_64-linux" ]; 54 35 }; 55 36 }