-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
hip: init at 4.3.1 #136445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
hip: init at 4.3.1 #136445
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e4459e5
llvmPackages_rocm: add compiler-rt
lovesegfault e3b026f
llvmPackages_rocm: 4.1.0 -> 4.3.1
lovesegfault bd698db
rocm-cmake: 4.1.0 -> 4.3.1
lovesegfault 4fa5582
rocm-comgr: 4.1.0 -> 4.3.1
lovesegfault 4165760
rocm-device-libs: 4.1.0 -> 4.3.1
lovesegfault ff514b0
rocm-thunk: 4.1.0 -> 4.3.1
lovesegfault 9d96c40
rocm-runtime: 4.1.0 -> 4.3.1
lovesegfault fae3bbc
rocm-smi: 4.1.0 -> 4.3.1
lovesegfault d212d1b
rocclr: 4.1.0 -> 4.3.1
lovesegfault 0bfc804
rocm-opencl-runtime: 4.1.0 -> 4.3.1
lovesegfault 0a8c0cf
rocm-opencl-icd: add lovesegfault as maintainer
lovesegfault 715eea8
rocminfo: init at 4.3.1
lovesegfault 75125b8
hip: init at 4.3.1
lovesegfault File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| { stdenv | ||
| , binutils-unwrapped | ||
| , clang | ||
| , clang-unwrapped | ||
| , cmake | ||
| , compiler-rt | ||
| , fetchFromGitHub | ||
| , fetchpatch | ||
| , file | ||
| , lib | ||
| , lld | ||
| , llvm | ||
| , makeWrapper | ||
| , perl | ||
| , python | ||
| , rocclr | ||
| , rocm-comgr | ||
| , rocm-device-libs | ||
| , rocm-opencl-runtime | ||
| , rocm-runtime | ||
| , rocm-thunk | ||
| , rocminfo | ||
| , writeText | ||
| }: | ||
|
|
||
| stdenv.mkDerivation rec { | ||
| name = "hip"; | ||
| version = "4.3.1"; | ||
| src = fetchFromGitHub { | ||
| owner = "ROCm-Developer-Tools"; | ||
| repo = "HIP"; | ||
| rev = "rocm-${version}"; | ||
| sha256 = "sha256-dUdP32H0u6kVItS+VUE549vvxkV1mSN84HvyfeK2hEE="; | ||
| }; | ||
|
|
||
| # FIXME: https://github.com/ROCm-Developer-Tools/HIP/issues/2317 | ||
| postPatch = '' | ||
| cp ${rocm-opencl-runtime.src}/amdocl/cl_vk_amd.hpp amdocl/ | ||
| ''; | ||
|
|
||
| nativeBuildInputs = [ cmake python makeWrapper ]; | ||
| propagatedBuildInputs = [ | ||
| clang | ||
| compiler-rt | ||
| lld | ||
| llvm | ||
| rocclr | ||
| rocm-comgr | ||
| rocm-device-libs | ||
| rocm-runtime | ||
| rocm-thunk | ||
| rocminfo | ||
| ]; | ||
|
|
||
| preConfigure = '' | ||
| export HIP_CLANG_PATH=${clang}/bin | ||
| export DEVICE_LIB_PATH=${rocm-device-libs}/lib | ||
| ''; | ||
|
|
||
| # The patch version is the last two digits of year + week number + | ||
| # day in the week: date -d "2021-07-25" +%y%U%w | ||
| workweek = "21300"; | ||
|
|
||
| cmakeFlags = [ | ||
| "-DHSA_PATH=${rocm-runtime}" | ||
| "-DHIP_COMPILER=clang" | ||
| "-DHIP_PLATFORM=amd" | ||
| "-DHIP_VERSION_GITDATE=${workweek}" | ||
| "-DCMAKE_C_COMPILER=${clang}/bin/clang" | ||
| "-DCMAKE_CXX_COMPILER=${clang}/bin/clang++" | ||
| "-DLLVM_ENABLE_RTTI=ON" | ||
| "-DLIBROCclr_STATIC_DIR=${rocclr}/lib/cmake" | ||
| "-DROCclr_DIR=${rocclr}" | ||
| "-DHIP_CLANG_ROOT=${clang-unwrapped}" | ||
| ]; | ||
|
|
||
| patches = [ | ||
| (fetchpatch { | ||
| name = "no-git-during-build"; | ||
| url = "https://github.com/acowley/HIP/commit/310b7e972cfb23216250c0240ba6134741679aee.patch"; | ||
| sha256 = "08ky7v1yvajabn9m5x3afzrnz38gnrgc7vgqlbyr7s801c383ha1"; | ||
| }) | ||
| (fetchpatch { | ||
| name = "use-PATH-when-compiling-pch"; | ||
| url = "https://github.com/acowley/HIP/commit/bfb4dd1eafa9714a2c05a98229cc35ffa3429b37.patch"; | ||
| sha256 = "1wp0m32df7pf4rhx3k5n750fd7kz10zr60z0wllb0mw6h00w6xpz"; | ||
| }) | ||
| ]; | ||
|
|
||
| # - fix bash paths | ||
| # - fix path to rocm_agent_enumerator | ||
| # - fix hcc path | ||
| # - fix hcc version parsing | ||
| # - add linker flags for libhsa-runtime64 and hc_am since libhip_hcc | ||
| # refers to them. | ||
| prePatch = '' | ||
| for f in $(find bin -type f); do | ||
| sed -e 's,#!/usr/bin/perl,#!${perl}/bin/perl,' \ | ||
| -e 's,#!/bin/bash,#!${stdenv.shell},' \ | ||
| -i "$f" | ||
| done | ||
|
|
||
| for f in $(find . -regex '.*\.cpp\|.*\.h\(pp\)?'); do | ||
| if grep -q __hcc_workweek__ "$f" ; then | ||
| substituteInPlace "$f" --replace '__hcc_workweek__' '${workweek}' | ||
| fi | ||
| done | ||
|
|
||
| sed 's,#!/usr/bin/python,#!${python}/bin/python,' -i hip_prof_gen.py | ||
|
|
||
| sed -e 's,$ROCM_AGENT_ENUM = "''${ROCM_PATH}/bin/rocm_agent_enumerator";,$ROCM_AGENT_ENUM = "${rocminfo}/bin/rocm_agent_enumerator";,' \ | ||
| -e "s,^\($HIP_LIB_PATH=\).*$,\1\"$out/lib\";," \ | ||
| -e 's,^\($HIP_CLANG_PATH=\).*$,\1"${clang}/bin";,' \ | ||
| -e 's,^\($DEVICE_LIB_PATH=\).*$,\1"${rocm-device-libs}/amdgcn/bitcode";,' \ | ||
| -e 's,^\($HIP_COMPILER=\).*$,\1"clang";,' \ | ||
| -e 's,^\($HIP_RUNTIME=\).*$,\1"ROCclr";,' \ | ||
| -e 's,^\([[:space:]]*$HSA_PATH=\).*$,\1"${rocm-runtime}";,'g \ | ||
| -e 's,\([[:space:]]*$HOST_OSNAME=\).*,\1"nixos";,' \ | ||
| -e 's,\([[:space:]]*$HOST_OSVER=\).*,\1"${lib.versions.majorMinor lib.version}";,' \ | ||
| -e 's,^\([[:space:]]*\)$HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");,\1$HIP_CLANG_INCLUDE_PATH = "${clang-unwrapped}/lib/clang/$HIP_CLANG_VERSION/include";,' \ | ||
| -e 's,^\([[:space:]]*$HIPCXXFLAGS .= " -isystem $HIP_CLANG_INCLUDE_PATH\)";,\1 -isystem ${rocm-runtime}/include";,' \ | ||
| -e 's,\($HIPCXXFLAGS .= " -isystem \\"$HIP_INCLUDE_PATH\\"\)" ;,\1 --rocm-path=${rocclr}";,' \ | ||
| -e "s,\$HIP_PATH/\(bin\|lib\),$out/\1,g" \ | ||
| -e "s,^\$HIP_LIB_PATH=\$ENV{'HIP_LIB_PATH'};,\$HIP_LIB_PATH=\"$out/lib\";," \ | ||
| -e 's,`file,`${file}/bin/file,g' \ | ||
| -e 's,`readelf,`${binutils-unwrapped}/bin/readelf,' \ | ||
| -e 's, ar , ${binutils-unwrapped}/bin/ar ,g' \ | ||
| -i bin/hipcc | ||
|
|
||
| sed -e 's,^\($HSA_PATH=\).*$,\1"${rocm-runtime}";,' \ | ||
| -e 's,^\($HIP_CLANG_PATH=\).*$,\1"${clang}/bin";,' \ | ||
| -e 's,^\($HIP_PLATFORM=\).*$,\1"amd";,' \ | ||
| -e 's,$HIP_CLANG_PATH/llc,${llvm}/bin/llc,' \ | ||
| -e 's, abs_path, Cwd::abs_path,' \ | ||
| -i bin/hipconfig | ||
|
|
||
| sed -e 's, abs_path, Cwd::abs_path,' -i bin/hipvars.pm | ||
|
|
||
| sed -e 's|_IMPORT_PREFIX}/../include|_IMPORT_PREFIX}/include|g' \ | ||
| -e 's|''${HIP_CLANG_ROOT}/lib/clang/\*/include|${clang-unwrapped}/lib/clang/*/include|' \ | ||
| -i hip-config.cmake.in | ||
| ''; | ||
|
|
||
| preInstall = '' | ||
| mkdir -p $out/lib/cmake | ||
| ''; | ||
|
|
||
| # The upstream ROCclr setup wants everything built into the same | ||
| # ROCclr output directory. We copy things into the HIP output | ||
| # directory, since it is downstream of ROCclr in terms of dependency | ||
| # direction. Thus we have device-libs and rocclr pieces in the HIP | ||
| # output directory. | ||
| postInstall = '' | ||
| mkdir -p $out/share | ||
| mv $out/lib/cmake $out/share/ | ||
| mv $out/cmake/* $out/share/cmake/hip | ||
| mkdir -p $out/lib | ||
| ln -s ${rocm-device-libs}/lib $out/lib/bitcode | ||
| mkdir -p $out/include | ||
| ln -s ${clang-unwrapped}/lib/clang/11.0.0/include $out/include/clang | ||
| ln -s ${rocclr}/lib/*.* $out/lib | ||
| ln -s ${rocclr}/include/* $out/include | ||
| wrapProgram $out/bin/hipcc --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin --prefix PATH : ${lld}/bin --set NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt} 1 --prefix NIX_LDFLAGS ' ' -L${compiler-rt}/lib --prefix NIX_LDFLAGS_FOR_TARGET ' ' -L${compiler-rt}/lib | ||
| wrapProgram $out/bin/hipconfig --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin | ||
| ''; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
pkgs/development/compilers/llvm/rocm/compiler-rt/compiler-rt-codesign.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001 | ||
| From: Will Dietz <w@wdtz.org> | ||
| Date: Tue, 19 Sep 2017 13:13:06 -0500 | ||
| Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that | ||
| needs it | ||
|
|
||
| --- | ||
| cmake/Modules/AddCompilerRT.cmake | 8 ------ | ||
| test/asan/CMakeLists.txt | 52 --------------------------------------- | ||
| test/tsan/CMakeLists.txt | 47 ----------------------------------- | ||
| 3 files changed, 107 deletions(-) | ||
|
|
||
| diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake | ||
| index bc5fb9ff7..b64eb4246 100644 | ||
| --- a/cmake/Modules/AddCompilerRT.cmake | ||
| +++ b/cmake/Modules/AddCompilerRT.cmake | ||
| @@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type) | ||
| set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "") | ||
| set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib") | ||
| endif() | ||
| - if(APPLE) | ||
| - # Ad-hoc sign the dylibs | ||
| - add_custom_command(TARGET ${libname} | ||
| - POST_BUILD | ||
| - COMMAND codesign --sign - $<TARGET_FILE:${libname}> | ||
| - WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} | ||
| - ) | ||
| - endif() | ||
| endif() | ||
| install(TARGETS ${libname} | ||
| ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} | ||
| 2.14.1 | ||
|
|
65 changes: 65 additions & 0 deletions
65
pkgs/development/compilers/llvm/rocm/compiler-rt/default.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| { stdenv, lib, version, src, cmake, python3, llvm, libcxxabi }: | ||
| stdenv.mkDerivation rec { | ||
| pname = "compiler-rt"; | ||
| inherit version src; | ||
|
|
||
| nativeBuildInputs = [ cmake python3 llvm ]; | ||
|
|
||
| NIX_CFLAGS_COMPILE = [ | ||
| "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" | ||
| ]; | ||
|
|
||
| cmakeFlags = [ | ||
| "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" | ||
| "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" | ||
| "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" | ||
| "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" | ||
| "-DCOMPILER_RT_BUILD_XRAY=OFF" | ||
| "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" | ||
| "-DCOMPILER_RT_BUILD_PROFILE=OFF" | ||
| "-DCMAKE_C_COMPILER_WORKS=ON" | ||
| "-DCMAKE_CXX_COMPILER_WORKS=ON" | ||
| "-DCOMPILER_RT_BAREMETAL_BUILD=ON" | ||
| "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" | ||
| "-DCOMPILER_RT_BUILD_BUILTINS=ON" | ||
| "-DCMAKE_C_FLAGS=-nodefaultlibs" | ||
| #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program | ||
| "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" | ||
| ]; | ||
|
|
||
| outputs = [ "out" "dev" ]; | ||
|
|
||
| patches = [ | ||
| ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory | ||
| ]; | ||
|
|
||
|
|
||
| # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks | ||
| # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra | ||
| # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd | ||
| # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by | ||
| # a flag and turn the flag off during the stdenv build. | ||
| postPatch = lib.optionalString (!stdenv.isDarwin) '' | ||
| substituteInPlace cmake/builtin-config-ix.cmake \ | ||
| --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' | ||
| ''; | ||
|
|
||
| # Hack around weird upsream RPATH bug | ||
| postInstall = '' | ||
| ln -s "$out/lib"/*/* "$out/lib" | ||
| ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o | ||
| ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o | ||
| ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o | ||
| ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o | ||
| ''; | ||
|
|
||
| enableParallelBuilding = true; | ||
|
|
||
| meta = with lib; { | ||
| description = "ROCm fork of the LLVM Compiler runtime libraries"; | ||
| homepage = "https://github.com/RadeonOpenCompute/llvm-project"; | ||
| license = licenses.ncsa; | ||
| maintainers = with maintainers; [ acowley danieldk lovesegfault ]; | ||
| platforms = platforms.linux; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.