Skip to content

blender: fix hip support#410748

Merged
veprbl merged 1 commit intoNixOS:masterfrom
justinkb:blender-hip
Jun 8, 2025
Merged

blender: fix hip support#410748
veprbl merged 1 commit intoNixOS:masterfrom
justinkb:blender-hip

Conversation

@justinkb
Copy link
Contributor

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • [] sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels May 25, 2025
@nix-owners nix-owners bot requested review from amarshall and veprbl May 25, 2025 09:47
Comment on lines 137 to 138
Copy link
Member

Choose a reason for hiding this comment

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

--replace is deprecated, so change these both to --replace-fail, which will also make the problem a build time instead of runtime failure. While we’re at it, make it dynamic so we are less likely to need to manually change it later.

Suggested change
substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so.6"' '"${rocmPackages.clr}/lib/libamdhip64.so"'
substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"'
substituteInPlace extern/hipew/src/hipew.c --replace-fail '"/opt/rocm/hip/lib/libamdhip64.so.${lib.versions.major rocmPackages.clr.version}"' '"${rocmPackages.clr}/lib/libamdhip64.so"'
substituteInPlace extern/hipew/src/hipew.c --replace-fail '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did make those replace-fail changes locally, but wanted to keep the PR as minimal as possible (doh!). Interestingly enough, replace-fail wouldn't have caught this issue, since upstream changed the /opt/rocm/hip/lib/libamdhip64.so to /opt/rocm/hip/lib/libamdhip64.so.6, so it would still have replaced /opt/rocm/hip/lib/libamdhip64.so with our expression and then it would have had .6 after it and we don't produce libamdhip64.so.6 with our derivation. Not sure of the usefulness of making that soversion dynamic, there is no predicting what blender devs will do with this detection code in the future. I mean, this PR is necessary in the first place because they made a weird change to it (4.4 changelog says they dropped rocm <6 support, but they added backwards compat code anyway?)

Copy link
Member

@amarshall amarshall May 25, 2025

Choose a reason for hiding this comment

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

replace-fail wouldn't have caught this issue…

It would have because the string to substitute matches the ending ", so .so.6" would not have matched. Changing just --replace--replace-fail on nixos-unstable causes the build to fail here.

but wanted to keep the PR as minimal as possible

Some minor related cleanup is fine. I think in this case it’s not unreasonable to have in the same commit, but a separate commit in the same PR is also fine.

Not sure of the usefulness of making that soversion dynamic, there is no predicting what blender devs will do

Sure, but I suspect the most likely thing will be .so.6.so.7 given the current code. Further, it helps somewhat ensure that we are using a matching ROCm, as if our ROCm changes to v7 but Blender still only references v6, we might have an issue that needs addressing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I might need to change my font settings, I didn't catch that "' thing at all. I'll revise the PR later and force push with your suggestions incorporated. I also have a new hiprt package and accompanying blender enablement patch that I might add in a separate PR

Copy link
Member

Choose a reason for hiding this comment

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

Good catch, I might need to change my font settings, I didn't catch that "' thing at all. I'll revise the PR later and force push with your suggestions incorporated. I also have a new hiprt package and accompanying blender enablement patch that I might add in a separate PR

I'm trying to package hip-rt here #411736. Although I'm facing some issues. If you've already fixed them we should replace it with yours.

@mksafavi
Copy link
Member

mksafavi commented Jun 1, 2025

Hi
Is there anything needed for this to get merged?

@justinkb
Copy link
Contributor Author

justinkb commented Jun 1, 2025

I'll make the suggested changes and look at your hiprt tomorrow most likely

@justinkb
Copy link
Contributor Author

justinkb commented Jun 3, 2025

should be fine now, not sure about the nixpkgs-vet failing check, should I have rebased onto master again?

@mksafavi mksafavi requested review from Aleksanaa and amarshall June 5, 2025 18:19
@LunNova
Copy link
Member

LunNova commented Jun 8, 2025

should be fine now, not sure about the nixpkgs-vet failing check, should I have rebased onto master again?

Yeah, looks like a spurious failure unrelated to your diff that was fixed in #413239

@veprbl veprbl merged commit af9ffbb into NixOS:master Jun 8, 2025
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants