How to use target.list_tags()?

When I use target.list_tags(), It always says cuda. I have however set cuda flag off while making tvm and in the code I’ve written target=‘llvm’. What is the possible cause of this?

Screenshot from 2020-10-23 18-31-45

The output is expected. The API list_tags lists the existing tags that have been registered to the system, not the target used in the current scope - in this case, I believe you are looking for Target.current().

If the document of list_tags is confusing, would you like to send a PR to clarify the usage? Thanks!

Thanks for the reply. I’ll send a clarification PR once this is more clear to me. I tried Target.current(), but I am still not getting the desired output. It just says none. Am I doing something wrong here?

You need to call current in a target context, meaning that calling current in the “with” block.

1 Like

as Cody said, like this

with tvm.target.Target("llvm"):
  print(tvm.Target.current())
2 Likes