Lunderberg commented on code in PR #12266:
URL: https://github.com/apache/tvm/pull/12266#discussion_r935648157
##########
src/tir/op/builtin.cc:
##########
@@ -288,6 +288,10 @@ TIR_DEFINE_BUILTIN_FUNC(texture2d_load)
TIR_DEFINE_BUILTIN_FUNC(mem_copy).set_attr<TCallEffectKind>("TCallEffectKind",
Integer(CallEffectKind::kOpaque));
+TIR_DEFINE_BUILTIN_FUNC(undef)
+ .set_attr<TCallEffectKind>("TCallEffectKind",
Integer(CallEffectKind::kReadState))
Review Comment:
Primarily to avoid simplifications that rely on a pure function returning a
consistent value for consistent inputs. Since `undef` takes no arguments, this
would imply that the return value of `undef` is always identical, which could
result in incorrect simplifications. For example, inlining of a let binding is
valid if the bound value is `kPure`, but requires additional checks if the
bound value is `kReadState`.
I had picked `kReadState` as analogous to a hypothetical
`builtin::system_clock_time`, which takes no arguments, but reads from a hidden
state and may return a different value for each call.
--
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]