Skip to content
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

cc-wrapper: relocate proprietary-compiler-specific material #282220

Merged
2 commits merged into from Jan 20, 2024
Merged

cc-wrapper: relocate proprietary-compiler-specific material #282220

2 commits merged into from Jan 20, 2024

Conversation

ghost
Copy link

@ghost ghost commented Jan 20, 2024

Description of changes

PR #275947, which was self-merged without any approvals, inserted functionality specific to a propriteary closed-source compiler (CUDA) into cc-wrapper.

This commit relocates this CUDA-specific functionality into the appropritate place: cuda-modules. Parts had to be disabled in order to make CI pass.

The moved functionality may require this PR in order to reenable it:

Adam Joseph added 2 commits January 19, 2024 20:47
This commit deletes speculative comments which were self-merged with
no approvals in PR #275947.

If you think that "The above 'fix' may be incorrect" the correct
response is to submit a PR which removes the 'fix' and get it reviewed.

Likewise, if you think that "For clang it's not necessary" you
should submit a PR which wraps it in `if !isClang`.

`cc-wrapper` is full of too much junk as it is, let's not make
things worse.
PR #275947, which was self-merged without approvals, inserted
functionality specific to a propriteary closed-source compiler
(CUDA) into cc-wrapper.

This commit relocates this CUDA-specific functionality into the
appropritate place: `cuda-modules`.

It is unclear to me exactly what this function is supposed to be
doing; much of it (like the `.kind` attributes) do not appear to be
used *anywhere* in nixpkgs.  Making sure we don't insert unexplained
deadcode like this is one of the important functions of the review
process.
@ofborg ofborg bot added 8.has: clean-up 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 20, 2024
@ghost ghost marked this pull request as ready for review January 20, 2024 05:46
@ghost ghost requested a review from Ericson2314 as a code owner January 20, 2024 05:46
@ghost ghost merged commit 86c28ee into NixOS:master Jan 20, 2024
24 checks passed
@ghost ghost deleted the pr/cc-wrapper/cleanup2 branch January 20, 2024 05:47
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi Adam,

Well this is wonderful. It had escaped my attention that the current implementation of stdenvAdapters.useLibsFrom passing the unwrapped cc.cc in gccForLibs means there's nothing on the way to inspect the old wrapper's cxxStdlib and whether it was libc++. This means that the "adapter" is now only functional when gccForLibs is populated from a gcc+libstdc++ stdenv, not from a libc++ one.

Note that there also remains one more cc-wrapper composability issue regarding the propagation of e.g. coreutils when creating new wrappers, as mentioned in #281750 (comment).

Note that this functionality, still half-broken as we've established above, is not in any way specific to any "proprietary compilers", it's specific to the general software that expects older toolchains, e.g. the non-proprietary tensorflow:

stdenv = pkgs.stdenvAdapters.useLibsFrom stdenv pkgs.gcc12Stdenv;

This is especially relevant during the post-staging phases (i.e. now) when we get lots of failures from gcc major version updates, including in packages with many reverse dependencies.

A review would have helped a ton in getting things right early, fixing the obvious mistakes, and in pruning the garbage. The PR was open for three weeks for people to object or demand changes. I had notified people adjacent to the cc-wrapper, e.g. rrbutani, whose one year-old patchwork I based the PR off, and Daniel. I had asked for advice on discourse and later in the "Nix/NixOS Contributions" and the "Stdenv" matrix channels. Nobody came up with any suggestions at the time (save for the idea to move the bulk of the logic out into a new "stdenv adapter"), and nobody thought e.g. to redirect me to you. I get that, I do not expect people to be available 365 days in the year. I also don't expect people never to "touch" the parts that I maintain in Nixpkgs unless I intervene in a timely manner.

If you're still convinced I made the wrong call, please feel free to bring this up in any of the public channels suitable for policy discussions. Pushing dramatic commit messages straight into master doesn't really help with anything.

