flashinfer.cake_rmsnorm_train.cake_rmsnorm_train_backward_workspace_bytes¶
- flashinfer.cake_rmsnorm_train.cake_rmsnorm_train_backward_workspace_bytes(rows: int, hidden: int, device: device, *, residual: bool = False) int¶
Bytes of the caller-owned backward workspace of width
hiddenondevicefor up torowstokens.The workspace holds the
uint32chunk-claim and completion counters in its firstcake_jit.COUNTERS_BYTESbytes, then the FP32 per-chunkdwpartial rows: one row per chunk of the backward chunk table, whose count is bounded bymin(rows, MAX_ROUNDS x slots)of the route’s largest persistent grid (cake_jit.chunk_capacity). The size grows withrowsand a buffer sized forrowsserves every call with at most that many tokens. The counters must be zero on first use (allocate withtorch.zerosor usecake_rmsnorm_train_backward_workspace()); the kernels leave them zero, so the same buffer is reusable across calls and CUDA Graph replays without host writes.