GpuStorage shared_storage_to_gpu(const SharedStorage & sh, const int & shape)Adopt a unified-memory SharedStorage as a GpuStorage view.
Wraps the underlying MTLResourceStorageModeShared buffer as a
fresh MLX array without copying. The result is readable + writable
from both CPU and GPU (subject to Metal's memory-model rules).
Parameters
shconst SharedStorage&Source storage backed by a shared Metal buffer.
shapeconst Shape&Logical shape to view the buffer with.
Returns
GpuStorageA non-copying view participating in MemoryTracker accounting. It shares sh.version with the CPU view.
Notes
When sh is pinned the result is a copy of sh.gpu_alias (reshaped
if shape differs), so MLX never sees it as the buffer's sole owner and
cannot donate the buffer to an op's output. This is the canonical fast
path for results produced by run_metal_kernel that flow back into
MLX-based ops.