Store the frontend task object in the REPL struct.#48400
Conversation
|
@KristofferC and @rfourquet seem to have made the most changes to the REPL sources lately, so pinging for review. |
|
I must admit I don't understand the problem this would solve, so I can't really comment. This change seems fine though, although in-code comments and/or tests would be welcome such that it's not reverted accidentally in a future commit. |
|
So GPU arrays need all their operations to be implemented using vectorized functions, which dispatch to a GPU kernel. Base however has plenty of fallback functions that perform element-wise operations (think There's one big exception to this: the display stack. We don't want to have to reimplement every function getindex(::GPUArray, idx...)
current_task() == Base.active_repl.frontend_task && return
error("scalar getindex not allowed")
end |
(cherry picked from commit 87f8958)
This makes it possible for GPU back-ends to allow so-called scalar iteration (element-wise copies of elements, often triggered by
iteratein generic fallbacks, normally disallowed because it indicates that processing is happening on the CPU) in the REPL, where it is often triggered byshowmethods visualizing output.If this isn't too controversial, I'd like to get this in 1.9 because it is a significant QOL improvement to GPU users.
X-ref JuliaGPU/GPUArrays.jl#446