[HIP] GPU backend bring-up: feature-gated hipcc build + first verified kernel on gfx1150
- New crate vetta-infer-hip: HIP FFI/DMA backend (unsafe isolated here per AGENTS.md). Kernel build is feature-gated (`hip`, default OFF) so `cargo test --workspace` stays host-independent (97/97, no toolchain). build.rs invokes hipcc --offload-arch=gfx1150, archives libvetta_kernels.a, links amdhip64 from ROCM_PATH/lib. - kernels/hip/vetta_kernels.hip: device query, minimal device-buffer lifecycle (alloc/free/h2d/d2h, RAII DeviceBuf), and the first microkernel k_rms_norm_f32 (one block/row, shared-mem reduction). C ABI extended in vetta_kernels.h. - Safe wrappers: query_device, DeviceBuf, rms_norm_f32. Verified LIVE on Sogliola (cargo test -p vetta-infer-hip --features hip -- --ignored): device = AMD Radeon 890M Graphics gfx1150 CU=8 UMA=true; rms_norm parity vs CPU oracle max_rel_err ~1.3e-6 across rows 1/4/3/2 and d 2304/128/1024 (tolerance 1e-4). First GPU compute verified end-to-end: hipcc -> static lib -> FFI -> launch -> parity. This opens the GPU execution half (executor + remaining kernels toward the first served token).
This commit is contained in:
1 parent
f57060caa7
commit
bd0d4f2a63
7 files changed
+361
No files matched your search
@@ -26,6 +26,16 @@ int vetta_hip_query_device(int dev_id, vetta_device_info_t* out_info);
|
||||
int vetta_hip_register_uma_pages(void* host_aligned_ptr, size_t bytes, void** out_dev_ptr);
|
||||
int vetta_hip_unregister_uma_pages(void* host_aligned_ptr);
|
||||
|
||||
// Minimal device buffer lifecycle (executor foundation).
|
||||
int vetta_buf_alloc(void** out, size_t bytes);
|
||||
int vetta_buf_free(void* p);
|
||||
int vetta_buf_h2d(void* dst, const void* src, size_t bytes);
|
||||
int vetta_buf_d2h(void* dst, const void* src, size_t bytes);
|
||||
|
||||
// k_rms_norm (kernel #2): y[row] = x[row] * rsqrt(mean(x^2)+eps) * w.
|
||||
int vetta_rms_norm_f32(const float* x, const float* w, float* y,
|
||||
int rows, int D, float eps, vetta_stream_t stream);
|
||||
|
||||
// Core <15 microkernel entry points (implemented progressively in M1 & M2):
|
||||
// 1. k_embed_bf16
|
||||
// 2. k_rms_norm
|
||||
|
||||
Reference in new issue
Block a user