Skip to content

Commit

Permalink
ROCm 5.4.1 updates
Browse files Browse the repository at this point in the history
Internal commit:8c882858e8aba7f1da88f374fc5196c36cc65a00
  • Loading branch information
dayatsin-amd committed Dec 14, 2022
1 parent 5e08dcc commit 2e52dc8
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 3 deletions.
91 changes: 91 additions & 0 deletions src/RPM/hsa-rocr.spec.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Restore old style debuginfo creation for rpm >= 4.14.
%undefine _debugsource_packages
%undefine _debuginfo_subpackages

# -*- rpm-spec -*-
BuildRoot: %_topdir/@CPACK_PACKAGE_FILE_NAME@@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH@
Summary: @CPACK_RPM_PACKAGE_SUMMARY@
Name: @CPACK_RPM_PACKAGE_NAME@
Version: @CPACK_RPM_PACKAGE_VERSION@
Release: @CPACK_RPM_PACKAGE_RELEASE@
License: @CPACK_RPM_PACKAGE_LICENSE@
Group: @CPACK_RPM_PACKAGE_GROUP@
Vendor: @CPACK_RPM_PACKAGE_VENDOR@

# Modifications to allow recommends to be used (not implemented in cpack):
%if "@CPACK_RPM_PACKAGE_RECOMMENDS@" != ""
Recommends: @CPACK_RPM_PACKAGE_RECOMMENDS@
%endif
# End of modifications

@TMP_RPM_URL@
@TMP_RPM_REQUIRES@
@TMP_RPM_REQUIRES_PRE@
@TMP_RPM_REQUIRES_POST@
@TMP_RPM_REQUIRES_PREUN@
@TMP_RPM_REQUIRES_POSTUN@
@TMP_RPM_PROVIDES@
@TMP_RPM_OBSOLETES@
@TMP_RPM_CONFLICTS@
@TMP_RPM_SUGGESTS@
@TMP_RPM_AUTOPROV@
@TMP_RPM_AUTOREQ@
@TMP_RPM_AUTOREQPROV@
@TMP_RPM_BUILDARCH@
@TMP_RPM_PREFIXES@
@TMP_RPM_EPOCH@

@TMP_RPM_DEBUGINFO@

%define _rpmdir %_topdir/RPMS
%define _srcrpmdir %_topdir/SRPMS
@FILE_NAME_DEFINE@
%define _unpackaged_files_terminate_build 0
@TMP_RPM_SPEC_INSTALL_POST@
@CPACK_RPM_SPEC_MORE_DEFINE@
@CPACK_RPM_COMPRESSION_TYPE_TMP@

%description
@CPACK_RPM_PACKAGE_DESCRIPTION@

# This is a shortcutted spec file generated by CMake RPM generator
# we skip _install step because CPack does that for us.
# We do only save CPack installed tree in _prepr
# and then restore it in build.
%prep
mv $RPM_BUILD_ROOT %_topdir/tmpBBroot

%install
if [ -e $RPM_BUILD_ROOT ];
then
rm -rf $RPM_BUILD_ROOT
fi
mv %_topdir/tmpBBroot $RPM_BUILD_ROOT

@TMP_RPM_DEBUGINFO_INSTALL@

%clean

%post
@RPM_SYMLINK_POSTINSTALL@
@CPACK_RPM_SPEC_POSTINSTALL@

%postun
@CPACK_RPM_SPEC_POSTUNINSTALL@

%pre
@CPACK_RPM_SPEC_PREINSTALL@

%preun
@CPACK_RPM_SPEC_PREUNINSTALL@

%files
%defattr(@TMP_DEFAULT_FILE_PERMISSIONS@,@TMP_DEFAULT_USER@,@TMP_DEFAULT_GROUP@,@TMP_DEFAULT_DIR_PERMISSIONS@)
@CPACK_RPM_INSTALL_FILES@
@CPACK_RPM_ABSOLUTE_INSTALL_FILES@
@CPACK_RPM_USER_INSTALL_FILES@

%changelog
@CPACK_RPM_SPEC_CHANGELOG@

@TMP_OTHER_COMPONENTS@
12 changes: 9 additions & 3 deletions src/core/runtime/amd_topology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,21 @@ bool Load() {
}
MAKE_NAMED_SCOPE_GUARD(kfd, [&]() { hsaKmtCloseKFD(); });

// Build topology table.
BuildTopology();

// Register runtime and optionally enable the debugger
// BuildTopology calls hsaKmtAcquireSystemProperties() causes libhsakmt to cache topology
// information. So we need to call hsaKmtRuntimeEnable() after calling BuildTopology() so that
// Thunk can re-use it's cached copy instead of re-parsing whole system topology. Otherwise
// BuildTopology will cause libhsakmt to destroyed cached copy because it calls
// hsaKmtReleaseSystemProperties() at the beginning.

HSAKMT_STATUS err =
hsaKmtRuntimeEnable(&_amdgpu_r_debug, core::Runtime::runtime_singleton_->flag().debug());
if ((err != HSAKMT_STATUS_SUCCESS) && (err != HSAKMT_STATUS_NOT_SUPPORTED)) return false;
core::Runtime::runtime_singleton_->KfdVersion(err != HSAKMT_STATUS_NOT_SUPPORTED);

// Build topology table.
BuildTopology();

kfd.Dismiss();
return true;
}
Expand Down

0 comments on commit 2e52dc8

Please sign in to comment.