SIGN IN SIGN UP

Fix MPS buffer initialization during runtime (#3824)

Summary:
Previously MPS would have assumed the same CPU buffer would be passed in for the same lowered graph, but this assumption was wrong and was leading to incorrect results when running llama.
This change wraps the CPU buffer inside a MTLBuffer and passes it to the GPU directly (there is no copying around on devices with shared memory and `macOS >= 14 / iOS >= 17`)

cc cccclai, larryliu0820

Pull Request resolved: https://github.com/pytorch/executorch/pull/3824

Reviewed By: larryliu0820

Differential Revision: D58120143

Pulled By: cccclai

fbshipit-source-id: 94ada5c7d22603e7f707024e5ec9f5c5850b4ad5
D
Denis Vieriu committed
f21676cba342c132ed450a83c08293ced14fbbfb
Parent: a1222af
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 6/4/2024, 6:48:40 PM