Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 932155 - dev-util/hip: FindHIP breaks rocFFT build on Prefix
Summary: dev-util/hip: FindHIP breaks rocFFT build on Prefix
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-05-18 13:34 UTC by Benda Xu
Modified: 2025-01-26 14:00 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benda Xu gentoo-dev 2024-05-18 13:34:04 UTC
hip::host and hip::device is only defined in hip-config.cmake.  Keeping FindHIP introduces cmake bugs that are difficult to trace.

For example, rocFFT in Prefix does not include the correct hip-config.cmake but is confused by FindHIP.cmake.

Dropping FindHIP was a serious consideration after the endless debugging of the nondeterministic behaviors caused by having both hip-config and FindHIP.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5223e983a0810e46633362ff4dbad6a194208819

I suggest the way forward is to understand the function of hip_add_executable() cmake function, patch torch/roctracer or provide it in hip-config.cmake.

Reproducible: Always
Comment 1 Benda Xu gentoo-dev 2024-05-18 13:45:29 UTC
I could build roctracer-5.7.1-r1 with hip-5.7.1-r1 (without FindHIP.cmake).

roctracer is no longer a blocker.  FindHIP is only for torch.  It is torch that should be fixed.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-10-04 02:05:34 UTC
I don't really consider this something I have any input on, I'm just reviewing the PRs.
Comment 3 Yiyang Wu 2024-10-21 02:47:55 UTC
I think whether FindHIP.cmake should be removed needs to directly discuss with upstream. The simplest way I see is to fix packages to force them use hip-config.cmake if they fail to configure
Comment 4 Benda Xu gentoo-dev 2024-10-22 02:22:34 UTC
> I think whether FindHIP.cmake should be removed needs to directly discuss with upstream.

It is only useful when you wrap CUDA with ROCm.

See: https://github.com/ROCm/hipamd/issues/39
Comment 5 Yiyang Wu 2024-10-22 04:55:35 UTC
(In reply to Benda Xu from comment #4)
> > I think whether FindHIP.cmake should be removed needs to directly discuss with upstream.
> 
> It is only useful when you wrap CUDA with ROCm.
> 
> See: https://github.com/ROCm/hipamd/issues/39

FindHIP.cmake is only useful situation is pytorch[rocm] and roctracer[test].

(In reply to Benda Xu from comment #1)
> I suggest the way forward is to understand the function of
> hip_add_executable() cmake function, patch torch/roctracer or provide it in
> hip-config.cmake.
> 
> Reproducible: Always

The best way out is already mentioned, to patch (and upstream) them move on to the more modern way, using hip-config.cmake:

Another workaround is hide FindHIP.cmake somewhere, and during src_prepare of pytorch[rocm] or roctracer[test] we put it in ${S}/cmake.

The 3rd way is what https://github.com/gentoo/gentoo/pull/39063 does, just fix any package that should use the modern hip-config.cmake but seek for FindHIP.cmake by accident. Then upstream the fix.

Solution 1 & 3 are upstream-able so could benefits all. Solution 2 & 3 take much less efforts than 1.
Comment 6 Paul Zander 2024-10-22 22:45:04 UTC
Another option is using https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_PACKAGE_PREFER_CONFIG.html and don't patch while we wait for upstream to implement our solution.
Comment 7 Larry the Git Cow gentoo-dev 2025-01-26 14:00:23 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=582d164f4850c6c5b2b491214b404c58bad6e088

commit 582d164f4850c6c5b2b491214b404c58bad6e088
Author:     Yiyang Wu <xgreenlandforwyy@gmail.com>
AuthorDate: 2024-10-21 02:26:26 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-26 13:59:29 +0000

    sci-libs/rocFFT: force using hip-config.cmake instead of FindHIP.cmake
    
    Closes: https://bugs.gentoo.org/932155
    Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/rocFFT-6.1.1-find-hip-use-config.patch   | 31 ++++++++++++++++++++++
 sci-libs/rocFFT/rocFFT-5.7.1-r2.ebuild             |  1 +
 sci-libs/rocFFT/rocFFT-6.1.1.ebuild                |  3 ++-
 sci-libs/rocFFT/rocFFT-6.3.0.ebuild                |  3 ++-
 4 files changed, 36 insertions(+), 2 deletions(-)