[HIP] add synchronize + vram_used profiling bindings (hipDeviceSynchronize / hipMemGetInfo) for batched-forward phase + VRAM instrumentation

This commit is contained in:
adm committed 2026-12-02 00:55:31 +01:00
1 parent c059a20aa9
commit 66a40631ee
2 files changed
+32

No files matched your search

+13
View File
@@ -82,6 +82,19 @@ extern "C" int vetta_buf_copy2d(void* dst, size_t dpitch, const void* src,
HIP_CHECK(hipMemcpy2D(dst, dpitch, src, spitch, width, height, hipMemcpyDeviceToDevice));
return 0;
}
// Block until all queued GPU work completes (profiling phase boundaries; the
// batched forward is otherwise fully async with no host sync until final d2h).
extern "C" int vetta_synchronize(void) {
HIP_CHECK(hipDeviceSynchronize());
return 0;
}
// VRAM used bytes (hipMemGetInfo: total-free), for allocation profiling.
extern "C" int vetta_vram_used(size_t* out) {
size_t free_b = 0, total_b = 0;
HIP_CHECK(hipMemGetInfo(&free_b, &total_b));
if (out) *out = total_b - free_b;
return 0;
}
// ---- k_rms_norm (kernel #2): y = x * rsqrt(mean(x^2)+eps) * w --------------
// One block per row; block-wide reduction over D. f32 in/out.