Exporter writes kernel.cl next to kernel.cu (same instruction list; memory-hard core emitted in a third, OpenCL C dialect with the same literals as memhard.h). Pack headers are now C99-safe so a plain C host can include them. proto-opencl/host.c: C99 + OpenCL 1.2 API, device list, runtime build, cache fill and FNV check, dataset build and self-test, 3 vector warps standalone and in batch, bench and sweep as host.cu, whole-batch fingerprint. The 32-lane exchange is sub_group_shuffle_xor only when the queried sub-group size for a 32-item work-group is exactly 32; otherwise a local-memory exchange with one barrier per exchange, so wave64 hardware cannot change the hash (WAVEFRONT.md). build.sh (macOS, Linux), build.bat (MSVC), README with the exact AMD-rig commands. Proven without AMD silicon: Apple OpenCL 1.2 on the M5 Max 96/96 on all three packs (45.0 Mhash/s at 1 GiB, Apple number, not AMD); pocl 7.2 CPU device 96/96 on both exchange paths including the real sub_group_shuffle_xor text; CPU emulator 7 configurations incl. 64-wide sub-groups, identical fingerprint f99fb375b3abeaf5 everywhere. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
48 lines
1.9 KiB
Bash
Executable file
48 lines
1.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Build igneum-bench-cl for one program pack (macOS or Linux).
|
|
# Usage: ./build.sh [pack] [loader]
|
|
# pack directory name under ../proto-cuda/packs/ (default igneum-genesis-mh)
|
|
# loader macOS only: "apple" (default) links Apple's deprecated OpenCL.framework; "khr" links the Khronos ICD loader
|
|
# from Homebrew (brew install opencl-headers opencl-icd-loader pocl) so a CPU OpenCL 3.0 device can be tested.
|
|
# On Linux the argument is ignored and -lOpenCL is used (AMD ROCm, AMD Adrenalin for Linux, Mesa rusticl/clover,
|
|
# NVIDIA or Intel runtimes all register with the system ICD loader).
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
PACK="${1:-igneum-genesis-mh}"
|
|
LOADER="${2:-apple}"
|
|
PACKDIR="../proto-cuda/packs/$PACK"
|
|
|
|
if [ ! -f "$PACKDIR/kernel.cl" ]; then
|
|
echo "no pack at $PACKDIR (expected kernel.cl, program.h, vectors.h); regenerate with proto-metal/igneum-bench --export-pack" >&2
|
|
exit 1
|
|
fi
|
|
|
|
CC="${CC:-cc}"
|
|
COMMON=(-std=c99 -O2 -Wall -Wextra -I "$PACKDIR" -DIGNEUM_KERNEL_PATH="\"$PACKDIR/kernel.cl\"")
|
|
OUT="igneum-bench-cl-$PACK"
|
|
|
|
case "$(uname -s)" in
|
|
Darwin)
|
|
if [ "$LOADER" = "khr" ]; then
|
|
PREFIX="$(brew --prefix 2>/dev/null || echo /opt/homebrew)"
|
|
OUT="$OUT-khr"
|
|
set -x
|
|
"$CC" "${COMMON[@]}" -DIGNEUM_KHR_HEADERS -I "$PREFIX/opt/opencl-headers/include" -o "$OUT" host.c \
|
|
-L "$PREFIX/opt/opencl-icd-loader/lib" -lOpenCL
|
|
set +x
|
|
echo "built ./$OUT (Khronos ICD loader; run with OCL_ICD_VENDORS=$PREFIX/etc/OpenCL/vendors)"
|
|
else
|
|
set -x
|
|
"$CC" "${COMMON[@]}" -Wno-deprecated-declarations -o "$OUT" host.c -framework OpenCL
|
|
set +x
|
|
echo "built ./$OUT (Apple OpenCL 1.2, deprecated since macOS 10.14; correctness check only, not an AMD number)"
|
|
fi
|
|
;;
|
|
*)
|
|
set -x
|
|
"$CC" "${COMMON[@]}" -o "$OUT" host.c -lOpenCL -ldl
|
|
set +x
|
|
echo "built ./$OUT"
|
|
;;
|
|
esac
|