The GitHub Actions job "Copilot code review" on tvm.git/refs/pull/19504/head 
has failed.
Run started by GitHub user Copilot (triggered by Copilot).

Head commit for run:
7cc4ce14ff6d0a0ef1ad05a73ef1251ff52d8a1b / David Gornshtein 
<[email protected]>
[Runtime][Metal] add TVM_METAL_STORAGE_MODE env opt-in for Shared/Managed 
buffers

Replaces the historical hard-coded MTLResourceStorageModePrivate at
MetalWorkspace::AllocDataSpace with a function-local static cache
seeded from the env var. Default behavior unchanged (env unset =>
Private). Accepted values (case-insensitive): private | shared | managed.
Unknown values fall back to Private with a warning.

Also registers a metal.GetStorageMode FFI helper for parity tests.

Motivation: zero-copy DLPack interop with MLX (which uses
MTLResourceStorageModeShared everywhere). Two allocators on the same
MTLDevice cannot share an MTLBuffer with different page-mapping
semantics, so DLPack capsules cross-imported between TVM-NDArray and
mx.array currently fail with std::bad_cast. With env=shared, both
allocators agree.

Live-verified on Apple Silicon (Xcode 21, MacOSX26.4 SDK):
runtime_check.mm probes confirm MTLBuffer.storageMode matches the env
var setting in all 4 scenarios (default, shared, managed, private).
Build: cmake -DUSE_METAL=ON .. && make tvm_runtime — 3 min on M-series.

Untouched on purpose:
- StagingBufferPool::GetOrCreate (host-staging, must remain Shared)
- MetalThreadEntry::GetTempBuffer (GPU->CPU readback bounce, must remain Shared)
- metal_module.mm kernel dispatch (Shared buffers are valid kernel args)

Polished version of the patch by parallel test agent (cppmega-mlx
Path C work). Replaces the earlier draft that had a smaller diff but
missed the FFI registration helper.

Report URL: https://github.com/apache/tvm/actions/runs/25309830185

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to