khj809 opened a new pull request, #18639:
URL: https://github.com/apache/tvm/pull/18639

   This PR fixes the type annotation checker in 
`tvm.tir.schedule._type_checker` to correctly handle subscripted generics 
(e.g., `Union[str, int]`, `List[str]`, `Tuple[str, int]`) in Python 3.14+.
   
   ## Background
   In Python 3.14, the internal representation of generic types has changed:
   - `Union[str, int]` is now of type `typing.Union` instead of 
`typing._GenericAlias` or `typing._SpecialGenericAlias`
   - These types now have `__origin__` attribute directly on the type object
   - The existing type checker failed to recognize these new representations, 
causing the dispatcher to fall through to "atomic" instead of correctly 
identifying them as "union", "list", etc.
   
   ## Changes
   Added a check for `__origin__` attribute at the beginning of the method to 
handle Python 3.14's new generic type representations. This is fully backward 
compatible since the new `__origin__` check is only applied when the attribute 
exists.
   
   ## Tests
   Added parametrized tests to verify the dispatcher correctly handles 
subscripted generics:
   - `Union[str, int]` → identified as "union"
   - `List[str]` → identified as "list"
   - `Dict[str, int]` → identified as "dict"
   - `Tuple[str, int]` → identified as "tuple"
   - `Union[List[str], Dict[str, int]]` → identified as "union" with nested 
generics


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

Reply via email to