Skip to content

Commit

Permalink
better error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
shingjan committed Dec 1, 2021
1 parent 2644738 commit 38d58cd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions python/tvm/script/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from tvm._ffi.base import TVMError
from tvm.ir import GlobalVar
from tvm.ir.function import BaseFunc
from tvm.tir import buffer
from tvm.tir.function import PrimFunc
from . import _ffi_api
from . import tir
Expand Down Expand Up @@ -448,9 +449,15 @@ def check_decorator(decorators: List[ast.Expr]) -> bool:
arg_var = tvm.te.var(arg.name, self.parse_type(arg.ty, arg))
# Note that this case is for T.match_buffer syntax sugar
if isinstance(arg.ty, (ast.TypeCall, ast.TypeApply)):
buf = self.transform(arg.ty)
self.context.func_buffer_map[arg_var] = buf
self.context.update_symbol(arg.name, buf, node)
result = self.transform(arg.ty)
if not isinstance(result, buffer.Buffer):
self.report_error(
f"The result type of evaluating TypeCall and TypeApply stmt is wrong: {type(result)}."
" It should be a Buffer",
node.span,
)
self.context.func_buffer_map[arg_var] = result
self.context.update_symbol(arg.name, result, node)
else:
self.context.update_symbol(arg.name, arg_var, node)
self.context.func_params.append(arg_var)
Expand Down

0 comments on commit 38d58cd

Please sign in to comment.