How does Candle's metal implementation work? #2160
-
A couple of quick questions with regards to candle-metal-kernels. I'd like to know if my understanding as it relates to launching candle-metal-kernels is correct?
Additionally,
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@LaurentMazare, @MilkFather, @tomsanbear - was not sure if this page is actively monitored. So, I thought I'd tag contributors to the |
Beta Was this translation helpful? Give feedback.
-
Hey @nihalpasham The logic to commit the buffer is in the metal backend source code. The backend currently will encode up to ~50 encoders into the command buffer then will commit the buffer after that. Commits will also occur any time that a shared memory access occurs (to_cpu or copy operation atm). |
Beta Was this translation helpful? Give feedback.
I figured out what I was missing.
Yep, that makes sense. Commands are encoded in a command buffer but only committed when one of two conditions is met:
In my previous example with a simple
matmul
operation, I kept adding breakpoints to find the indirect manual trigger that commits the corresponding command buffer. However, I overlooked inspecting the print statement itself.T…