Lunderberg commented on code in PR #11097:
URL: https://github.com/apache/tvm/pull/11097#discussion_r856517028
##########
python/tvm/script/context_maintainer.py:
##########
@@ -233,7 +240,7 @@ def lookup_symbol(self, name: str) ->
Optional[Union[Buffer, Var]]:
for symbols in reversed(self.symbols):
if name in symbols:
return symbols[name]
- return None
+ return self.closure_vars.get(name)
Review Comment:
I'm running into some errors when a closure variable isn't already a
`PrimExpr`. In the example below, this will cause an error message saying that
it cannot add together a `PrimExpr` and an int.
```python
offset = 1
@T.prim_func
def func(A: T.Buffer[(1,), "int32"], B: T.Buffer[(1,), "int32"]):
B[0] = A[0] + offset
```
Whenever we pull a variable out of the closure, can we run it through
`tvm.runtime.convert`? That way, any expression type supported by the FFI
would be converted to a TIR-supported format.
```python
if name in self.closure_vars:
return tvm.runtime.convert(self.closure_vars[name])
```
--
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]