mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
Runs the unmodified upstream Linux amdgpu and amdkfd drivers on Apple Silicon Macs inside a DriverKit system extension, for AMD GPUs attached over Thunderbolt. The Linux sources come from a pinned submodule and are compiled against linuxu, a userspace implementation of the Linux kernel APIs they use. Includes the HSA runtime, the host installer app, the setup and firmware fetch scripts, and the offline test suite.
26 lines
573 B
C
26 lines
573 B
C
/* linuxu: EDITED (third_party/linux/include/linux/log2.h)
|
|
* ilog2() family is provided as static inlines in linux/kernel.h;
|
|
* this header adds order_base_2() and ilog2_up() on top of that. */
|
|
#ifndef _LINUX_LOG2_H
|
|
#define _LINUX_LOG2_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
#ifndef ilog2_up
|
|
#define ilog2_up(n) ((n) <= 1 ? 0 : ilog2((n) - 1) + 1)
|
|
#endif
|
|
|
|
#ifndef order_base_2
|
|
#define order_base_2(n) \
|
|
((n) <= 1 ? 0 : ilog2((n) - 1) + 1)
|
|
#endif
|
|
|
|
static inline int __ilog2_u32(unsigned int v)
|
|
{
|
|
int r = 0;
|
|
while (v > 1) { v >>= 1; r++; }
|
|
return r;
|
|
}
|
|
|
|
|
|
#endif /* _LINUX_LOG2_H */ |