phase 0+1: project scaffold + xserv-cuda crate

- Cargo workspace with xserv-cuda crate
- CUDA FFI bindings (cudart: memory, stream, device, error)
- GpuBuffer RAII wrapper with H2D/D2H/D2D copy
- CudaStream wrapper with RAII Drop
- CachingAllocator with size-bucketed free lists
- PinnedBuffer for page-locked host memory
- Device info query via cudaDeviceGetAttribute
- Vector-add CUDA kernel smoke test
- Integration test suite (11 tests)
- build.rs: cc crate compiles .cu for SM 12.0
- sync-and-build.sh for remote build on dash5
- Roadmap doc (docs/00-roadmap.md) and Phase 0+1 design doc

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-21 18:40:22 +08:00
commit 9806b4db35
16 changed files with 2629 additions and 0 deletions

25
tools/sync-and-build.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Sync local project to dash5 and build/test there.
# Usage: ./tools/sync-and-build.sh [test|build|run]
set -e
REMOTE="dash5"
REMOTE_DIR="/opt/wjh/projects/xserv"
LOCAL_DIR="$(cd "$(dirname "$0")/.." && pwd)"
ACTION="${1:-build}"
echo "=== Syncing to $REMOTE:$REMOTE_DIR ==="
ssh "$REMOTE" "mkdir -p $REMOTE_DIR"
rsync -az --delete \
--exclude target \
--exclude .git \
"$LOCAL_DIR/" "$REMOTE:$REMOTE_DIR/"
echo "=== Running: cargo $ACTION ==="
ssh "$REMOTE" "source \$HOME/.cargo/env && \
export PATH=/usr/local/cuda/bin:\$PATH && \
export CUDA_HOME=/usr/local/cuda && \
cd $REMOTE_DIR && \
cargo $ACTION --release 2>&1"