mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-23 08:59:28 -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.
19 lines
560 B
C
19 lines
560 B
C
/* linuxu: SHIM (third_party/linux/include/linux/math.h) */
|
|
#ifndef _LINUX_MATH_H
|
|
#define _LINUX_MATH_H
|
|
|
|
#include <linux/types.h>
|
|
#include <uapi/linux/kernel.h>
|
|
|
|
/* 64-bit host: __udiv_qr8 collapses to a single 128-bit divide-free path */
|
|
#define __udiv_qr8(n_hi, n_lo, d, q_hi, q_lo, r) \
|
|
do { \
|
|
unsigned long long __n = ((unsigned long long)(n_hi) << 32) | (n_lo); \
|
|
unsigned long long __q = __n / (d); \
|
|
*(q_hi) = (unsigned int)(__q >> 32); \
|
|
*(q_lo) = (unsigned int)(__q); \
|
|
*(r) = (unsigned int)(__n % (d)); \
|
|
} while (0)
|
|
|
|
#endif /* _LINUX_MATH_H */
|