Fix Metal crash on Intel Mac AMD GPU (missing setArgumentBuffer)#94
Closed
wendlinga wants to merge 1 commit into
Closed
Fix Metal crash on Intel Mac AMD GPU (missing setArgumentBuffer)#94wendlinga wants to merge 1 commit into
wendlinga wants to merge 1 commit into
Conversation
On macOS 11+, all GPUs are reported as Tier 2 for argument buffers. Intel Mac AMD GPUs (AMDMTLBronzeDriver) do not support Metal3 direct buffer addresses. The constructor skips setArgumentBuffer() when useArgumentBuffersTier2=true, leaving the encoder without a backing buffer. Calling setBuffer() on it then causes a SIGSEGV inside AMDMTLBronzeDriver. Fix: call setArgumentBuffer() before setBuffer() in the non-direct-address path.
abb241f to
de771ec
Compare
squidbus
reviewed
May 23, 2026
| // macOS 11+ reports all GPUs as Tier 2, but Intel AMD GPUs skip setArgumentBuffer | ||
| // in the constructor because useArgumentBuffersTier2 is true. Without this call | ||
| // the encoder has no backing buffer, causing a SIGSEGV in AMDMTLBronzeDriver. | ||
| argumentBuffer.argumentEncoder->setArgumentBuffer(argumentBuffer.mtl, argumentBuffer.offset); |
Contributor
There was a problem hiding this comment.
I think this makes sense to me, but I think we only need to call this once for the descriptor set, if there's some way we can make sure of that.
Contributor
|
Handled a little more simply in #98 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS 11+, all GPUs are reported as Metal Argument Buffers Tier 2.
The
MetalDescriptorSetconstructor therefore skips callingsetArgumentBuffer()on the argument encoder whenuseArgumentBuffersTier2 = true. However, whensetDescriptor()latercalls
argumentEncoder->setBuffer(...)for aDataTypePointerbinding,the AMD driver crashes because the encoder has no backing buffer:
Crash observed on: Intel MacBook Pro, AMD Radeon 555X (AMDMTLBronzeDriver),
macOS 15.7.4.
Fix
In the
DataTypePointercase ofsetDescriptor, callsetArgumentBuffer()before
setBuffer()whenuseDirectBufferAddressesis false (i.e. not onMetal3 hardware). This gives the encoder a valid backing buffer before any
encode operations:
Impact
useArgumentBuffersTier2 = true,useDirectBufferAddresses = false): crash eliminated.useDirectBufferAddresses = true): takes the direct GPU-address path as before — no change.useArgumentBuffersTier2 = false):setArgumentBufferis already called in the constructor; this path is unchanged.