build.rs compiles every .cu under crates/ml-backtesting/cuda/ to \$OUT_DIR/<name>.cubin via nvcc (no nvrtc per feedback_no_nvrtc.md); pairs every env::var with rerun-if-env-changed per pearl_build_rs_rerun_if_env_changed.md. Default arch sm_86 (RTX 3050 local); production sets FOXHUNT_CUDA_ARCH=sm_89 (L40S) or sm_90 (H100). First kernel: book_update_apply_snapshot — block-per-backtest replace of the 10-level book from a broadcast MBP-10 snapshot. Single-writer per level (thread tid = level idx), no atomics per feedback_no_atomicadd.md. lob_state.cuh defines the canonical per-block shared-mem layout that all subsequent kernels share (Book struct in this commit; Orders, Pos, IsvKellyState[5] added in C5-C7). LobSimCuda host struct (in src/sim.rs) constructed from an &MlDevice; owns per-backtest device book state + mapped-pinned input snapshots. apply_snapshot launches the kernel and synchronises; read_books drains device state for tests. Three Ring 1 fixture tests (book_update_replace, _two_step, _n_backtests=4) — N≤4 bit-exact GPU oracle assertions loaded from JSON. All three pass on RTX 3050 locally. Verifies the build-script → cubin → cudarc.load_cubin → kernel launch → DtoH read pipeline end-to-end. cudarc added as direct path dep (../../vendor/cudarc) since it's not in [workspace.dependencies] — same vendored fork ml-alpha uses. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
21 lines
437 B
Plaintext
21 lines
437 B
Plaintext
// Per-block shared-mem layout for the LOB simulator.
|
|
// One block = one parallel backtest. See spec §2 + §5b.
|
|
//
|
|
// MUST stay in sync with crates/ml-backtesting/src/lob/mod.rs's host mirrors.
|
|
|
|
#ifndef LOB_STATE_CUH
|
|
#define LOB_STATE_CUH
|
|
|
|
#define N_HORIZONS 5
|
|
#define MAX_LIMITS 32
|
|
#define MAX_STOPS 16
|
|
|
|
struct Book {
|
|
float bid_px[10];
|
|
float bid_sz[10];
|
|
float ask_px[10];
|
|
float ask_sz[10];
|
|
};
|
|
|
|
#endif // LOB_STATE_CUH
|