Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkgs/development/cuda-modules/cudnn/shims.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
{
lib,
package,
# redistArch :: String
# String is "unsupported" if the given architecture is unsupported.
redistArch,
}:
{
featureRelease = lib.optionalAttrs (redistArch != "unsupported") {
featureRelease = {
inherit (package) minCudaVersion maxCudaVersion;
${redistArch}.outputs = {
lib = true;
Expand Down
36 changes: 25 additions & 11 deletions pkgs/development/cuda-modules/generic-builders/multiplex.nix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebase --autosquash

Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,20 @@ let
lib.versionAtLeast cudaMajorMinorVersion package.minCudaVersion
&& lib.versionAtLeast package.maxCudaVersion cudaMajorMinorVersion;

# Releases for our platform and CUDA version.
# See ../modules/${pname}/releases/releases.nix
# allPackages :: List Package
allPackages = lib.filter satisfiesCudaVersion (
evaluatedModules.config.${pname}.releases.${redistArch} or [ ]
);
# FIXME: do this at the module system level
propagatePlatforms = lib.mapAttrs (redistArch: lib.map (p: { inherit redistArch; } // p));

# Releases for all platforms and all CUDA versions.
allReleases = propagatePlatforms evaluatedModules.config.${pname}.releases;

# Releases for all platforms and our CUDA version.
allReleases' = lib.mapAttrs (_: lib.filter satisfiesCudaVersion) allReleases;

# Packages for all platforms and our CUDA versions.
allPackages = lib.concatLists (lib.attrValues allReleases');

packageOlder = p1: p2: lib.versionOlder p1.version p2.version;
packageSupportedPlatform = p: p.redistArch == redistArch;

# Compute versioned attribute name to be used in this package set
# Patch version changes should not break the build, so we only use major and minor
Expand All @@ -77,8 +85,15 @@ let
newestPackages
// {
${majorMinorVersion} =
# Only keep the existing package if it is newer than the one we are considering.
if existingPackage != null && lib.versionOlder package.version existingPackage.version then
# Only keep the existing package if it is newer than the one we are considering or it is supported on the
# current platform and the one we are considering is not.
if
existingPackage != null
&& (
packageOlder package existingPackage
|| (!packageSupportedPlatform package && packageSupportedPlatform existingPackage)
)
Comment on lines 87 to +95
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, though, we won't be able to see trofi's commit message in git-blame 9fd753e

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment to reference it when calling lib.sort.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still recover the named function

then
existingPackage
else
package;
Expand All @@ -87,9 +102,8 @@ let
in
# Sort the packages by version so the newest is first.
# NOTE: builtins.sort requires a strict weak ordering, so we must use versionOlder rather than versionAtLeast.
lib.sort (p1: p2: lib.versionOlder p2.version p1.version) (
lib.attrValues newestForEachMajorMinorVersion
);
# See https://github.com/NixOS/nixpkgs/commit/9fd753ea84e5035b357a275324e7fd7ccfb1fc77.
lib.sort (lib.flip packageOlder) (lib.attrValues newestForEachMajorMinorVersion);

extension =
final: _:
Expand Down
3 changes: 1 addition & 2 deletions pkgs/development/cuda-modules/tensorrt/shims.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Shims to mimic the shape of ../modules/generic/manifests/{feature,redistrib}/release.nix
{
lib,
package,
# redistArch :: String
# String is `"unsupported"` if the given architecture is unsupported.
redistArch,
}:
{
featureRelease = lib.optionalAttrs (redistArch != "unsupported") {
featureRelease = {
inherit (package) cudnnVersion minCudaVersion maxCudaVersion;
${redistArch}.outputs = {
bin = true;
Expand Down