Establish the Mojo 1.0 integration gate
This commit is contained in:
3
tools/mojo-spike/abi.mojo
Normal file
3
tools/mojo-spike/abi.mojo
Normal file
@@ -0,0 +1,3 @@
|
||||
@export("ds4_mojo_probe")
|
||||
def ds4_mojo_probe(value: Int32) abi("C") -> Int32:
|
||||
return value
|
||||
41
tools/mojo-spike/check.sh
Executable file
41
tools/mojo-spike/check.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
output_dir=target/mojo-spike
|
||||
mkdir -p "$output_dir"
|
||||
|
||||
uv sync --frozen
|
||||
|
||||
version=$(uv run --frozen --no-sync mojo --version)
|
||||
test "$version" = "Mojo 1.0.0 (ed45d567)"
|
||||
|
||||
uv run --frozen --no-sync mojo build --emit object \
|
||||
-o "$output_dir/abi.o" tools/mojo-spike/abi.mojo
|
||||
uv run --frozen --no-sync mojo build --emit shared-lib \
|
||||
-o "$output_dir/libds4_mojo_probe.dylib" tools/mojo-spike/abi.mojo
|
||||
|
||||
otool -L "$output_dir/libds4_mojo_probe.dylib" \
|
||||
> "$output_dir/abi-closure.txt"
|
||||
nm -u "$output_dir/libds4_mojo_probe.dylib" \
|
||||
> "$output_dir/abi-undefined.txt"
|
||||
|
||||
grep -F '@rpath/libKGENCompilerRTShared.dylib' \
|
||||
"$output_dir/abi-closure.txt" >/dev/null
|
||||
|
||||
if uv run --frozen --no-sync mojo build \
|
||||
-o "$output_dir/gpu-host" tools/mojo-spike/gpu_host.mojo \
|
||||
> "$output_dir/gpu-host-build.txt" 2>&1; then
|
||||
echo "unexpectedly found a GPU host runtime in the compiler-only environment" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep -F "unable to locate module 'max'" \
|
||||
"$output_dir/gpu-host-build.txt" >/dev/null
|
||||
|
||||
printf '%s\n' \
|
||||
"Mojo 1.0 compiler and C ABI: verified" \
|
||||
"Open Metal GPU host path: unavailable" \
|
||||
"Shared-library runtime closure: @rpath/libKGENCompilerRTShared.dylib" \
|
||||
"Decision: STOP until the runtime closure is explicitly redistributable"
|
||||
6
tools/mojo-spike/gpu_host.mojo
Normal file
6
tools/mojo-spike/gpu_host.mojo
Normal file
@@ -0,0 +1,6 @@
|
||||
from max.gpu.host import DeviceContext
|
||||
|
||||
|
||||
def main() raises:
|
||||
var context = DeviceContext()
|
||||
print(context.name())
|
||||
Reference in New Issue
Block a user