-
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
[RELAY][VM] Add shape_of instruction #5855
Conversation
cc @mbrookhart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume this is to make heterogeneous execution easier? Should we add a pass to the VM that converts regular shape_of ops to vm.shape_of ops for easier use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
python/tvm/relay/op/dialect/vm.py
Outdated
@@ -0,0 +1,35 @@ | |||
# Licensed to the Apache Software Foundation (ASF) under one | |||
# or more contributor license agreements. See the NOTICE file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us simply use relay.op.vm and mark it as a dialect in the comment. Since QNN is also a dialect but does not belong to the dialect namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out. I changed it to relay.op.vm. Maybe we should have such a namespace in the long run? Likely, we can have dialect.vm, dialect.memory, dialect.qnn, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@tqchen could you please take another look? |
This PR adds a VM instruction
ShapeOf
to get the shape of a tensor at runtime. This instruction is always executed on CPU as there is no computation required.cc @icemelon9 @jroesch @wweic