-
Notifications
You must be signed in to change notification settings - Fork 222
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
view(::CuArray, ...)
is sometimes type-unstable:
#2526
Comments
Is this a problem? It's not always worthwhile to trade excessive specialization to get rid of a type instability. Especially in the scope of GPU operations, where everything is a multi-us call anyway, dynamic dispatch is pretty fast. |
I haven't measured it, and I suspect it's not. I was just surprised that it's not type stable. That's a fair point about specialization, but does that mean that it must be type unstable? |
No, with sufficient inlining / constant propagation / effects annotations the code could be made inferrable. |
True, and where do you (and how do you) @maleadt draw the line when trading off between specialization and dynamic dispatch on the GPU 🤔? On the CPU, making everything type-stable seems good, but on the GPU I can only rely on benchmarks - it is sometimes tedious and time-consuming. |
Typically relating things to the cost of a kernel launch (~20us), e.g., some dynamic dispatches or allocations are much faster than that. |
Thanks! |
Here is a reproducer:
Here is the error output:
I think that this is because view on the last dimension can (efficiently) return a regular CuArray, instead of a SubArray, but it's not clear to me why this would lead to a JET failure.
The text was updated successfully, but these errors were encountered: