feat(gpu-log): add gpu_log_ids.h — single source of truth for ring IDs
This commit is contained in:
39
crates/ml-alpha/cuda/gpu_log_ids.h
Normal file
39
crates/ml-alpha/cuda/gpu_log_ids.h
Normal file
@@ -0,0 +1,39 @@
|
||||
// gpu_log_ids.h — single source of truth for log-ring kernel/record IDs.
|
||||
//
|
||||
// Both kernel-side (#include from .cu files) and Rust-side decoder reference
|
||||
// these symbols. Drift between them is checked by `build.rs` (Task 2).
|
||||
//
|
||||
// kernel_id (uint8) — which kernel emitted the record.
|
||||
// record_type (uint8) — sub-type within the kernel (input/state/output/debug).
|
||||
// payload layout — defined per (kernel_id, record_type) in decoder.
|
||||
|
||||
#ifndef GPU_LOG_IDS_H
|
||||
#define GPU_LOG_IDS_H
|
||||
|
||||
#define GPU_LOG_N_KERNELS 8
|
||||
#define GPU_LOG_N_RT_PER_KERNEL 4
|
||||
#define GPU_LOG_N_RECORDS_PER_STEP (GPU_LOG_N_KERNELS * GPU_LOG_N_RT_PER_KERNEL)
|
||||
#define GPU_LOG_N_SLOTS 32768
|
||||
#define GPU_LOG_RECORD_BYTES 64
|
||||
#define GPU_LOG_PAYLOAD_F32 12
|
||||
#define GPU_LOG_MAGIC 0xF0F0A710u
|
||||
|
||||
// Kernel IDs (uint8). Add new kernels at the bottom; never reorder.
|
||||
#define KID_SMOOTHNESS_CONTROLLER 0
|
||||
#define KID_OUTPUT_SMOOTHNESS 1
|
||||
#define KID_BCE_MULTI_HORIZON 2
|
||||
#define KID_HORIZON_LAMBDA 3
|
||||
#define KID_HEADS_GRN_FWD 4
|
||||
#define KID_HEADS_GRN_BWD 5
|
||||
#define KID_CFC_STEP 6
|
||||
#define KID_RESERVED_7 7
|
||||
|
||||
// Record types within a kernel (uint8). Reuse RT_INPUT/STATE/OUTPUT/DEBUG
|
||||
// across kernels — payload layout differs per (kid, rt) pair but the four
|
||||
// roles are conventional.
|
||||
#define RT_INPUT 0
|
||||
#define RT_STATE 1
|
||||
#define RT_OUTPUT 2
|
||||
#define RT_DEBUG 3
|
||||
|
||||
#endif // GPU_LOG_IDS_H
|
||||
Reference in New Issue
Block a user