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.
25 lines
985 B
Bash
25 lines
985 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
test_dir=$(mktemp -d)
|
|
trap 'rm -rf "$test_dir"' EXIT
|
|
clang -w -std=gnu11 -g -O1 -fsanitize=address,undefined \
|
|
-fno-sanitize-recover=all -ffunction-sections -fdata-sections \
|
|
-Ilinuxu/headers linuxu/tests/test_bitmap_contracts.c linuxu/src/shims/bitmap.c \
|
|
-Wl,-dead_strip -lpthread -o "$test_dir/test_bitmap_contracts"
|
|
"$test_dir/test_bitmap_contracts"
|
|
# Include order must not change allocation/address alignment contracts.
|
|
for first in kernel align; do
|
|
if [ "$first" = kernel ]; then second=align; else second=kernel; fi
|
|
cat > "$test_dir/align.c" <<SRC
|
|
#include <linux/$first.h>
|
|
#include <linux/$second.h>
|
|
_Static_assert(ALIGN(17ul,16) == 32, "round up");
|
|
_Static_assert(ALIGN_DOWN(16ul,16) == 16, "aligned down");
|
|
_Static_assert(ALIGN_DOWN(17ul,16) == 16, "round down");
|
|
int main(void) { return 0; }
|
|
SRC
|
|
clang -w -std=gnu11 -Ilinuxu/headers "$test_dir/align.c" -o "$test_dir/align"
|
|
"$test_dir/align"
|
|
done
|