-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metal : wrap each operation in debug group #690
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm this is very interesting and potentially useful! If you know more ways to improve the metal code for debugging and profiling purposes (e.g. using instruments) - please share.
P.S. This does not have effect on performance in Release builds - correct?
There are some next steps I'd like to explore:
As far as I know, performance should be unaffected in release builds. In my testing locally, I didn't see any changing in the timings. Would wrapping the capture and debug logic in |
In Will sync the changes here soon |
@jmousseau How do you create these Metal debug captures that you've shown in the screenshot? I'm not very familiar with Xcode - been trying to figure it, but no luck so far. Would appreciate if you can share some step-by-step instructions |
@ggerganov Here are the steps I use, starting with Xcode project generation. cmake -DGGML_METAL=ON -DBUILD_SHARED_LIBS=Off -G Xcode .. open ggml.xcodeproj Select the ![]() Again click on the ![]() Traditionally, the easiest way to produce a Metal capture is with the "M" button above the debug console as shown below. ![]() However, this will only capture GPU work enqueued after the button is pressed. For traditional graphics programs, this isn't a problem as the next rendered frame will be captured. In our case, the work will be queued (command buffers and encoders created) before you're able to initiate the capture. Therefore, setting up the capture boundary programmatically necessary. In if (ggml_backend_is_metal(model.backend)) {
ggml_backend_metal_capture_next_compute(model.backend);
} Run the program by pressing the play button. Once the GPU work completes, Xcode will automatically open the Metal debugger. |
The screenshot below shows a Metal debug capture of
gpt-2-backend
with the addition of debug groups.