bujjibabukatta opened a new pull request, #19917: URL: https://github.com/apache/tvm/pull/19917
When using from __future__ import annotations, Python evaluates type hints as strings. This caused the TVMScript parser to crash when trying to parse TIR functions (throwing an Unexpected type for TIR Arg: ffi.String error). I added logic in the TIR parser (tirx/script/parser/parser.py) to detect if an argument or return annotation evaluates to a string. If it does, we parse the string back into a valid TVMScript AST expression and re-evaluate it against the current environment. Validation: Verified that TVMScript can now correctly parse string-based type annotations that reference local variables (e.g., M in T.Buffer((M,), "float32")) without throwing unexpected type errors, ensuring full compatibility with Python's modern type hinting standards. Code syntax and parser logic have been validated locally. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
