junrushao1994 commented on PR #79: URL: https://github.com/apache/tvm-rfcs/pull/79#issuecomment-1204646078
Thanks for following up! > the parser and IRBuilder are only called for statements and for function calls. Is this correct? In fact we allow registering visitors for any Python AST constructs. For example, we could specify the behavior when visiting type annotations, function arguments, etc. > And I want this buffer to be a `TIRBuffer` when the language is tir and a `RelaxBuffer` when the language is relax. It’s allowed with our infrastructure, but in reality, we instead prefer to use prefix, i.e. `T.Buffer` and `R.Buffer` which is more friendly to python tooling. > how does this IRBuilder approach handle error catching and reporting It handles error reporting in a consistent approach with the current parser, i.e. using `DiagnosticContext` and its rendering. In your specific case, where the error comes from a type mismatch of a particular parameter of a function call, despite being not well supported in the current parser (only supported in a small subset of buffer-related intrinsics: [`match_buffer`](https://github.com/apache/tvm/blob/df29e826290a3eba606a93b59f640e025b5cbd4d/python/tvm/script/tir/special_stmt.py#L144-L147), [`buffer_decl`](https://github.com/apache/tvm/blob/df29e826290a3eba606a93b59f640e025b5cbd4d/python/tvm/script/tir/special_stmt.py#L217-L220), [`alloc_buffer`](https://github.com/apache/tvm/blob/df29e826290a3eba606a93b59f640e025b5cbd4d/python/tvm/script/tir/special_stmt.py#L277-L279)) and the mechanism is not general enough, it is in fact one of our design consideration before starting to work on this project, as well as overall tooling of the entire TVM project. A general mechanism is that we interpret expressions in finer-grained level and do runtime type checking. -- 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]
