You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/08/02 14:12:28 UTC

[GitHub] [tvm] Lunderberg commented on a diff in pull request #12266: [TIR] Add tir::builtin::undef

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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org