slyubomirsky commented on code in PR #101:
URL: https://github.com/apache/tvm-rfcs/pull/101#discussion_r1439907511


##########
rfcs/assets/0101/spec.md:
##########
@@ -522,7 +528,7 @@ Unlike `PrimExprs`, statements do not return values. 
Instead, they operate by mo
             * If `t->strides` is not null, then `len(t->strides)` must match 
`len(b->strides)` or else an error is raised. For all `i` from 0 to 
`len(b->strides) - 1`, `b->strides[i]` must be an `IntImm` whose value matches 
`t->strides[i]` (or else an error is raised), an already bound `Var` whose 
bound value is `t->strides[i]` (or else an error is raised), or an unbound 
`Var` (in which case, it is bound with the value `t->strides[i]`). 
             * `len(t->shape)` and `len(b->shape)` must match or else an error 
is raised. For all `i` from 0 to `len(b->shape) - 1`, `b->shape[i]` must be an 
`IntImm` whose value matches `t->shape[i]` (or else an error is raised), an 
already bound `Var` whose bound value is `t->shape[i]` (or else an error is 
raised), or an unbound `Var` (in which case, it is bound with the value 
`t->shape[i]`). 
         5. One further condition that `PrimFunc`s expect of their `DLTensor` 
arguments: No two `DLTensor` arguments are permitted to alias each other. 
-        6. Next, `body` is executed. The `PrimFunc` produces outputs by 
mutating values in buffers passed as the inputs; these changes can be observed 
by the caller via the `DLTensor` representations passed in step i.
+        6. Next, `body` is executed. The `PrimFunc` produces outputs by 
mutating values in buffers passed as the inputs; these changes can be observed 
by the caller via the `DLTensor` representations passed in step i. If a 
`tir.ret` builtin was executed, the `PrimFunc` returns the value that was 
passed to `tir.ret`; otherwise, the `PrimFunc` returns a void value. Upon 
returning (whether after encountering a call to `tir.ret` or the end of 
`body`), the current scope is popped and all values allocated within the 
`PrimFunc` are freed.

Review Comment:
   Since you don't think it's the intended behavior, I think we should call 
that a bug then. Happy to hear others' thoughts.
   
   edit: Alternatively, this can be a case of builtins not following the rules 
of the rest of the language. I can add a clause pointing to the existence of 
such complexities.



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

Reply via email to