Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions projects/hipblaslt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,86 @@ if(HIPBLASLT_ENABLE_CLIENT AND HIPBLASLT_ENABLE_SAMPLES)
rocm_package_setup_client_component(samples)
endif()

# libtensilelite-host.so ships as its own package (tensilelite-host) instead of
# inside hipblaslt's runtime component, so hipSPARSELt can depend on the one
# ~6.5 MB shared library without pulling hipblaslt's ~1.6 GB of Tensile kernel
# binaries. See AIHPBLAS-4434.
#
# Guard on the target TYPE rather than BUILD_SHARED_LIBS: at this scope
# BUILD_SHARED_LIBS holds HIPBLASLT_BUILD_SHARED_LIBS, which describes
# libhipblaslt, not tensilelite-host. The two are set independently
# (TENSILELITE_BUILD_SHARED_LIBS vs HIPBLASLT_BUILD_SHARED_LIBS), so only the
# target's own TYPE says whether there is a .so to package.
if(TARGET tensilelite-host)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is fragile and non-deterministic. Prefer to gate on a config option.

get_target_property(_tensilelite_host_type tensilelite-host TYPE)
if(_tensilelite_host_type STREQUAL "SHARED_LIBRARY")
rocm_package_setup_component(tensilelite
LIBRARY_NAME tensilelite
PACKAGE_NAME host
)

# rocm-cmake's packaging defaults set CPACK_RPM_PACKAGE_AUTOREQPROV to
# Off for every ROCm library, so no package currently Provides or
# Requires a soname. Re-enable rpmbuild's ELF scanning for this one
# component: tensilelite-host then Provides
# libtensilelite-host.so.1()(64bit), derived from the binary rather
# than hand-written, so the capability tracks SOVERSION automatically.
# This is scoped to the component and does not change any other
# package's dependency surface.
set(CPACK_RPM_TENSILELITE_PACKAGE_AUTOREQPROV "ON")

# CPack uses CPACK_RPM_<COMPONENT>_PACKAGE_REQUIRES *instead of* the
# global CPACK_RPM_PACKAGE_REQUIRES when the component-scoped variable
# is defined (CPackRPM.cmake:1098-1106). Defining a runtime-scoped
# dependency therefore drops every global one -- hipblaslt's runtime
# package silently lost "roctracer >= 1.0.0" and "rocm-core".
#
# Carry the global list into the component before adding anything, and
# add rocm-core explicitly because rocm_package_add_rocm_core_dependency
# appends it to the global list from inside rocm_create_package, which
# runs after this point.
if(CPACK_RPM_PACKAGE_REQUIRES)
rocm_package_add_rpm_dependencies(COMPONENT runtime
DEPENDS "${CPACK_RPM_PACKAGE_REQUIRES}")
endif()
if(ROCM_DEP_ROCMCORE)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Where is ROCM_DEP_ROCMCORE introduced?

if(ENABLE_ASAN_PACKAGING)
rocm_package_add_rpm_dependencies(COMPONENT runtime DEPENDS "rocm-core-asan")
else()
rocm_package_add_rpm_dependencies(COMPONENT runtime DEPENDS "rocm-core")
endif()
endif()

# hipBLASLt's own libhipblaslt.so carries DT_NEEDED on this soname, so
# the runtime package must require it. Stated as the soname capability
# rather than a package name: the dynamic linker enforces the same
# string, and a SOVERSION bump updates both sides together.
rocm_package_add_rpm_dependencies(COMPONENT runtime
DEPENDS "libtensilelite-host.so.1()(64bit)")
Comment on lines +956 to +957

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we hardcoding a .1 here?


# Same component-shadows-global rule applies on the Debian side.
if(CPACK_DEBIAN_PACKAGE_DEPENDS)
rocm_package_add_deb_dependencies(COMPONENT runtime
DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}")
endif()
if(ROCM_DEP_ROCMCORE)
if(ENABLE_ASAN_PACKAGING)
rocm_package_add_deb_dependencies(COMPONENT runtime DEPENDS "rocm-core-asan")
else()
rocm_package_add_deb_dependencies(COMPONENT runtime DEPENDS "rocm-core")
endif()
endif()

# Debian gets no soname dependency here, so name the package. No
# version constraint: tensilelite-host is versioned with hipBLASLt only
# until it has a version of its own, and an exact pin would record that
# coupling in package metadata. The SOVERSION is the ABI contract.
rocm_package_add_deb_dependencies(COMPONENT runtime
DEPENDS "tensilelite-host")
endif()
unset(_tensilelite_host_type)
endif()

if(ROCM_LIBS_SUPERBUILD OR NOT HIPBLASLT_IS_SUBPROJECT)
set(HIPBLASLT_CONFIG_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Path placed into ldconfig file")
rocm_create_package(
Expand Down
13 changes: 9 additions & 4 deletions projects/hipblaslt/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,14 +863,19 @@ def _normalized(p: str) -> str:
if install_pkg:
with c.cd(str(build_subdir)):
c.run("make package")
# hipBLASLt does not only produce hipblaslt-* packages: libtensilelite-host.so
# ships as tensilelite-host (see CMakeLists.txt, rocm_package_setup_component).
# Globbing hipblaslt-* alone leaves the .so uninstalled, and a downstream
# find_package(hipblaslt) then fails on the imported roc::tensilelite-host
# target pointing at a file that was never installed.
if distro == "ubuntu":
_elevate(c, f"dpkg -i {build_subdir}/hipblaslt[-_]*.deb")
_elevate(c, f"dpkg -i {build_subdir}/hipblaslt[-_]*.deb {build_subdir}/tensilelite-host[-_]*.deb")
elif distro in ("centos", "rhel", "almalinux"):
_elevate(c, f"rpm --nodeps -U {build_subdir}/hipblaslt-*.rpm")
_elevate(c, f"rpm --nodeps -U {build_subdir}/hipblaslt-*.rpm {build_subdir}/tensilelite-host-*.rpm")
elif distro == "fedora":
_elevate(c, f"dnf install {build_subdir}/hipblaslt-*.rpm")
_elevate(c, f"dnf install {build_subdir}/hipblaslt-*.rpm {build_subdir}/tensilelite-host-*.rpm")
elif distro in ("sles", "opensuse-leap"):
_elevate(c, f"zypper -n --no-gpg-checks install {build_subdir}/hipblaslt-*.rpm")
_elevate(c, f"zypper -n --no-gpg-checks install {build_subdir}/hipblaslt-*.rpm {build_subdir}/tensilelite-host-*.rpm")


# ---------------------------------------------------------------------------
Expand Down
13 changes: 11 additions & 2 deletions projects/hipblaslt/tensilelite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,19 @@ if(TENSILELITE_ENABLE_HOST)
add_subdirectory(src)
add_subdirectory(include)

# The shared library ships in its own "tensilelite" component (package
# tensilelite-host) rather than hipblaslt's runtime component. hipSPARSELt
# needs this one ~6.5 MB .so; bundling it in hipblaslt's runtime package
# would force every hipSPARSELt install to pull ~1.6 GB of Tensile kernel
# binaries it does not use. See AIHPBLAS-4434.
# Interim: the static archive, headers and the roc::tensilelite-host
# imported target still ship through hipblaslt-devel and the
# hipblaslt-targets export set. A standalone tensilelite package moves
# them to its own export set, config file and devel package.
install(TARGETS tensilelite-host
EXPORT hipblaslt-targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT runtime
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT tensilelite
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT tensilelite
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel
FILE_SET tensilelite_public_headers
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT devel
Expand Down
Loading