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

Fix build issues for musl libc (#267) #268

Open
wants to merge 4 commits into
base: amd-staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions libhsakmt/src/libhsakmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,15 @@ extern HsaVersionInfo hsakmt_kfd_version_info;
do { if ((minor) > hsakmt_kfd_version_info.KernelInterfaceMinorVersion)\
return HSAKMT_STATUS_NOT_SUPPORTED; } while (0)

extern int hsakmt_page_size;
extern int hsakmt_page_shift;

/* Might be defined in limits.h on platforms where it is constant (used by musl) */
/* See also: https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html */
#ifndef PAGE_SIZE
extern int hsakmt_page_size;
#define PAGE_SIZE hsakmt_page_size
#endif
#ifndef PAGE_SHIFT
extern int hsakmt_page_shift;
#define PAGE_SHIFT hsakmt_page_shift
#endif

Expand Down
6 changes: 3 additions & 3 deletions libhsakmt/tests/kfdtest/src/KFDTestUtilQueue.cpp
Copy link
Contributor

Choose a reason for hiding this comment

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

This portion should be covered by 09d789c , right?

Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ class AsyncMPSQ {
void PlacePacketOnNode(PacketList &packetList, int node, TSPattern tsp);

/* Run the packets placed on nodes and return immediately.*/
void Submit(void) { ASSERT_NE((HSAuint64)m_queue, NULL); m_queue->SubmitPacket(); }
void Submit(void) { ASSERT_NE(m_queue, NULL); m_queue->SubmitPacket(); }

/* Return only when all packets are consumed.
* If there is any packet issues some IO operations, wait these IO to complete too.
*/
void Wait(void) {
ASSERT_NE((HSAuint64)m_queue, NULL);
ASSERT_NE(m_queue, NULL);
m_queue->Wait4PacketConsumption(m_event, std::max((unsigned int)6000, g_TestTimeOut));
}

Expand Down Expand Up @@ -244,7 +244,7 @@ HSAuint64 AsyncMPSQ::Report(int indexOfPacket, HSAuint64 &begin, HSAuint64 &end)
if (m_ts_pattern == HEAD_TAIL)
indexOfPacket = 0;

EXPECT_NE((HSAuint64)m_ts, NULL)
EXPECT_NE(m_ts, NULL)
<< " Error " << ++error << ": No timestamp buf!" << std::endl;
/* m_ts_count is equal to packets count + 1, see PlacePacketOnNode().
* So the max index of a packet is m_ts_count - 2.
Expand Down
4 changes: 2 additions & 2 deletions libhsakmt/tests/kfdtest/src/OSWrapper.hpp
Copy link
Contributor

Choose a reason for hiding this comment

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

This block was intentional. If we have to pick one or the other, we want them to align. If PAGE_SIZE isn't defined, but PAGE_SHIFT=5000 , then setting just PAGE_SIZE=1<<12 won't really work.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
#include <sys/user.h>
#include <string>

#include "KFDTestFlags.hpp"
Expand All @@ -33,10 +35,8 @@

#ifndef PAGE_SIZE
#define PAGE_SIZE (1<<12)
#define PAGE_SHIFT (12)
#endif
#ifndef PAGE_SHIFT
#define PAGE_SIZE (1<<12)
#define PAGE_SHIFT (12)
#endif

Expand Down
Loading