Skip to content
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

[HotFix] Adapt to changes to HIPRTC in current Staging/Mainline (future 6.1 RC) that disallow the use of <limits> in kernels #2650

Closed
wants to merge 5 commits into from

Conversation

junliume
Copy link
Collaborator

@junliume junliume commented Jan 2, 2024

as commented below, with this PR, one has to use

add -DMIOPEN_OVERRIDE_HIP_VERSION_MINOR=1 -DMIOPEN_OVERRIDE_HIP_VERSION_PATCH=24000

to CMake options

Workaround lifecycle is tracked by #2651

src/comgr.cpp Outdated
/// Hence the workaround is applicable for a range of hipRTC versions
/// and potentially in the future
#define WORKAROUND_HIPRTC_LIMITS \
(HIP_PACKAGE_VERSION_FLAT >= 6000023464ULL && HIP_PACKAGE_VERSION_FLAT < 6000023494ULL)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reviewers (@atamazov), these way points are the best we know at the moment, they may not be exactly precise but should work with official releases.

Copy link
Contributor

Choose a reason for hiding this comment

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

The HIP version in Staging is usually incorrect. Therefore, we should not rely on these numbers in the code (otherwise we will have more and more of mess in the source code). It's much better to replace the incorrect HIP version numbers with the correct expected ones (in this case 6.1.24xxx) and use the correct version.

Copy link
Collaborator Author

@junliume junliume Jan 2, 2024

Choose a reason for hiding this comment

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

@atamazov here is a summary of compiler versions and reported in the cmake output:

  • [Docker A] ROCm 6.0:

    • HIP version: 6.0.32830-d62f6a171
    • roc-6.0.0 23483 7208e8d15fbf218deb74483ea8c549c67ca4985e
    • -- Build with HIP 6.0.23494
  • [Docker B] The docker with all proposed hipRTC changes:

    • HIP version: 6.0.32830-dc7635e0d
    • roc-6.0.0 23483 7208e8d15fbf218deb74483ea8c549c67ca4985e
    • -- Build with HIP 6.0.23494
  • [Docker C] The latest mainline staging docker:

    • HIP version: 6.0.32830-606beddb1
    • amd-mainline-open 23512 8f0cb360b515076885176a3e5ba09dab6ecefa20
    • -- Build with HIP 6.0.23464

There are a few critical issues:

  • From Docker A and Docker B: hipRTC versioning is now decoupled from HIP package, so our code path control needs to accomodate.
  • From Docker C: the reported HIP version is incorrect

Copy link
Contributor

@atamazov atamazov left a comment

Choose a reason for hiding this comment

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

Why: #2650 (comment)

⚠️ In order to use the library with current staging/mainline compiler, the users have to add -DMIOPEN_OVERRIDE_HIP_VERSION_MINOR=1 -DMIOPEN_OVERRIDE_HIP_VERSION_PATCH=24000 to CMake options. Please inform QA about this.

src/comgr.cpp Outdated Show resolved Hide resolved
src/comgr.cpp Outdated Show resolved Hide resolved
@atamazov
Copy link
Contributor

atamazov commented Jan 2, 2024

@junliume Maybe let's rename PR to "[HotFix] Adapt to changes to HIPRTC in current Staging/Mainline (future 6.1 RC) that disallow the use of <limits> in kernels"?

@junliume junliume changed the title [HotFix] Customized limits header only applies to a range of compiler/hipRTC version [HotFix] Adapt to changes to HIPRTC in current Staging/Mainline (future 6.1 RC) that disallow the use of <limits> in kernels Jan 2, 2024
@@ -76,7 +76,7 @@ struct remove_cv
typedef typename remove_volatile<typename remove_const<T>::type>::type type;
};

#if HIP_PACKAGE_VERSION_FLAT >= 6001000000ULL
#if HIP_PACKAGE_VERSION_FLAT >= 6001024000ULL
Copy link
Collaborator Author

@junliume junliume Jan 2, 2024

Choose a reason for hiding this comment

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

@atamazov now with the header issue resolved, we found more issues with

/tmp/comgr-4e3a20/include/miopen_type_traits.hpp:81:8: error: redefinition of 'integral_constant'
   81 | struct integral_constant
      |        ^
/long_pathname_so_that_rpms_can_package_the_debug_info/src/external/clr/hipamd/include/hip/amd_detail/amd_hip_vector_types.h:55:38: note: previous definition is here
   55 | template <class _Tp, _Tp __v> struct integral_constant {
      |                                      ^

I guess we have to identify another point where this workaround is needed, and not the same point with the limits header.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can make it

#if HIP_PACKAGE_VERSION_FLAT > 6001024000ULL

but this is very fragile ...

@@ -30,7 +30,7 @@ typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
#if HIP_PACKAGE_VERSION_FLAT >= 6001000000ULL
#if HIP_PACKAGE_VERSION_FLAT >= 6001024000ULL
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Similar to https://github.com/ROCm/MIOpen/pull/2650/files#r1439946058

I am afraid this is fragile and might or might not break ...

@@ -41,6 +41,15 @@ namespace std {
template <typename T>
class numeric_limits;

template <>
Copy link
Collaborator Author

@junliume junliume Jan 3, 2024

Choose a reason for hiding this comment

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

@atamazov could you take a look? test_reduce_test seems to be needing this in the docker where I am testing. Also I may wonder if there could be other data types missing?

@@ -26,6 +26,9 @@
#pragma once

#ifdef MIOPEN_DONT_USE_HIP_RUNTIME_HEADERS
/// \todo: exact version from which this WA is needed should be updated in release
/// https://github.com/ROCm/MIOpen/issues/2651
#define WORKAROUND_USE_MORE_CUSTOM_TYPE_TRAITS (HIP_PACKAGE_VERSION_FLAT > 6001024000ULL)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@atamazov reviewers be noted that this line excludes the assumed (fake) version.

@junliume
Copy link
Collaborator Author

junliume commented Jan 4, 2024

replace with #2652

@junliume junliume closed this Jan 4, 2024
@junliume junliume deleted the fix_limits_apply branch February 6, 2024 20:10
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.

2 participants