Skip to content

clang_7,clang_8,clang_9: fix compilation of HIP-code #78308

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

Merged
merged 1 commit into from
Jan 28, 2020

Conversation

DieGoldeneEnte
Copy link
Contributor

Motivation for this change

This PR aims to fix the same problem as NixOS/nixpkgs PR #77476; enabling to compile HIP-code using the packaged clang compiler, by also searching in $PATH for required binaries.
The change is committed upstream (https://reviews.llvm.org/D72903), but will not land in the clang versions in nixpkgs (only clang 10+). As such I have created patches for the affected versions. To compile HIP-code lld is needed, so I added it to the clang-package.

Since this is the same change for all 3 versions I packed everything into one commit+PR. If wanted I could also separate it into 3 individual commits/PRs.

Things done

I did compile all 3 versions and tested clang_9 using a HIP-program. I did not explicitly test clang_7 or clang_8, because I don't have the required rocm-device-libs. I would need to package these separately and compile them using a compatible compiler. Because only the HIP compilation behavior is changed this should not break anything currently in nixpkgs.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

This PR aims to fix the same problem as NixOS/nixpkgs PR NixOS#77476; enabling to
compile HIP-code using the packaged clang compiler, by also searching in $PATH
for required binaries.
The change is committed upstream (https://reviews.llvm.org/D72903), but will
not land in the clang versions in nixpkgs (only clang 10+). As such I have
created patches for the affected versions. To compile HIP-code lld is needed,
so I added it to the clang-package.<Paste>
@DieGoldeneEnte
Copy link
Contributor Author

I managed to not include a fix needed to get the patches work with the downloaded source instead of the llvm-project repository.
=> Updated commit with appropriate paths. Now the tested code is in the commit, sorry for the noise.

@matthewbauer matthewbauer merged commit d4ad868 into NixOS:master Jan 28, 2020
@matthewbauer
Copy link
Member

Ooops, should go to staging, will revert & apply in staging.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/clang-tries-to-execute-llvm-link-with-wrong-path/5420/2

@DieGoldeneEnte DieGoldeneEnte deleted the clang-hip-patch branch March 25, 2020 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants