std :: ml::gpu_mps
Function std::mps_matmul_abt_f32_chained
int mps_matmul_abt_f32_chained(
struct MpsBuf bufDC,
const &float b,
&float out,
unsigned long M,
unsigned long N,
unsigned long K,
)Same idea as mps_matmul_f32_chained/mps_relu_f32_chained above, for the backward chain (matmul2-backward's dA=dH output feeds relu-backward's selfGrad input; relu-backward's output feeds matmul1-backward's dC input) -- each takes the upstream op's pending GPU buffer for whichever argument is the flowing gradient, so no CPU round trip happens for it. The other argument (always an ordinary already- populated Tensor -- a forward activation or a weight matrix) stays a plain CPU float array, same restriction as the forward chained pair. mps_matmul_abt_f32_chained: 'bufDC' replaces 'a' (the incoming gradient) -- for a deeper graph where dC is itself still-pending. mps_matmul_atb_f32_chained: 'bufDC' replaces 'b' (matmul_atb_f32's second argument is the incoming gradient) -- this is the one this library's own 2-layer MLP training loop actually needs, for dW1 = X^T . dH_pre where dH_pre is relu-backward's pending output. mps_relu_backward_f32_chained: 'bufSelfGrad' replaces 'selfGrad' -- this library's own MLP needs this one too, for dH_pre = relu'(H) * dH where dH is matmul2-backward's pending dA output.