Skip to content
fn

pin_shared_storage

void pin_shared_storage(SharedStorage & sh, const int & shape)

Give a shared buffer its one MLX external array (sh.gpu_alias).

No-op when sh is already pinned or empty. Every later copy of sh shares the array, which is what keeps GPU aliases from being donated.

Parameters

Descriptor to pin.
shapeconst Shape&
Shape of the tensor adopting the buffer.