std1.0.0-beta-7 SafeC docs

std :: ml::gpu_mps

Function std::mps_square_f32_chained

#include <std/ml/gpu_mps.h> source · definition

int mps_square_f32_chained(struct MpsBuf buf, &float out, unsigned long n)

out[i] = buf[i] * buf[i] -- self-multiply of a single still-pending GPU buffer (both mul_kernel operand slots bound to the same buffer; reading the same device memory twice is safe, there's no write). Used by Tensor::square_gpu's forward pass for the loss computation's sq = diff * diff, where 'diff' is itself still GPU-pending -- the generic mps_mul_f32_chained above can't express this shape since its second operand has to already be a plain CPU array.