Skip to content

How does async dispatch work on the CPU? #4218

Answered by apaszke
n2cholas asked this question in General
Discussion options

You must be logged in to vote

Now, I don't know how exactly is this implemented in JAX, but my guess is that it offloads work to some background thread that never acquires the GIL.

About PyTorch, there's no big technical reason why it doesn't do async dispatch on CPU, but one should understand that it's a tradeoff. The upside to async dispatch is obviously that when you have big ops, then your Python thread can run ahead and you don't have to pay anything for Python interpretation. The downsides are twofold. First, async dispatch generally increases implementation complexity. Second, if you actually have lots of small ops, then async dispatch only adds overhead on top of the Python interpretation. People often run sma…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by n2cholas
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants