-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
rocwmma: init at 0.8-5.3.3 #202685
Merged
Merged
rocwmma: init at 0.8-5.3.3 #202685
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions
19
pkgs/development/libraries/rocwmma/0000-dont-fetch-googletest.patch
This file contains 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,19 @@ | ||
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt | ||
index 7e0f2c8..db54eab 100644 | ||
--- a/test/CMakeLists.txt | ||
+++ b/test/CMakeLists.txt | ||
@@ -31,14 +31,6 @@ cmake_dependent_option( ROCWMMA_BUILD_BENCHMARK_TESTS "Build benchmarking tests" | ||
cmake_dependent_option( ROCWMMA_BUILD_EXTENDED_TESTS "Build extended test parameter coverage" OFF "ROCWMMA_BUILD_TESTS" OFF ) | ||
|
||
# Test/benchmark requires additional dependencies | ||
-include( FetchContent ) | ||
- | ||
-FetchContent_Declare( | ||
- googletest | ||
- URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip | ||
-) | ||
-FetchContent_MakeAvailable(googletest) | ||
- | ||
include(GoogleTest) | ||
|
||
set(ROCWMMA_TEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
This file contains 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,157 @@ | ||
{ lib | ||
, stdenv | ||
, fetchFromGitHub | ||
, writeScript | ||
, cmake | ||
, rocm-cmake | ||
, hip | ||
, openmp | ||
, gtest ? null | ||
, rocblas ? null | ||
, texlive ? null | ||
, doxygen ? null | ||
, sphinx ? null | ||
, python3Packages ? null | ||
, buildTests ? false | ||
, buildSamples ? false | ||
, buildDocs ? false | ||
, gpuTargets ? null # gpuTargets = [ "gfx908:xnack-" "gfx90a:xnack-" "gfx90a:xnack+" ... ] | ||
}: | ||
|
||
assert buildTests -> gtest != null; | ||
assert buildTests -> rocblas != null; | ||
assert buildDocs -> texlive != null; | ||
assert buildDocs -> doxygen != null; | ||
assert buildDocs -> sphinx != null; | ||
assert buildDocs -> python3Packages != null; | ||
|
||
# Building tests isn't working for now | ||
# undefined reference to symbol '_ZTIN7testing4TestE' | ||
assert buildTests == false; | ||
|
||
let | ||
latex = lib.optionalAttrs buildDocs (texlive.combine { | ||
inherit (texlive) scheme-small | ||
latexmk | ||
tex-gyre | ||
fncychap | ||
wrapfig | ||
capt-of | ||
framed | ||
needspace | ||
tabulary | ||
varwidth | ||
titlesec; | ||
}); | ||
in stdenv.mkDerivation (finalAttrs: { | ||
pname = "rocwmma"; | ||
repoVersion = "0.8"; | ||
rocmVersion = "5.3.3"; | ||
version = "${finalAttrs.repoVersion}-${finalAttrs.rocmVersion}"; | ||
|
||
outputs = [ | ||
"out" | ||
] ++ lib.optionals buildTests [ | ||
"test" | ||
] ++ lib.optionals buildSamples [ | ||
"sample" | ||
] ++ lib.optionals buildDocs [ | ||
"docs" | ||
]; | ||
|
||
src = fetchFromGitHub { | ||
owner = "ROCmSoftwarePlatform"; | ||
repo = "rocWMMA"; | ||
rev = "rocm-${finalAttrs.rocmVersion}"; | ||
hash = "sha256-wU3R1XGTy7uFbceUyE0wy+XayicuyJIVfd1ih6pbTN0="; | ||
}; | ||
|
||
patches = lib.optionals buildTests [ | ||
./0000-dont-fetch-googletest.patch | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
cmake | ||
rocm-cmake | ||
hip | ||
]; | ||
|
||
buildInputs = [ | ||
openmp | ||
] ++ lib.optionals buildTests [ | ||
gtest | ||
rocblas | ||
] ++ lib.optionals buildDocs [ | ||
latex | ||
doxygen | ||
sphinx | ||
python3Packages.sphinx_rtd_theme | ||
python3Packages.breathe | ||
]; | ||
|
||
cmakeFlags = [ | ||
"-DCMAKE_CXX_COMPILER=hipcc" | ||
"-DROCWMMA_BUILD_TESTS=${if buildTests then "ON" else "OFF"}" | ||
"-DROCWMMA_BUILD_SAMPLES=${if buildSamples then "ON" else "OFF"}" | ||
# Manually define CMAKE_INSTALL_<DIR> | ||
# See: https://github.com/NixOS/nixpkgs/pull/197838 | ||
"-DCMAKE_INSTALL_BINDIR=bin" | ||
"-DCMAKE_INSTALL_LIBDIR=lib" | ||
"-DCMAKE_INSTALL_INCLUDEDIR=include" | ||
] ++ lib.optionals (gpuTargets != null) [ | ||
"-DGPU_TARGETS=${lib.strings.concatStringsSep ";" gpuTargets}" | ||
] ++ lib.optionals buildTests [ | ||
"-DROCWMMA_BUILD_VALIDATION_TESTS=ON" | ||
"-DROCWMMA_BUILD_BENCHMARK_TESTS=ON" | ||
"-DROCWMMA_BUILD_EXTENDED_TESTS=ON" | ||
"-DROCWMMA_VALIDATE_WITH_ROCBLAS=ON" | ||
"-DROCWMMA_BENCHMARK_WITH_ROCBLAS=ON" | ||
]; | ||
|
||
postPatch = lib.optionalString buildDocs '' | ||
patchShebangs docs/*.sh | ||
''; | ||
|
||
# Unfortunately, it seems like we have to call make on this manually | ||
# -DROCWMMA_BUILD_DOCS=ON is invalid, despite being on the README | ||
postBuild = lib.optionalString buildDocs '' | ||
export HOME=$(mktemp -d) | ||
../docs/run_doc.sh | ||
''; | ||
|
||
postInstall = lib.optionalString buildTests '' | ||
mkdir -p $test/bin | ||
mv $out/bin/*_test* $test/bin | ||
'' + lib.optionalString buildSamples '' | ||
mkdir -p $sample/bin | ||
mv $out/bin/sgemmv $sample/bin | ||
mv $out/bin/simple_gemm $sample/bin | ||
mv $out/bin/simple_dlrm $sample/bin | ||
'' + lib.optionalString (buildTests || buildSamples) '' | ||
rmdir $out/bin | ||
''; | ||
|
||
postFixup = lib.optionalString buildDocs '' | ||
mkdir -p $docs/share/doc/rocwmma | ||
mv ../docs/source/_build/html $docs/share/doc/rocwmma | ||
mv ../docs/source/_build/latex/rocWMMA.pdf $docs/share/doc/rocwmma | ||
''; | ||
|
||
passthru.updateScript = writeScript "update.sh" '' | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p curl jq common-updater-scripts | ||
json="$(curl -sL "https://api.github.com/repos/ROCmSoftwarePlatform/rocWMMA/releases?per_page=1")" | ||
repoVersion="$(echo "$json" | jq '.[0].name | split(" ") | .[1]' --raw-output)" | ||
rocmVersion="$(echo "$json" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)" | ||
update-source-version rocwmma "$repoVersion" --ignore-same-hash --version-key=repoVersion | ||
update-source-version rocwmma "$rocmVersion" --ignore-same-hash --version-key=rocmVersion | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Mixed precision matrix multiplication and accumulation"; | ||
homepage = "https://github.com/ROCmSoftwarePlatform/rocWMMA"; | ||
license = with licenses; [ mit ]; | ||
maintainers = teams.rocm.members; | ||
broken = finalAttrs.rocmVersion != hip.version; | ||
}; | ||
}) |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should not be added new instances where packages are being overwritten to null to disable features. This is an anti pattern and is totally not required here including the asserts below. This is a legacy artifact from before callPackage when import was still used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression it was to not include those packages and make the closure smaller.
If it's not, I'll change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gpuTargets
is howevernull
for a different reason.Is there a reason to change it?
Would it be better to change it to something like
[ ]
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is enough to use lib.optional(s) or if else then for that.
That depends on how it should be handled. If only the entries in the list matter than having it by default an empty list is better defined. If there is a difference between null and empty list then it maybe shouldn't be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no discernible difference, so it should be fine.