Bug 2044664 - Review Request: rocm-device-libs - AMD ROCm LLVM bit code libraries
Summary: Review Request: rocm-device-libs - AMD ROCm LLVM bit code libraries
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Felix Schwarz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1877523 2045955
TreeView+ depends on / blocked
 
Reported: 2022-01-24 23:40 UTC by Jeremy Newton
Modified: 2022-02-13 14:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-13 14:52:23 UTC
Type: ---
Embargoed:
fschwarz: fedora-review+


Attachments (Terms of Use)

Description Jeremy Newton 2022-01-24 23:40:57 UTC
Spec URL: https://mystro256.fedorapeople.org/ROCm-Device-Libs.spec
SRPM URL: https://mystro256.fedorapeople.org/ROCm-Device-Libs-4.5.2-1.fc36.src.rpm
Description:
This package contains a set of AMD specific device-side language runtime
libraries in the form of bit code. Specifically:
 - Open Compute library controls
 - Open Compute Math library
 - Open Compute Kernel library
 - OpenCL built-in library
 - HIP built-in library
 - Heterogeneous Compute built-in library
Fedora Account System Username: mystro256

Note this is a requirement for updating rocm-runtime to the latest (blocks RHBZ#1877523)

rpmlint output:
ROCm-Device-Libs.noarch: W: only-non-binary-in-usr-lib
ROCm-Device-Libs.src:44: E: hardcoded-library-path in %{_prefix}/lib/cmake/AMDDeviceLibs
ROCm-Device-Libs.src:45: E: hardcoded-library-path in %{_prefix}/lib/amdgcn

See patch0, my gut says that we should put this in /usr/share, but upstream is insistent on using /usr/lib by default. I drafted the patch to propose to upstream if this package is accepted to allow flexibility in location.

I started a thread about it on the devel mailing list, but I haven't gotten any response yet. I think /usr/lib would be fine since this is a noarch package and isn't required to split libdir between lib and lib64, but I don't mind putting it in /usr/share if need be.

Comment 1 Tom Stellard 2022-01-25 01:06:48 UTC
libclc is installed to %{_libdir}/libclc in Fedora, so there is precedent for installing bitcode libraries in /usr/lib.

Comment 2 Jeremy Newton 2022-01-25 01:50:31 UTC
Thanks Tom!

I've remodelled the package after the libclc package:

Spec URL: https://mystro256.fedorapeople.org/ROCm-Device-Libs.spec
SRPM URL: https://mystro256.fedorapeople.org/ROCm-Device-Libs-4.5.2-1.fc36.src.rpm

rpmlint output:
ROCm-Device-Libs.x86_64: W: only-non-binary-in-usr-lib

Rationale for ignoring: this mimics an existing package "libclc" by installing bitcode into %{_libdir}

Other notes: there is no debug package, same as libclc.

Comment 3 Felix Schwarz 2022-02-10 21:45:48 UTC
I hoped that somebody more familiar with the whole llvm/gpu stack could review this. If nobody steps up I think I'll have to do it.

Naming: In F35 we have rocm-runtime, rocm-smi, and rocminfo. Therefore I suggest using "rocm-device-libs" as a package name. This also matches the naming in Arch (https://github.com/rocm-arch/rocm-arch/tree/master/rocm-device-libs) and Debian (https://salsa.debian.org/rocm-team/rocm-device-libs).

I noticed that both Debian and Arch use rocm-cmake. Any idea if we need this in Fedora as well?

I can't test the package on its own but you also submitted ROCm-CompilerSupport in bug 2045955 so I guess this package works.

As for /usr/lib vs. /usr/lib64 I don't have a strong opinion. Debian puts the bitcode in /usr/lib/x86_64-linux-gnu/ if I'm not mistaken. Tom mentioned libclc with /usr/lib64 while Vít seemed to prefer(?) /usr/lib. Both arguments work for so...

If you could fix the naming issue I could do a formal review to move this forward. Thank you for taking the time to package the ROCm stack for Fedora.

Comment 4 Jeremy Newton 2022-02-11 16:11:20 UTC
Thanks Felix!

Using rocm-device-libs is fine by me, see update below.

Regarding rocm-cmake, as far as I know, it's only needed for some hip-related math libraries. I've built the stack all the way up to OpenCL and ran HW tests without issues. Furthermore Upstream seems fine with this as well.
I've been working with the Debian guys to coordinate these packages, so I'm a bit surprised that they use it, but I'll contact them and see if there's anything I missed (or they missed).

As well, upstream is looking to merge this into llvm proper I think, similar to libclc. I think for now it makes sense to copy libclc, until upstream makes a change.
The issue is that upstream is targeting unstable LLVM, so they would first need to change their development to use stable llvm before they can reliably upstream these changes, I think.

Finally, I need to update these two packages to 5.0.0, which was released a few days ago, but the compiler support needs patches to compile against stable llvm. We can review these as-is though and update them later.

Spec URL: https://mystro256.fedorapeople.org/rocm-device-libs.spec
SRPM URL: https://mystro256.fedorapeople.org/rocm-device-libs-4.5.2-1.fc36.src.rpm

Comment 5 Felix Schwarz 2022-02-11 16:55:52 UTC
Thank you Jeremy, I'll try to review these packages later today. Also great to hear that you are in contact with the Debian packagers. You mentioned that you built the full AMD OpenCL stack. Do you have a COPR which we could use as a kind of "preview repo"?

Comment 6 Jeremy Newton 2022-02-11 18:39:52 UTC
Ah, wonderful idea, I'm not sure why I forgot about COPR.

I did something a little ugly and bundled the library "rocclr" to build opencl. I'll try to split it out before uploading to a COPR, for review purposes.

For now, I pushed 5.0.0 builds of hsakmt, device-libs, compiler support, and rocm-runtime to a COPR:

https://copr.fedorainfracloud.org/coprs/mystro256/rocm-opencl/

If you're interested, I made pull requests for hsakmt and rocm-runtime, which is blocked by missing rocm-device-libs:
https://src.fedoraproject.org/rpms/hsakmt/pull-request/6
https://src.fedoraproject.org/rpms/rocm-runtime/pull-request/7 (see pull request about build failure on aarch64)

Also as per above, I updated the files to 5.0.0:

Spec URL: https://mystro256.fedorapeople.org/rocm-device-libs.spec
SRPM URL: https://mystro256.fedorapeople.org/rocm-device-libs-5.0.0-1.fc36.src.rpm

Comment 7 Felix Schwarz 2022-02-11 20:46:13 UTC
Package looks good to me, approved.

- The package requires clang-devel (which requires clang) so I think we can treat that as "BuildRequires: clang".
- rpmlint warning "only-non-binary-in-usr-lib" is a false positive (bitcode)


Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed


Issues:
=======
- If your application is a C or C++ application you must list a
  BuildRequires against gcc, gcc-c++ or clang.
  Note: No gcc, gcc-c++ or clang found in BuildRequires
  See: https://docs.fedoraproject.org/en-US/packaging-guidelines/C_and_C++/


===== MUST items =====

C/C++:
[x]: Package does not contain kernel modules.
[x]: Package contains no static executables.
[x]: Package does not contain any libtool archives (.la)
[x]: Rpath absent or only used for internal libs.

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: License field in the package spec file matches the actual license.
[x]: %build honors applicable compiler flags or justifies otherwise.
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[-]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Useful -debuginfo package or justification otherwise.
[x]: Package is not known to require an ExcludeArch tag.
[-]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 51200 bytes in 3 files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

===== SHOULD items =====

Generic:
[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[?]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[x]: Patches link to upstream bugs/comments/lists or are otherwise
     justified.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[-]: %check is present and all tests pass.
[x]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Large data in /usr/share should live in a noarch subpackage if package
     is arched.
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
$ rpmlint rocm-device-libs-5.0.0-1.fc36.src.rpm
rpmlint: 2.2.0
...
==== 1 packages and 0 specfiles checked; 0 errors, 0 warnings, 0 badness; has taken 0.1 s ====


Rpmlint (installed packages)
----------------------------
$ rpmlint rocm-device-libs-5.0.0-1.fc36.x86_64.rpm

rocm-device-libs.x86_64: W: only-non-binary-in-usr-lib
==== 1 packages and 0 specfiles checked; 0 errors, 1 warnings, 0 badness; has taken 0.1 s ====


Source checksums
----------------
https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/refs/tags/rocm-5.0.0.tar.gz#/ROCm-Device-Libs-5.0.0.tar.gz :
  CHECKSUM(SHA256) this package     : 83ed7aa1c9322b4fc1f57c48a63fc7718eb4195ee6fde433009b4bc78cb363f0
  CHECKSUM(SHA256) upstream package : 83ed7aa1c9322b4fc1f57c48a63fc7718eb4195ee6fde433009b4bc78cb363f0


Requires
--------
rocm-device-libs (rpmlib, GLIBC filtered):
    cmake-filesystem(x86-64)


Provides
--------
rocm-device-libs:
    cmake(AMDDeviceLibs)
    cmake(amddevicelibs)
    rocm-device-libs
    rocm-device-libs(x86-64)

Generated by fedora-review 0.7.6 (b083f91) last change: 2020-11-10
Command line :/usr/bin/fedora-review -b 2044664
Buildroot used: fedora-rawhide-x86_64
Active plugins: Shell-api, Generic, C/C++

Comment 8 Felix Schwarz 2022-02-11 20:47:09 UTC
fixing the bug summary

Comment 9 Jeremy Newton 2022-02-12 01:46:25 UTC
Thanks Felix

Comment 10 Igor Raits 2022-02-13 10:29:04 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/rocm-device-libs

Comment 11 Jeremy Newton 2022-02-13 14:52:23 UTC
Thanks Igor!

Pushed and built in rawhide


Note You need to log in before you can comment on or make changes to this bug.