std :: ml::gpu_mps
Function std::mps_add_f32
int mps_add_f32([]const float a, []const float b, []float out)Elementwise 'out[i] = a[i] + b[i]' for i in [0, n), computed on the GPU via a small inline Metal Shading Language compute kernel compiled at runtime. Returns 1 on success, 0 if no Metal device is available or any step of the pipeline setup fails (compile error in the embedded MSL source, no GPU present, etc.) โ 'out' is left untouched on failure.
Verified working end-to-end on real Apple Silicon hardware (correct output for a real GPU dispatch). Previously segfaulted at the dispatchThreadgroups:threadsPerThreadgroup: call specifically โ root cause was a genuine SafeC compiler codegen bug (fixed in CodeGen.cpp's genCall), not anything specific to this file: any indirect call passing two or more consecutive struct-by-value arguments over 16 bytes (and not a Homogeneous Floating-point Aggregate) through a function-pointer cast hit it, because this compiler represented such arguments as raw LLVM aggregate values instead of the AAPCS64-correct "caller copies to a stack temporary, passes a plain pointer" form โ self-consistent for SafeC-to-SafeC calls (which is why that never showed up before), but not what a real, externally-compiled function like objc_msgSend's target IMP expects to receive in its argument registers.