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

[Issue]: musl build issues in rocm-6.3.0 release #267

Open
AngryLoki opened this issue Dec 15, 2024 · 0 comments · May be fixed by #268
Open

[Issue]: musl build issues in rocm-6.3.0 release #267

AngryLoki opened this issue Dec 15, 2024 · 0 comments · May be fixed by #268

Comments

@AngryLoki
Copy link
Contributor

AngryLoki commented Dec 15, 2024

Problem Description

Hi, there are new issues in musl libc builds,

Issues with libhsakmt:

  1. result of daad183#diff-681b7d40f71f20573413d5072e1c381fde6c02aed03a56307afcbe82cf3f5e5eR36-R37f - extern int hsakmt_page_shift is under ifndef, while it should not
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/src/openclose.c: In function 'init_page_size':
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/src/openclose.c:117:9: error: 'hsakmt_page_size' undeclared (first use in this function); did you mean 'hsakmt_page_shift'?
  117 |         hsakmt_page_size = sysconf(_SC_PAGESIZE);
      |         ^~~~~~~~~~~~~~~~
      |         hsakmt_page_shift
  1. warning of PAGE_SIZE macro redefinition (defined previously in limits.h)

  2. no operator to compare 0 with std::nullptr_t (null is defined as nullptr_t, following https://eel.is/c++draft/support.types.nullptr)

In file included from /var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/KFDTestUtil.hpp:27,
                 from /var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/BaseQueue.hpp:28,
                 from /var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/SDMAQueue.hpp:27,
                 from /var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/KFDTestUtilQueue.cpp:28:
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/gtest-1.6.0/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = std::nullptr_t]':
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/KFDTestUtilQueue.cpp:60:29:   required from here
19072 |   GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
      |                            ^
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/gtest-1.6.0/gtest/gtest.h:18573:28: error: invalid operands of types 'const long unsigned int' and 'std::nullptr_t' to binary 'operator!='
18573 | GTEST_IMPL_CMP_HELPER_(NE, !=);
      |                            ^
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/gtest-1.6.0/gtest/gtest.h:18558:12: note: in definition of macro 'GTEST_IMPL_CMP_HELPER_'
18558 |   if (val1 op val2) {\
      |            ^~

Issues with hsa-runtime:

Attempt to fix issues with missing symbols pthread_attr_setaffinity_np and pthread_rwlockattr_setkind was done earlier, but suggested patch was reworked and partially reverted in 1cee865.

  1. reverted commit checked if pthread_attr_setaffinity_np symbol exists, but this check did not work (and effectively disabled better path), because this function requires #define _GNU_SOURCE (see https://man7.org/linux/man-pages/man3/pthread_attr_setaffinity_np.3.html)

  2. non-reverted part implied that pthread_rwlockattr_setkind function replaces pthread_rwlockattr_setkind_np, which is incorrect. This function is non-portable, PTHREAD_RWLOCK_PREFER_WRITER_NP serves as a hint and has no alternatives.

Please see the linked PR, which fixes these issues.

AngryLoki added a commit to AngryLoki/ROCR-Runtime that referenced this issue Dec 15, 2024
This fixes few issues, which allow to build and pass kfdtest on musl-based systems:

1) result of ROCm@daad183#diff-681b7d40f71f20573413d5072e1c381fde6c02aed03a56307afcbe82cf3f5e5eR36-R37f - `extern int hsakmt_page_shift` is under `ifndef`, while it should not
```
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/src/openclose.c: In function 'init_page_size':
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/src/openclose.c:117:9: error: 'hsakmt_page_size' undeclared (first use in this function); did you mean 'hsakmt_page_shift'?
  117 |         hsakmt_page_size = sysconf(_SC_PAGESIZE);
      |         ^~~~~~~~~~~~~~~~
      |         hsakmt_page_shift
```

2) warning of `PAGE_SIZE` macro redefinition (defined previously in `limits.h`)

3) no operator to compare 0 with std::nullptr_t (null is defined as nullptr_t, following https://eel.is/c++draft/support.types.nullptr)
```
In file included from /var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/KFDTestUtil.hpp:27,
                 from /var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/BaseQueue.hpp:28,
                 from /var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/SDMAQueue.hpp:27,
                 from /var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/KFDTestUtilQueue.cpp:28:
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/gtest-1.6.0/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = std::nullptr_t]':
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/src/KFDTestUtilQueue.cpp:60:29:   required from here
19072 |   GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
      |                            ^
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/gtest-1.6.0/gtest/gtest.h:18573:28: error: invalid operands of types 'const long unsigned int' and 'std::nullptr_t' to binary 'operator!='
18573 | GTEST_IMPL_CMP_HELPER_(NE, !=);
      |                            ^
/var/tmp/portage/dev-libs/roct-thunk-interface-6.3.0/work/ROCR-Runtime-rocm-6.3.0/libhsakmt/tests/kfdtest/gtest-1.6.0/gtest/gtest.h:18558:12: note: in definition of macro 'GTEST_IMPL_CMP_HELPER_'
18558 |   if (val1 op val2) {\
      |            ^~
```

Closes: ROCm#267
Signed-off-by: Sv. Lockal <[email protected]>
@AngryLoki AngryLoki linked a pull request Dec 15, 2024 that will close this issue
@AngryLoki AngryLoki changed the title [Issue]: musl build issues in rocm-6.3.0 release in libhsakmt [Issue]: musl build issues in rocm-6.3.0 release Dec 15, 2024
dayatsin-amd pushed a commit that referenced this issue Jan 29, 2025
Change-Id: Ia31330b0f96669966712b58986abeca754c2cbb9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant