Align DeepSeek and GLM execution with DS4
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Standalone oracle only. Never add its C objects to Cargo or the app bundle.
|
||||
set -euo pipefail
|
||||
if [[ $# != 2 ]]; then
|
||||
echo "usage: bash tools/build-ds4-session-reference.sh REFERENCE_DIRECTORY OUTPUT_BINARY" >&2
|
||||
exit 2
|
||||
fi
|
||||
reference=$(cd "$1" && pwd)
|
||||
output=$2
|
||||
cd "$(dirname "$0")/.."
|
||||
[[ $(git -C "$reference" rev-parse HEAD) == ec7642cdd9ec81d01ad4b1fd8f8a3d1511533748 ]]
|
||||
[[ $(shasum -a 256 "$reference/ds4.h" | cut -d ' ' -f 1) == 1fe2491b0b709222dd41076d35b6eb85684d8c467a691ff4d45534d329f06360 ]]
|
||||
git -C "$reference" diff --exit-code HEAD -- ds4.h ds4.c ds4_metal.m ds4_image.c ds4_distributed.c ds4_tp.c ds4_ssd.c ds4_layer_pack.c metal
|
||||
# Refuse stale objects. If necessary, build the authorized reference separately.
|
||||
make -q -C "$reference" ds4
|
||||
json_library=$(cargo build --release --bin test-supervisor -j 4 --message-format=json |
|
||||
jq -rs '[.[] | select(.reason == "compiler-artifact" and .target.name == "serde_json") | .filenames[] | select(endswith(".rlib"))] | last')
|
||||
[[ -n $json_library ]]
|
||||
probe_dir=$(mktemp -d)
|
||||
trap 'rm -f "$probe_dir/canary.o"; rmdir "$probe_dir"' EXIT
|
||||
clang -c -O3 -fobjc-arc -ffast-math -mcpu=native -I native/metal \
|
||||
native/metal/ds4_canary.m -o "$probe_dir/canary.o"
|
||||
link=()
|
||||
for object in ds4 ds4_image ds4_distributed ds4_tp ds4_ssd ds4_metal ds4_layer_pack; do
|
||||
link+=(-C "link-arg=$reference/$object.o")
|
||||
done
|
||||
rustc --edition 2024 -O -D warnings tools/ds4-session-reference.rs \
|
||||
--extern "serde_json=$json_library" -L dependency=target/release/deps \
|
||||
-C "link-arg=$probe_dir/canary.o" \
|
||||
"${link[@]}" -l framework=Foundation -l framework=Metal -l objc -l pthread -l m \
|
||||
-o "$output"
|
||||
Reference in New Issue
Block a user