| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The value written into a shared variable's container outlives the call and may later be read by a function compiled for another backend, so JITLinker.output_filter is applied to update outputs while returned outputs keep their native backend type.
|
@juanitorduz tagged you because i was thinking about #2375, wondering if the solution to that wasn't also similar to this, adjustment of the linker behavior in a certain case for a certain backend. |
Sorry, something went wrong.
|
Check out #2285 You don't always care about cross backend compatibility so it offers an escape. It's also lazy, only done when a different backend would actually read it. Still worrried about overhead though. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Function.__call__ writes an update straight into the shared variable's storage slot, bypassing the container's filter, so after one MLX call the shared variable holds an mx.array instead of an ndarray. get_value() then returns a device array even with borrow=False, and passing that shared variable to a function compiled for another backend fails outright - a plain numba graph raises a TypingError on it.
JITLinker.output_filter already existed for this and was dead code, called by nothing. It's now applied to the outputs named in fgraph.update_mapping, and MLXLinker overrides it. Values returned to the caller still come back as mx.array; only what gets stored back in a container is converted. Backends that don't override the hook run the same thunk as before.