-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[RFC] Support Tensorflow Op Bridge #3059
Comments
This is somewhat related to DLPack support: tensorflow/tensorflow#24453 if we can get DLPack support into tensorflow, then it will be natural to add such support. If there is someone who is interested in adding DLPack support to Tensorflow, we can then move on from there It is already possible through for frameworks that support DLPack, such as pytorch and mxnet, see |
Thanks for taking a look at this! And btw huge fan of all your other work :D I would love to have DLPack support directly in TF and agree that would make this ask easier. However I'd like to point out an alternative path that has some advantages from a project management / open source collaboration POV. Getting DLPack support merged into TF is likely 10x more work than support level 1 described above. And in fact, just getting some minimal example working would be a useful step towards the more general solution, both in making issues more explicit, but also in terms of providing raw material for those who may be more expert in TF to pick up and polish further. So DLPack-in-TF is not strictly a hard requirement, and it might be useful to try to do this the other way around. Thanks! |
OK, I agree. Let us know if you are interested in exploring level 1 and contribute a tutorial. TVM compiler function’s can be directly used in C++ programs, take a look at the deploy example in apps and the only question is about how to hook that into TF related data structure, contribution is welcomed |
@kovasb Nice to see your interest into our TVM&TF NMT article:) Also we have had some internal discussions regarding to adding non-TF DL compiler backend into TF as a complementary for XLA, and TVM is absolutely one of the great choices. There are some principles I think we might need to follow to ensure the smooth integration:
There are some scenarios we estimated to be suitable for this feature and already started the design and refine work. If you have any interests, it would be highly appreciated to provide your concrete use case or jump into the design&discussion directly. Thanks |
@yangjunpro +1 on your work. As Relay is also planning to support dynamic shape(#3042), we might not need to directly handle step 5(relay does the JIT/bucketing under the hood). We are also thinking that is it reasonable to do the opposite, the main runtime is tvm runtime, and fallback to TensorFlow for unsupported ops, would it yield a solution that has lower memory footprint? Maybe we can open a discussion thread to further discuss(on both)? Since we don't really have an action item yet. cc @yongwww @zhiics @icemelon9 |
Move to #4464 |
This is a feature request.
Can we make this kind of integration easy to achieve for end users?
https://tvm.ai/2018/03/23/nmt-transformer-optimize.html
whereby TVM is used to create a kernel that is then exported into the TF runtime. After searching, I was unable to find open source code of this kind of integration. For someone who knows both systems at the appropriate layers this is probably easy, but for someone who doesn't, its a big friction to figure out all the details.
There are two main scenerios where this is beneficial for TF users:
To achieve this, there are 2 forms of support that would be useful:
Support level 1 would be sufficient for folks like me who are very interested in the results reported by Alibaba, but for whom there is too much friction or lack the experience to easily try this out and see if its worth investing in further.
Support level 2 would be useful for the median TF model developer, folks that don't want to touch/be aware of the C++ level but do want to try out optimizations.
Further background:
Currently there is no way to create TF ops besides C++ programming. The closest contender, XLA, only allows compiling existing ops, but does not allow creating new ops based on novel combinations of the XLA primitives. Furthermore XLA is highly restricted in what primitives it supports, for example convolution is only supported for floating point.
Eventually it will be possible to create TF ops in Swift and other MLIR-targeting systems, but this will likely take years, whereas the TVM infra is ready to go today. Therefore TVM is uniquely positioned to fill a significant gap in the TF ecosystem.
Thank you for your consideration.
The text was updated successfully, but these errors were encountered: