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
[PY] refactoring - move devices-related functions from tvm.runtime.ndarray #11126
base: main
Are you sure you want to change the base?
Conversation
…tvm.runtime.devices
Thanks @pfk-beta , the original rationale was that device is closely coupled with ndarray itself(as ndarray is the only places that device get allocated). Re-exposing the devices under tvm.runtime namespace would indeed be a readability improvement. From UX's pov we intentionally expose tvm.cpu/tvm.cuda not for internal development but for users, so we would like to keep those exposures to avoid API breaking. For the same reason(although weaker as there are less usages here), we might want to to keep One simple approach is to re-expose nd.cpu etc in the runtime namespace, and use runtime.device in most of the places you mention. This would be the least surgical change while retains the readability part. |
You mean devices - functions, not module which I created, right? They were already exposed, I just standrized imports and usage of them. Even python api documentation list these functions in tvm.runtime (https://tvm.apache.org/docs/reference/api/python/runtime.html)
That is why, I didn't remove devices functions from top My proposition is:
|
Thanks @pfk-beta . I agree this is a positive change towards readability. Please check the linter error(all new files needs ASF header). The overall convention of using |
To clarify, you mean using |
sorry, i meant |
Hello,
I'm not sure whether it needs RFC, but it was little messy in python runtime code (related to my answer, not main thread in this post https://discuss.tvm.apache.org/t/pre-rfc-more-meaningful-names-in-rpc-module-in-python/12618). I have moved
device, cpu, cuda, gpu, opencl, cl, vulkan, metal, mtl, vpi, rocm, ext_dev
functions fromtvm.runtime.ndarray
totvm.runtime.devices
and reimported them intvm.runtime
, so we can use following statement:In previous version there was mix of following: