cudaPackages: introduce cudaLib and switch from backendStdenv to cudaStdenv#405751
cudaPackages: introduce cudaLib and switch from backendStdenv to cudaStdenv#405751ConnorBaker wants to merge 8 commits intoNixOS:masterfrom
Conversation
d4bcc1f to
c8dfb5e
Compare
646b010 to
e11f0c0
Compare
Signed-off-by: Connor Baker <[email protected]>
Signed-off-by: Connor Baker <[email protected]>
Signed-off-by: Connor Baker <[email protected]>
Signed-off-by: Connor Baker <[email protected]>
Signed-off-by: Connor Baker <[email protected]>
Signed-off-by: Connor Baker <[email protected]>
e11f0c0 to
40baa7d
Compare
|
Fair point -- I'm thinking: {
# NVCC is required to compile CUDA code.
nativeBuildInputs = [ cuda_nvcc ];
# The CUDA runtime is required by most CUDA applications and depends on the headers
# provided by CCCL.
buildInputs =
[
cuda_cudart
cuda_cccl
]
# CUDA compat is included when non-null and available on the host platform.
++ lib.optionals (cuda_compat != null && lib.availableOn stdenv.hostPlatform cuda_compat) [
cuda_compat
];
}
My intention with introducing On the topic of |
Signed-off-by: Connor Baker <[email protected]>
|
Fair point -- I'm thinking:
Ja-ja, are we brainstorming already? Great. Here come some more
considerations.
**Minor**:
- I'd move `propagatedBuildInputs = [ setupCudaHook ]` from NVCC to
`*Stdenv` (unless cf. **Major**)
- It must be possible to use `*Stdenv` with NVC++ and Clang instead of NVCC
**Major**
This is in response to
In the same vein, I'm supposing we'd call our standard environment
|cudaStdenv| and not just |stdenv|
- The difference I anticipate for `backendStdenv` and
`cudaPackages.stdenv` is that the latter should be fit for using in
Nixpkgs' `overrideStdenv` and should treat `cuda{Support,Capabilities`
as part of the `hostPlatform`:
- Rebuilding something non-CUDA, like `chromium`, with
`cudaPackages.stdenv` should not trigger a rebuild (i.e. overlay reduces
to a no-op and uses the modern stdenv's tools, libs, and hooks)
- Building a real CUDA package, like `torch` and it must have a way
to signal it "can be built with CUDA support" (NVCC in
nativeBuildInputs? Maybe, I don't like this), enforces the compatible
stdenv, prevents lib{c,stdc++} leakages, and adds NVCC & CUDA hooks.
- `cudaPackages.stdenv.cudaSupport` can be used to test whether the
platform we're building for "supports CUDA" at all; it can be used
instead of `{ config, cudaSupport ? config.cudaSupport }` to test for
"what's hypothetically supported" (this somehow needs to be disentangled
from "whether the _current_package is requested to be built with CUDA
kernels on")
Onto `cudaLib`.
a centralized library of functions and data necessary to create,
modify, or extend CUDA package sets
:+1: I was thinking along the same lines (would you like some
`libcudb.nix`?), I'm surely pro-change. But this time I want to clearly
disclaim liabilities
I like |flags| because it's short, but |cudaFlags| makes it more
clear what it is in cases where it's inherited in package expressions
outside of the |cudaPackages| scope
My vote is definitely `flags`: if we inherit outside the scope we can
choose a longer local name.
|
|
Excellent points! In terms of moving this PR forward, is it acceptable to you if:
I want to have a further discussion with you about the implementation of a |
|
single underscore
Seems like you're right.
tree-wide cudaFlags -> flags
Separate PR to avoid extra yak-shaving?
I think that will be a longer series of discussions
Safe to assume so 👍
expose ... minimal functionality to ... create, modify, or extend
CUDA package sets
I didn't comment on this part - exactly my concern right now too! The
artifact I was hoping to introduce at the top-level is something like a
"cuda (metadata) database", which could be re-instatiated with a
different set of manifests, and a function approx. of the form `DB ->
VersionConstraints -> List Extension -> CudaPackageSet`
On 12/05/2025 17.07, Connor Baker wrote:
ConnorBaker left a comment (NixOS/nixpkgs#405751)
Excellent points!
In terms of moving this PR forward, is it acceptable to you if:
1. I keep the name of `backendStdenv` instead of renaming it to `cudaStdenv` (all the additional attributes would remain as needed for further refactors)
2. I update the names and documentation of the functions in `cudaLib.utils` to indicate there are no stability guarantees (I'm thinking a single underscore, as double-underscore seems to be mostly used by Nix)
3. I do a tree-wide refactor to remove `cudaFlags` and replace it with `flags`
I want to have a further discussion with you about the implementation of a `cudaStdenv` with the properties you've outlined above, but I think that will be a longer series of discussions and I don't want to hold up landing fixes for package set leakage and introduction of `pkgsCuda`.
--
SomeoneSerge <https://someonex.net>
|
|
Introduction of |
Important
Introduction of
cudaLibhas been split into #406531. This PR is closed as discussions about goals and implementation details ofcudaStdenvneed to happen first.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.