Skip to content

gpui: Take advantage of unified memory on Apple silicon#45577

Merged
reflectronic merged 16 commits intozed-industries:mainfrom
marcocondrache:fix/silicon-mem-metal
Jan 29, 2026
Merged

gpui: Take advantage of unified memory on Apple silicon#45577
reflectronic merged 16 commits intozed-industries:mainfrom
marcocondrache:fix/silicon-mem-metal

Conversation

@marcocondrache
Copy link
Contributor

@marcocondrache marcocondrache commented Dec 23, 2025

Reapplies #44273

I included metal-rs upgrade so we can get this working on Intel-based Macs

cc: @JosephTLyons @notpeter @rtfeldman @Anthony-Eid

Release Notes:

  • Reduced memory usage on Apple-silicon Macs by using shared memory where appropriate

Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 23, 2025
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Dec 23, 2025
@marcocondrache
Copy link
Contributor Author

@Anthony-Eid The upstream PR has been merged, and I’ve updated both core-video and metal-rs, so this PR is ready to be merged as well. If we have the release today, it would be great to merge this so it gets a full week of testing in nightly.

@Anthony-Eid
Copy link
Contributor

@Anthony-Eid The upstream PR has been merged, and I’ve updated both core-video and metal-rs, so this PR is ready to be merged as well. If we have the release today, it would be great to merge this so it gets a full week of testing in nightly.

Thanks for keeping track of this! I'm enabling auto merge

@Anthony-Eid Anthony-Eid enabled auto-merge (squash) January 29, 2026 17:36
auto-merge was automatically disabled January 29, 2026 17:45

Head branch was pushed to by a user without write access

@marcocondrache
Copy link
Contributor Author

@Anthony-Eid sorry I had to fix a leftover from a conflict. The ci should pass now

@reflectronic reflectronic enabled auto-merge (squash) January 29, 2026 17:54
@reflectronic reflectronic merged commit ba41499 into zed-industries:main Jan 29, 2026
26 checks passed
@notpeter
Copy link
Contributor

Sorry @marcocondrache.
I didn't get a chance to test this branch before it got merged.
Did anyone test this on Intel Macs to confirm it works?

I updated nightly from 949972b...22e2c7a and I'm seeing the same behavior I reported in #45020

Zed Nightly launches, no display surface, no errors in log. Hangs and needs to be Force Quit.
Output from a debug build on main (b1fd95b) is the same as before:

-[MTLTextureDescriptorInternal validateWithDevice:]:1416: failed assertion `Texture Descriptor Validation
MTLTextureDescriptor: MTLResourceStorageModeMemoryless is not a supported storage mode on this device.
MTLTextureDescriptor: Multisample textures cannot be allocated with MTLResourceStorageModeMemoryless on this device.
'
zsh: abort      cargo run

@Anthony-Eid
Copy link
Contributor

@notpeter I'm going to revert this, thanks for the heads up

Anthony-Eid added a commit that referenced this pull request Jan 29, 2026
Anthony-Eid added a commit that referenced this pull request Jan 29, 2026
)

Reverts #45577

This still causes gpui to be unusable for Intel Macs and by extension
Zed.

Release Notes:

- N/A
Finityno added a commit to Finityno/zed that referenced this pull request Feb 10, 2026
Port PR zed-industries#45577 performance changes for Apple Silicon-focused builds:\n- use Shared + write-combined buffers when unified memory is available\n- cache unified-memory capability in renderer/atlas\n- skip did_modify_range sync on unified memory\n- use private/memoryless texture storage where applicable\n- bump metal to 0.33 and core-video to 0.5.2
Finityno added a commit to Finityno/zed that referenced this pull request Feb 10, 2026
Port PR zed-industries#45577 performance changes for Apple Silicon-focused builds:\n- use Shared + write-combined buffers when unified memory is available\n- cache unified-memory capability in renderer/atlas\n- skip did_modify_range sync on unified memory\n- use private/memoryless texture storage where applicable\n- bump metal to 0.33 and core-video to 0.5.2
Finityno added a commit to Finityno/zed that referenced this pull request Feb 16, 2026
Port PR zed-industries#45577 performance changes for Apple Silicon-focused builds:\n- use Shared + write-combined buffers when unified memory is available\n- cache unified-memory capability in renderer/atlas\n- skip did_modify_range sync on unified memory\n- use private/memoryless texture storage where applicable\n- bump metal to 0.33 and core-video to 0.5.2
Anthony-Eid pushed a commit that referenced this pull request Feb 21, 2026
Third attempt to land this improvement: (#45577, #44273)

The previous PR didn’t work on Intel MacBooks because I made a wrong
assumption about the unified memory check. `has_unified_memory` only
tells us that the CPU and GPU share memory. It does not mean we’re
running on an Apple GPU family.

Memoryless textures are only supported on Apple GPUs. Some Intel Macs
report unified memory, but they don’t support memoryless textures, which
is why the previous change failed there.

So instead of relying on unified memory, we now explicitly check that
we’re running on an Apple GPU family before enabling memoryless
textures.

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [X] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Reduced memory usage on macOS

---------

Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants