quic-sanirudh edited a comment on pull request #9422:
URL: https://github.com/apache/tvm/pull/9422#issuecomment-957287696


   Some tests are failing because of the header `from tvm.script import tir as 
T` when being passed into the `tvm.script.from_source()` function.
   
   I see 2 potential ways to fix this and wanted to get suggestions on which 
might be better:
   
   1. First is to add a new boolean argument to the `.script()` function called 
`print_header`, that is set to `True` by default, but passed as `False` when 
they're passed to `from_source` function. 
     - The disadvantage here is that this would mean anyone who uses this 
(`from_source()`) or any other similar function needs to know that the 
`print_header` should be set to `False`.
     - An alternative is to set `print_header` to `False` by default, and use 
`print_header=True` in our docs as a convention.
   2. Second is to modify the `from_source` such that it considers only the 
lines starting from a decorator such as `@T.prim_func` or 
`@tvm.script.ir_module`. (i.e. the first line of the source would be a line 
starting with `@` and everything above would be discarded.).
     - I don't see any major disadvantage here except that we need to do some 
string manipulation of the generated script directly
   3. There could be a third simpler option, which is just to assume that the 
header is alwyas just a single import statement, so we can just check for and 
remove that.
   
   @Hzfengsy @junrushao1994 Both first and third options seem straight forward, 
but let me know what you think.
   
   Thanks,
   Anirudh


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to