Repository navigation
GPU Metal: reconstruction on Metal bringup - #16052
Merged
Merged
Conversation
Pass the tuned thread count as maxTotalThreadsPerThreadgroup, the Metal equivalent of __launch_bounds__. Without it the register allocation can leave room for fewer threads than the tuning table assumes, and the launch was clamped: on an M1 Max (applegpu_g13s) the two TRD tracker kernels got 384 instead of 512, and the TPC compression gather kernel 832 instead of 1024, which breaks its block-wide scans.
The GPUMemClean16 blit committed its command buffer directly, so the stream kept the committed buffer as its open one, and the next encoder on that stream aborted with "failed assertion _status < MTLCommandBufferStatusCommitted". The clear was also never waited for.
The event slots were only placement-constructed as nil ids, so the first StreamWaitForEvents threw "object cannot be nil" from encodeWaitForEvent. Create an MTLSharedEvent per slot, as the CUDA backend creates its events, and release them on exit.
The events signalled and waited for the fixed value 1, and ReleaseEvent reset them to 0, so a wait issued after a release, or for an event not recorded yet, never completed: the GPU watchdog killed each such command buffer after about 10 s, and the queue then dropped all later work. On a 5-event pp time frame this made the TPC reconstruction take 80 s and return nothing. Count up per event instead: RecordMarker signals the next value, a wait asks for the last recorded one and is a no-op if there is none, as cudaStreamWaitEvent is, and ReleaseEvent does nothing, as in CUDA.
DrainStream waited for the submitted command buffers but never looked at their status, so a kernel that faulted or hung only showed up as missing output. Print the Metal error of a failed buffer.
Member
Author
|
Compiles, does not touch anything outside the right now disabled metal folder. |
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.
No description provided.