trevor-m commented on pull request #6395:
URL: https://github.com/apache/incubator-tvm/pull/6395#issuecomment-692319247
> > I have already created an API to retrieve the TRT version if TVM is
compiled with the TRT runtime enabled. However, one of our use cases is to use
TVM on a CPU-only instance to cross-compile models. For that use case, we want
to be able to target compilation for different TRT versions - this affects the
partitioning rules mostly. I don't think having to rebuild TVM for each target
version will be a good solution.
> > Is it possible for my annotation functions to access the pass context
and therefore a TRT config that I will be adding as @masahi suggested? I don't
see any other python code accessing the PassContext though...
>
> Looks like `GetConfig` does not expose to the Python side.
I see, in that case I think my current implementation using a global
variable is fine since it is all confined within the one file.
> Zhi just pointed to me offline about how to access pass context configs in
Python. Here is an example:
>
> ```python
> import tvm
> with tvm.transform.PassContext(config={"relay.fallback_device_type": 5}):
> pass_ctx = tvm.transform.PassContext.current()
> print(pass_ctx.config["relay.fallback_device_type"])
> ```
Nice! Let me try that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]