chore(ml): migrate deprecated cudarc memcpy_* calls
cudarc 0.19 deprecated memcpy_stod (use clone_htod) and memcpy_dtov (use clone_dtoh). Six call sites in cuda_pipeline/mod.rs migrated. Pre-existing warnings surfaced now because the recent file-level allow(unsafe_code) on this file no longer per-line-suppresses the deprecated lint. Per feedback_no_legacy_aliases: rename call sites directly, no deprecated wrappers. Documented in dqn-wire-up-audit.md.
This commit is contained in:
@@ -1350,7 +1350,7 @@ mod tests {
|
||||
// q_values: uniform Q (zero) so direction is decided purely by C51
|
||||
// logits below; magnitude/order/urgency default to Boltzmann-uniform.
|
||||
let q_host = vec![0.0_f32; batch * q_stride];
|
||||
let q_buf = stream.memcpy_stod(&q_host).expect("upload q_values");
|
||||
let q_buf = stream.clone_htod(&q_host).expect("upload q_values");
|
||||
|
||||
// C51 logits: per-direction peaked at atom corresponding to target v.
|
||||
// Linear support v_min=-1 v_max=+1 delta_z=0.1 → atom_v = -1 + a*0.1.
|
||||
@@ -1370,7 +1370,7 @@ mod tests {
|
||||
b_logits_host[base + peak_a] = 5.0_f32;
|
||||
}
|
||||
}
|
||||
let b_logits_buf = stream.memcpy_stod(&b_logits_host).expect("upload logits");
|
||||
let b_logits_buf = stream.clone_htod(&b_logits_host).expect("upload logits");
|
||||
|
||||
// per_sample_support: [batch, b0, 3] stride-12 — every sample/direction
|
||||
// gets the same linear support [v_min, v_max, delta_z].
|
||||
@@ -1383,7 +1383,7 @@ mod tests {
|
||||
support_host[base + 2] = delta_z;
|
||||
}
|
||||
}
|
||||
let support_buf = stream.memcpy_stod(&support_host).expect("upload support");
|
||||
let support_buf = stream.clone_htod(&support_host).expect("upload support");
|
||||
|
||||
// SP17 Commit C (2026-05-08): v_logits_dir [batch, n_atoms] — V-head
|
||||
// logits row required by the Thompson direction selector. Required
|
||||
@@ -1397,7 +1397,7 @@ mod tests {
|
||||
// pre-SP17). Without this buffer the kernel reads stale stack
|
||||
// memory for v_logits_dir → SIGSEGV.
|
||||
let v_logits_host = vec![0.0_f32; batch * (n_atoms as usize)];
|
||||
let v_logits_buf = stream.memcpy_stod(&v_logits_host).expect("upload v_logits");
|
||||
let v_logits_buf = stream.clone_htod(&v_logits_host).expect("upload v_logits");
|
||||
|
||||
// SP10: ISV buffer with EVAL_THOMPSON_TEMP_INDEX set to 1.0
|
||||
// (pure Thompson). All other slots zero — kernel only reads
|
||||
@@ -1405,7 +1405,7 @@ mod tests {
|
||||
// block reads ISV[16]/[21] with cold-start fallback.
|
||||
let mut isv_host = vec![0.0_f32; ISV_TOTAL_DIM];
|
||||
isv_host[EVAL_THOMPSON_TEMP_INDEX] = 1.0;
|
||||
let isv_buf = stream.memcpy_stod(&isv_host).expect("upload isv");
|
||||
let isv_buf = stream.clone_htod(&isv_host).expect("upload isv");
|
||||
|
||||
let mut actions_buf = stream.alloc_zeros::<i32>(batch).expect("alloc actions");
|
||||
let mut q_gaps_buf = stream.alloc_zeros::<f32>(batch).expect("alloc q_gaps");
|
||||
@@ -1463,7 +1463,7 @@ mod tests {
|
||||
}
|
||||
stream.synchronize().expect("sync");
|
||||
|
||||
let host_actions = stream.memcpy_dtov(&actions_buf).expect("readback actions");
|
||||
let host_actions = stream.clone_dtoh(&actions_buf).expect("readback actions");
|
||||
let mut dir_hist = [0_u32; 4];
|
||||
for &a in &host_actions {
|
||||
let dir = (a / (b1 * b2 * b3)) as usize;
|
||||
|
||||
@@ -18776,3 +18776,19 @@ same justification comment: `crates/ml/examples/alpha_dqn_h600_smoke.rs`,
|
||||
`crates/ml/tests/smoke_test_real_data.rs`.
|
||||
|
||||
**Wire-up impact:** None (lint hygiene only — no semantic changes).
|
||||
|
||||
## 2026-05-22 — chore(ml): migrate deprecated cudarc memcpy_* calls
|
||||
|
||||
**Branch:** `ml-alpha-phase-a`. **Trigger:** cudarc 0.19 deprecated
|
||||
`CudaStream::memcpy_stod` (use `clone_htod`) and `CudaStream::memcpy_dtov`
|
||||
(use `clone_dtoh`). Pre-existing warnings became visible after the
|
||||
file-level `#![allow(unsafe_code)]` was added (it suppresses unsafe-block
|
||||
noise but not the `deprecated` lint).
|
||||
|
||||
**Change:** `crates/ml/src/cuda_pipeline/mod.rs` — 5 `memcpy_stod` →
|
||||
`clone_htod` (lines 1353, 1373, 1386, 1400, 1408) and 1 `memcpy_dtov` →
|
||||
`clone_dtoh` (line 1466). Same FFI semantics, just current cudarc API
|
||||
names. Per `feedback_no_legacy_aliases`: rename call sites directly, no
|
||||
deprecated wrappers retained.
|
||||
|
||||
**Wire-up impact:** None (API surface unchanged; FFI semantics identical).
|
||||
|
||||
Reference in New Issue
Block a user