You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Lunderberg (via GitHub)" <gi...@apache.org> on 2023/09/14 22:02:17 UTC

[GitHub] [tvm] Lunderberg commented on a diff in pull request #15697: [Unity] Mark result of LazyTransformParams as impure function

Lunderberg commented on code in PR #15697:
URL: https://github.com/apache/tvm/pull/15697#discussion_r1326559355


##########
tests/python/relax/test_transform_lazy_transform_params.py:
##########
@@ -137,10 +136,8 @@ def slice_buffer(
 
     @I.ir_module
     class Expected:
-        @R.function
+        @R.function(pure=False)
         def main_transform_params(slice_shape_expr: R.Shape(["slice_index"])):
-            # we expect ToNonDataflow and RemovePurityTracking to be invoked first

Review Comment:
   Currently, it isn't present in the lowering flow, and is explicitly called by an end-user.  (Based on grep for `"LazyTransformParams"` across the TVM repo.)  While the comment suggests that it was intended to be used in a later stage, so far this seems like just an extra requirement for an end-user to perform, before calling a function intended for an end-user's convenience (e.g. [here](https://github.com/mlc-ai/mlc-llm/blob/main/mlc_llm/utils.py#L219)).  By outputting the correct purity annotations, we avoid this requirement.
   
   That said, looking at it again, for correctness, any `DataflowBlock` in which the mutation occurs should be broken apart into a regular `BindingBlock`.



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