Skip to content

Commit fc6c79f

Browse files
authored
Merge pull request #204378 from Madouura/pr/rocm-related
Fixes #203949
2 parents 6cb5aad + 75d7299 commit fc6c79f

32 files changed

Lines changed: 339 additions & 300 deletions

File tree

pkgs/build-support/fetchgithub/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ let
5959
) // privateAttrs // passthruAttrs // { inherit name; };
6060
in
6161

62-
fetcher fetcherArgs // { meta = newMeta; inherit rev; }
62+
fetcher fetcherArgs // { meta = newMeta; inherit rev owner repo; }

pkgs/development/compilers/hip/default.nix

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
let
3131
hip = stdenv.mkDerivation (finalAttrs: {
3232
pname = "hip";
33-
version = "5.3.3";
33+
version = "5.4.0";
3434

3535
src = fetchFromGitHub {
3636
owner = "ROCm-Developer-Tools";
3737
repo = "HIP";
3838
rev = "rocm-${finalAttrs.version}";
39-
hash = "sha256-kmRvrwnT0h2dBMI+H9d1vmeW3TmDBD+qW4YYhaMV2dE=";
39+
hash = "sha256-34SJM2n3jZWIS2uwpboWOXVFhaVWGK5ELPKD/cJc1zw=";
4040
};
4141

4242
patches = [
@@ -60,9 +60,6 @@ let
6060
-i "$f"
6161
done
6262
63-
substituteInPlace bin/hip_embed_pch.sh \
64-
--replace '$LLVM_DIR/bin/' ""
65-
6663
sed 's,#!/usr/bin/python,#!${python3.interpreter},' -i hip_prof_gen.py
6764
6865
sed -e 's,$ROCM_AGENT_ENUM = "''${ROCM_PATH}/bin/rocm_agent_enumerator";,$ROCM_AGENT_ENUM = "${rocminfo}/bin/rocm_agent_enumerator";,' \
@@ -110,13 +107,13 @@ let
110107
in
111108
stdenv.mkDerivation (finalAttrs: {
112109
pname = "hip";
113-
version = "5.3.3";
110+
version = "5.4.0";
114111

115112
src = fetchFromGitHub {
116113
owner = "ROCm-Developer-Tools";
117114
repo = "hipamd";
118115
rev = "rocm-${finalAttrs.version}";
119-
hash = "sha256-i7hT/j+V0LT6Va2XcQyyKXF1guoIyhcOHvn842wCRx4=";
116+
hash = "sha256-VL0vZVv099pZPX0J2pXPFvrhkVO/b6X+ZZDaD9B1hYI=";
120117
};
121118

122119
nativeBuildInputs = [ cmake python3 makeWrapper perl ];
@@ -168,10 +165,19 @@ stdenv.mkDerivation (finalAttrs: {
168165
wrapProgram $out/bin/hipconfig --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin
169166
'';
170167

168+
# TODO: Separate HIP and hipamd into separate derivations
171169
passthru.updateScript = writeScript "update.sh" ''
172170
#!/usr/bin/env nix-shell
173171
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
174-
version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -sL "https://api.github.com/repos/ROCm-Developer-Tools/HIP/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
172+
version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
173+
-sL "https://api.github.com/repos/ROCm-Developer-Tools/HIP/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
174+
175+
IFS='.' read -a version_arr <<< "$version"
176+
177+
if [ "''${#version_arr[*]}" == 2 ]; then
178+
version="''${version}.0"
179+
fi
180+
175181
current_version="$(grep "version =" pkgs/development/compilers/hip/default.nix | head -n1 | cut -d'"' -f2)"
176182
if [[ "$version" != "$current_version" ]]; then
177183
tarball_meta="$(nix-prefetch-github ROCm-Developer-Tools HIP --rev "rocm-$version")"
@@ -183,7 +189,15 @@ stdenv.mkDerivation (finalAttrs: {
183189
echo hip already up-to-date
184190
fi
185191
186-
version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -sL "https://api.github.com/repos/ROCm-Developer-Tools/hipamd/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
192+
version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
193+
-sL "https://api.github.com/repos/ROCm-Developer-Tools/hipamd/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
194+
195+
IFS='.' read -a version_arr <<< "$version"
196+
197+
if [ "''${#version_arr[*]}" == 2 ]; then
198+
version="''${version}.0"
199+
fi
200+
187201
current_version="$(grep "version =" pkgs/development/compilers/hip/default.nix | tail -n1 | cut -d'"' -f2)"
188202
if [[ "$version" != "$current_version" ]]; then
189203
tarball_meta="$(nix-prefetch-github ROCm-Developer-Tools hipamd --rev "rocm-$version")"

pkgs/development/compilers/llvm/rocm/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:
22

33
let
4-
version = "5.3.3";
4+
version = "5.4.0";
55
src = fetchFromGitHub {
66
owner = "RadeonOpenCompute";
77
repo = "llvm-project";
88
rev = "rocm-${version}";
9-
hash = "sha256-IKo7N8wWvh5PBrZ2mh1Vu5s3uUXhanqYtC4qLV/+JBs=";
9+
hash = "sha256-rlVo77h344PLGj/mIzsw+/ndWywsBsiKDXsEDpWSUno=";
1010
};
1111
in rec {
1212
clang = wrapCCWith rec {

pkgs/development/compilers/llvm/rocm/install-symlinks.patch

Lines changed: 0 additions & 23 deletions
This file was deleted.

pkgs/development/compilers/llvm/rocm/llvm.nix

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ in stdenv.mkDerivation (finalAttrs: {
4141
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
4242
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
4343
"-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}"
44-
"-DLLVM_ENABLE_PROJECTS=clang;lld;compiler-rt;clang-tools-extra"
44+
"-DLLVM_ENABLE_PROJECTS=clang;lld;compiler-rt"
4545
]
4646
++ lib.optionals enableManpages [
4747
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
@@ -52,34 +52,40 @@ in stdenv.mkDerivation (finalAttrs: {
5252
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
5353
];
5454

55-
patches = [
56-
./install-symlinks.patch
57-
];
58-
5955
postPatch = ''
6056
patchShebangs lib/OffloadArch/make_generated_offload_arch_h.sh
6157
substituteInPlace ../clang/cmake/modules/CMakeLists.txt \
6258
--replace 'FILES_MATCHING' 'NO_SOURCE_PERMISSIONS FILES_MATCHING'
6359
'';
6460

65-
updateScript = writeScript "update.sh" ''
66-
#!/usr/bin/env nix-shell
67-
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
68-
69-
version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -sL "https://api.github.com/repos/RadeonOpenCompute/llvm-project/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
70-
current_version="$(grep "version =" pkgs/development/compilers/llvm/rocm/default.nix | cut -d'"' -f2)"
71-
if [[ "$version" != "$current_version" ]]; then
72-
tarball_meta="$(nix-prefetch-github RadeonOpenCompute llvm-project --rev "rocm-$version")"
73-
tarball_hash="$(nix to-base64 sha256-$(jq -r '.sha256' <<< "$tarball_meta"))"
74-
sed -i "pkgs/development/compilers/llvm/rocm/default.nix" \
75-
-e 's,version = "\(.*\)",version = "'"$version"'",' \
76-
-e 's,hash = "\(.*\)",hash = "sha256-'"$tarball_hash"'",'
77-
else
78-
echo rocm-llvm already up-to-date
79-
fi
80-
'';
61+
passthru = {
62+
isClang = true;
63+
64+
updateScript = writeScript "update.sh" ''
65+
#!/usr/bin/env nix-shell
66+
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
67+
68+
version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
69+
-sL "https://api.github.com/repos/RadeonOpenCompute/llvm-project/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
70+
71+
IFS='.' read -a version_arr <<< "$version"
72+
73+
if [ "''${#version_arr[*]}" == 2 ]; then
74+
version="''${version}.0"
75+
fi
8176
82-
passthru.isClang = true;
77+
current_version="$(grep "version =" pkgs/development/compilers/llvm/rocm/default.nix | cut -d'"' -f2)"
78+
if [[ "$version" != "$current_version" ]]; then
79+
tarball_meta="$(nix-prefetch-github RadeonOpenCompute llvm-project --rev "rocm-$version")"
80+
tarball_hash="$(nix to-base64 sha256-$(jq -r '.sha256' <<< "$tarball_meta"))"
81+
sed -i "pkgs/development/compilers/llvm/rocm/default.nix" \
82+
-e 's,version = "\(.*\)",version = "'"$version"'",' \
83+
-e 's,hash = "\(.*\)",hash = "sha256-'"$tarball_hash"'",'
84+
else
85+
echo rocm-llvm already up-to-date
86+
fi
87+
'';
88+
};
8389

8490
meta = with lib; {
8591
description = "ROCm fork of the LLVM compiler infrastructure";

pkgs/development/libraries/clang-ocl/default.nix

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ lib
22
, stdenv
33
, fetchFromGitHub
4-
, writeScript
4+
, rocmUpdateScript
55
, cmake
66
, rocm-cmake
77
, rocm-device-libs
@@ -10,7 +10,7 @@
1010

1111
stdenv.mkDerivation (finalAttrs: {
1212
pname = "clang-ocl";
13-
version = "5.3.3";
13+
version = "5.4.0";
1414

1515
src = fetchFromGitHub {
1616
owner = "RadeonOpenCompute";
@@ -34,13 +34,11 @@ stdenv.mkDerivation (finalAttrs: {
3434
"-DCMAKE_CXX_COMPILER=clang++"
3535
];
3636

37-
passthru.updateScript = writeScript "update.sh" ''
38-
#!/usr/bin/env nix-shell
39-
#!nix-shell -i bash -p curl jq common-updater-scripts
40-
version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
41-
-sL "https://api.github.com/repos/RadeonOpenCompute/clang-ocl/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
42-
update-source-version clang-ocl "$version" --ignore-same-hash
43-
'';
37+
passthru.updateScript = rocmUpdateScript {
38+
name = finalAttrs.pname;
39+
owner = finalAttrs.src.owner;
40+
repo = finalAttrs.src.repo;
41+
};
4442

4543
meta = with lib; {
4644
description = "OpenCL compilation with clang compiler";

pkgs/development/libraries/composable_kernel/default.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{ lib
22
, stdenv
33
, fetchFromGitHub
4+
, unstableGitUpdater
45
, cmake
56
, rocm-cmake
67
, hip
@@ -13,7 +14,7 @@
1314

1415
stdenv.mkDerivation (finalAttrs: {
1516
pname = "composable_kernel";
16-
version = "unstable-2022-11-19";
17+
version = "unstable-2022-12-08";
1718

1819
outputs = [
1920
"out"
@@ -28,8 +29,8 @@ stdenv.mkDerivation (finalAttrs: {
2829
src = fetchFromGitHub {
2930
owner = "ROCmSoftwarePlatform";
3031
repo = "composable_kernel";
31-
rev = "43a889b72e3faabf04c16ff410d387ce28486c3e";
32-
hash = "sha256-DDRrWKec/RcOhW3CrN0gl9NZsp0Bjnja7HAiTcEh7qg=";
32+
rev = "d58b7f5155b44c8b608f3edc6a6eab314493ec1a";
33+
hash = "sha256-4nzyaWhPnY/0TygcoJAqVzdgfXOkf+o/BE2V9N+Bm7Q=";
3334
};
3435

3536
nativeBuildInputs = [
@@ -77,6 +78,8 @@ stdenv.mkDerivation (finalAttrs: {
7778
mv bin/example_* $example/bin
7879
'';
7980

81+
passthru.updateScript = unstableGitUpdater { };
82+
8083
meta = with lib; {
8184
description = "Performance portable programming model for machine learning tensor operators";
8285
homepage = "https://github.com/ROCmSoftwarePlatform/composable_kernel";

pkgs/development/libraries/hipcub/default.nix

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ lib
22
, stdenv
33
, fetchFromGitHub
4-
, writeScript
4+
, rocmUpdateScript
55
, cmake
66
, rocm-cmake
77
, rocm-runtime
@@ -18,7 +18,7 @@
1818
# CUB can also be used as a backend instead of rocPRIM.
1919
stdenv.mkDerivation (finalAttrs: {
2020
pname = "hipcub";
21-
version = "5.3.3";
21+
version = "5.4.0";
2222

2323
outputs = [
2424
"out"
@@ -32,7 +32,7 @@ stdenv.mkDerivation (finalAttrs: {
3232
owner = "ROCmSoftwarePlatform";
3333
repo = "hipCUB";
3434
rev = "rocm-${finalAttrs.version}";
35-
hash = "sha256-/GMZKbMD1sZQCM2FulM9jiJQ8ByYZinn0C8d/deFh0g=";
35+
hash = "sha256-ctt7jbVqHNHcOm/Lhg0IFbMZ6JChnMylG7fJgZtzFuM=";
3636
};
3737

3838
nativeBuildInputs = [
@@ -76,13 +76,11 @@ stdenv.mkDerivation (finalAttrs: {
7676
rmdir $out/bin
7777
'';
7878

79-
passthru.updateScript = writeScript "update.sh" ''
80-
#!/usr/bin/env nix-shell
81-
#!nix-shell -i bash -p curl jq common-updater-scripts
82-
version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
83-
-sL "https://api.github.com/repos/ROCmSoftwarePlatform/hipCUB/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
84-
update-source-version hipcub "$version" --ignore-same-hash
85-
'';
79+
passthru.updateScript = rocmUpdateScript {
80+
name = finalAttrs.pname;
81+
owner = finalAttrs.src.owner;
82+
repo = finalAttrs.src.repo;
83+
};
8684

8785
meta = with lib; {
8886
description = "Thin wrapper library on top of rocPRIM or CUB";

pkgs/development/libraries/hipsparse/default.nix

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ lib
22
, stdenv
33
, fetchFromGitHub
4-
, writeScript
4+
, rocmUpdateScript
55
, cmake
66
, rocm-cmake
77
, rocm-runtime
@@ -18,7 +18,7 @@
1818
# This can also use cuSPARSE as a backend instead of rocSPARSE
1919
stdenv.mkDerivation (finalAttrs: {
2020
pname = "hipsparse";
21-
version = "5.3.3";
21+
version = "5.4.0";
2222

2323
outputs = [
2424
"out"
@@ -30,7 +30,7 @@ stdenv.mkDerivation (finalAttrs: {
3030
owner = "ROCmSoftwarePlatform";
3131
repo = "hipSPARSE";
3232
rev = "rocm-${finalAttrs.version}";
33-
hash = "sha256-Phcihat774ZSAe1QetE/GSZzGlnCnvS9GwsHBHCaD4c=";
33+
hash = "sha256-JWjmMvqIm4in1aPq2UgYmL0eWjrrRBiU6vH3FnCZZ40=";
3434
};
3535

3636
nativeBuildInputs = [
@@ -112,13 +112,11 @@ stdenv.mkDerivation (finalAttrs: {
112112
rmdir $out/bin
113113
'';
114114

115-
passthru.updateScript = writeScript "update.sh" ''
116-
#!/usr/bin/env nix-shell
117-
#!nix-shell -i bash -p curl jq common-updater-scripts
118-
version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
119-
-sL "https://api.github.com/repos/ROCmSoftwarePlatform/hipSPARSE/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
120-
update-source-version hipsparse "$version" --ignore-same-hash
121-
'';
115+
passthru.updateScript = rocmUpdateScript {
116+
name = finalAttrs.pname;
117+
owner = finalAttrs.src.owner;
118+
repo = finalAttrs.src.repo;
119+
};
122120

123121
meta = with lib; {
124122
description = "ROCm SPARSE marshalling library";

0 commit comments

Comments
 (0)