I would really much prefer if you would speak directly to me and react to my messages (#281750 and #275947 (comment)). I'm very glad to see #282221 open. Thanks for bringing it to my attention too, I consider an advancement in this conversation.

I'm interested in having a clean and composable cc-wrapper (or any alternative way to configure toolchains). Whatever we had encountered back in #223664 #225493 #220341 (comment) wasn't clean enough for me to be able to infer any context or build a notion of the public interface. This lead up to us relying on the correct libstdc++ being picked up by the compiler pretty much accidentally (#225661 (comment)) for several months. I get the impression that you must be one deeply invested in the wrapper and set on refactoring it, and that's great: I want to collaborate with somebody with this background. I hope that this message will be the only one where I resort to instigating drama, and that the further exchange will be technical, because I don't want to waste your time or mine.

Cheers

@@ -112,7 +112,7 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
useCcForLibs = true;
gccForLibs = ccForLibs-wrapper.cc;
};
cxxStdlibDir = ccForLibs-wrapper.cxxStdlib.solib;
cxxStdlibDir = ccForLibs-wrapper.cxxStdlib.solib or (throw "necessary to fix CI");
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please elaborate, which CI you're referring to? The PR had passed the Ofborg checks

Copy link
Contributor

@SomeoneSerge SomeoneSerge Jan 20, 2024

Choose a reason for hiding this comment

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

This branch is now reachable in the default (save for allowUnfree) instantiation of Nixpkgs and breaks the eval:

❯ NIXPKGS_ALLOW_UNFREE=1 nix-instantiate '.' -A tests.cuda
...

       error: necessary to fix CI

SomeoneSerge added a commit to SomeoneSerge/nixpkgs that referenced this pull request Jan 20, 2024
Unbreaks evaluation after the refactoring in
86c28ee
(NixOS#282220).

Explicitly extending nvcc's LIBRARIES may have been redundant (building
something mildly cursed like jaxlib may be necessary to verify)

Previously:
```
❯ NIXPKGS_ALLOW_UNFREE=1 nix-instantiate '.' -A tests.cuda
...
       error: necessary to fix CI
❯ nix build -f '.' --arg config '{ allowUnfree = true; }' -L python3Packages.torchWithCuda
...
       error: necessary to fix CI
```

Now:
```
❯ NIXPKGS_ALLOW_UNFREE=1 nix-instantiate '.' -A tests.cuda
/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-cuda-samples-12.2.drv
/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-saxpy-unstable-2023-07-11.drv
...
```
SomeoneSerge added a commit to SomeoneSerge/nixpkgs that referenced this pull request Jan 21, 2024
@mweinelt
Copy link
Member

mweinelt commented Jan 21, 2024

@amjoseph-nixpkgs You need to tone done your commit messages and start communicating with others, continued collaboration really isn't going to work any other way. In your commit messages, please stick to the technical details, and stop the finger pointing already. It doesn't make for a healthy community.

Now I understand that cc-wrapper is a crucial part of nixpkgs that, for which incoming changes need proper review, but no such thing happened on the other PR for close to a month. I don't think people should strictly "own" some code in nixpkgs, when they can't guarantee that review decisions are made in a timely fashion. This would ultimately block progress and prevent onboarding of new people to that section of the code.

And finally In self-merging this change, you made the perfect case for why review is necessary.

Adam, the way you communicate here needs to change now!

// This message was written in my role as a member of the moderation team

@nyabinary
Copy link
Contributor

Moreover, to note that you also self merged and self reviewed #282210 as well. If you are going to criticize someone for self reviewing and self merging, I would hope you don't do the thing you're criticizing others for yourself as well, The process applies to everyone after all.

@ghost
Copy link
Author

ghost commented Jan 21, 2024

Moreover, to note that you also self merged and self reviewed #282210 as well

Yes, because these two PRs are corrections for unapproved self-merges.

I believe the corrective PR should be held to the same standard as the PR it corrects.

peterhoeg pushed a commit to peterhoeg/nixpkgs that referenced this pull request Jan 22, 2024
Unbreaks evaluation after the refactoring in
86c28ee
(NixOS#282220).

Explicitly extending nvcc's LIBRARIES may have been redundant (building
something mildly cursed like jaxlib may be necessary to verify)

Previously:
```
❯ NIXPKGS_ALLOW_UNFREE=1 nix-instantiate '.' -A tests.cuda
...
       error: necessary to fix CI
❯ nix build -f '.' --arg config '{ allowUnfree = true; }' -L python3Packages.torchWithCuda
...
       error: necessary to fix CI
```

Now:
```
❯ NIXPKGS_ALLOW_UNFREE=1 nix-instantiate '.' -A tests.cuda
/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-cuda-samples-12.2.drv
/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-saxpy-unstable-2023-07-11.drv
...
```
@ghost ghost mentioned this pull request Jan 23, 2024
@ghost
Copy link
Author

ghost commented Jan 23, 2024

Adam, the way you communicate here needs to change now!

Thank you for writing this, @mweinelt. I appreciate it, more than anything else that's been said in this discussion.

I will change.

I don't think people should strictly "own" some code in nixpkgs,

I absolutely agree and have said so many, many times.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: clean-up 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants