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/16 20:54:53 UTC

[GitHub] [tvm] AndrewZhaoLuo opened a new pull request, #12463: [Metascheduler] Handle deserializing empty string RVs in trace

AndrewZhaoLuo opened a new pull request, #12463:
URL: https://github.com/apache/tvm/pull/12463

   It seems sometimes we can have random variables with names such as "" (this is not the empty string, but two quotation marks). 
   
   I believe this is suppose to hit "Case 2" in `TranslateInputRVs`. 
   
   Unsure if having an RV as "" may be problematic.


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


[GitHub] [tvm] AndrewZhaoLuo commented on a diff in pull request #12463: [MetaSchedule] Handle deserializing empty string RVs in trace

Posted by GitBox <gi...@apache.org>.
AndrewZhaoLuo commented on code in PR #12463:
URL: https://github.com/apache/tvm/pull/12463#discussion_r948486359


##########
tests/python/unittest/test_tir_schedule_trace.py:
##########
@@ -275,5 +284,39 @@ def test_apply_json_to_schedule_1():
     tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
 
 
+def _test_apply_annotation_trace_from_json(annotation: str):
+    """Test applying an annotation works without crashing.
+
+    Designed to handle some previously failing edge cases like the
+    empty string.
+    """
+    b0 = BlockRV()
+    trace = Trace(
+        insts=[
+            _make_get_block(name="B", output=b0),
+            _make_annotate(block=b0, annotation=annotation),
+        ],
+        decisions={},
+    )
+    json_obj = trace.as_json()
+    sch = tir.Schedule(elementwise, debug_mask="all")
+    Trace.apply_json_to_schedule(json_obj, sch)
+    tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])

Review Comment:
   I just want to test annotation which had the bug. I've changed this to compare against the proper mod.



##########
tests/python/unittest/test_tir_schedule_trace.py:
##########
@@ -275,5 +284,39 @@ def test_apply_json_to_schedule_1():
     tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
 
 
+def _test_apply_annotation_trace_from_json(annotation: str):
+    """Test applying an annotation works without crashing.
+
+    Designed to handle some previously failing edge cases like the
+    empty string.
+    """
+    b0 = BlockRV()
+    trace = Trace(
+        insts=[
+            _make_get_block(name="B", output=b0),
+            _make_annotate(block=b0, annotation=annotation),
+        ],
+        decisions={},
+    )
+    json_obj = trace.as_json()
+    sch = tir.Schedule(elementwise, debug_mask="all")
+    Trace.apply_json_to_schedule(json_obj, sch)
+    tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
+
+
+def test_apply_annotation_from_json():
+    # Something reasonable
+    _test_apply_annotation_trace_from_json("SSRSSR")
+
+    # The empty string
+    _test_apply_annotation_trace_from_json("")
+
+    # A string of two quotation marks
+    _test_apply_annotation_trace_from_json('""')

Review Comment:
   This is for completeness



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


[GitHub] [tvm] zxybazh commented on a diff in pull request #12463: [MetaSchedule] Handle deserializing empty string RVs in trace

Posted by GitBox <gi...@apache.org>.
zxybazh commented on code in PR #12463:
URL: https://github.com/apache/tvm/pull/12463#discussion_r947337243


##########
tests/python/unittest/test_tir_schedule_trace.py:
##########
@@ -275,5 +284,39 @@ def test_apply_json_to_schedule_1():
     tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
 
 
+def _test_apply_annotation_trace_from_json(annotation: str):
+    """Test applying an annotation works without crashing.
+
+    Designed to handle some previously failing edge cases like the
+    empty string.
+    """
+    b0 = BlockRV()
+    trace = Trace(
+        insts=[
+            _make_get_block(name="B", output=b0),
+            _make_annotate(block=b0, annotation=annotation),
+        ],
+        decisions={},
+    )
+    json_obj = trace.as_json()
+    sch = tir.Schedule(elementwise, debug_mask="all")
+    Trace.apply_json_to_schedule(json_obj, sch)
+    tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])

Review Comment:
   I think you may want to annotate the string, unanotate it and then compare with `elementwise` workload here.



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


[GitHub] [tvm] zxybazh commented on a diff in pull request #12463: [MetaSchedule] Handle deserializing empty string RVs in trace

Posted by GitBox <gi...@apache.org>.
zxybazh commented on code in PR #12463:
URL: https://github.com/apache/tvm/pull/12463#discussion_r947337526


##########
tests/python/unittest/test_tir_schedule_trace.py:
##########
@@ -275,5 +284,39 @@ def test_apply_json_to_schedule_1():
     tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
 
 
+def _test_apply_annotation_trace_from_json(annotation: str):
+    """Test applying an annotation works without crashing.
+
+    Designed to handle some previously failing edge cases like the
+    empty string.
+    """
+    b0 = BlockRV()
+    trace = Trace(
+        insts=[
+            _make_get_block(name="B", output=b0),
+            _make_annotate(block=b0, annotation=annotation),
+        ],
+        decisions={},
+    )
+    json_obj = trace.as_json()
+    sch = tir.Schedule(elementwise, debug_mask="all")
+    Trace.apply_json_to_schedule(json_obj, sch)
+    tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
+
+
+def test_apply_annotation_from_json():
+    # Something reasonable
+    _test_apply_annotation_trace_from_json("SSRSSR")
+
+    # The empty string
+    _test_apply_annotation_trace_from_json("")
+
+    # A string of two quotation marks
+    _test_apply_annotation_trace_from_json('""')

Review Comment:
   This following 2 tests seems unnecessary because it should be alreadty supported.



##########
tests/python/unittest/test_tir_schedule_trace.py:
##########
@@ -275,5 +284,39 @@ def test_apply_json_to_schedule_1():
     tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
 
 
+def _test_apply_annotation_trace_from_json(annotation: str):
+    """Test applying an annotation works without crashing.
+
+    Designed to handle some previously failing edge cases like the
+    empty string.
+    """
+    b0 = BlockRV()
+    trace = Trace(
+        insts=[
+            _make_get_block(name="B", output=b0),
+            _make_annotate(block=b0, annotation=annotation),
+        ],
+        decisions={},
+    )
+    json_obj = trace.as_json()
+    sch = tir.Schedule(elementwise, debug_mask="all")
+    Trace.apply_json_to_schedule(json_obj, sch)
+    tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])

Review Comment:
   I think you may want to annotate, unanotate and then compare with `elementwise` here.



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


[GitHub] [tvm] AndrewZhaoLuo commented on pull request #12463: [MetaSchedule] Handle deserializing empty string RVs in trace

Posted by GitBox <gi...@apache.org>.
AndrewZhaoLuo commented on PR #12463:
URL: https://github.com/apache/tvm/pull/12463#issuecomment-1218553224

   Oops, I made a branch in main repo on accident. Please go to https://github.com/apache/tvm/pull/12481


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


[GitHub] [tvm] AndrewZhaoLuo closed pull request #12463: [MetaSchedule] Handle deserializing empty string RVs in trace

Posted by GitBox <gi...@apache.org>.
AndrewZhaoLuo closed pull request #12463: [MetaSchedule] Handle deserializing empty string RVs in trace
URL: https://github.com/apache/tvm/pull/12463


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


[GitHub] [tvm] zxybazh commented on a diff in pull request #12463: [MetaSchedule] Handle deserializing empty string RVs in trace

Posted by GitBox <gi...@apache.org>.
zxybazh commented on code in PR #12463:
URL: https://github.com/apache/tvm/pull/12463#discussion_r947337526


##########
tests/python/unittest/test_tir_schedule_trace.py:
##########
@@ -275,5 +284,39 @@ def test_apply_json_to_schedule_1():
     tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
 
 
+def _test_apply_annotation_trace_from_json(annotation: str):
+    """Test applying an annotation works without crashing.
+
+    Designed to handle some previously failing edge cases like the
+    empty string.
+    """
+    b0 = BlockRV()
+    trace = Trace(
+        insts=[
+            _make_get_block(name="B", output=b0),
+            _make_annotate(block=b0, annotation=annotation),
+        ],
+        decisions={},
+    )
+    json_obj = trace.as_json()
+    sch = tir.Schedule(elementwise, debug_mask="all")
+    Trace.apply_json_to_schedule(json_obj, sch)
+    tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
+
+
+def test_apply_annotation_from_json():
+    # Something reasonable
+    _test_apply_annotation_trace_from_json("SSRSSR")
+
+    # The empty string
+    _test_apply_annotation_trace_from_json("")
+
+    # A string of two quotation marks
+    _test_apply_annotation_trace_from_json('""')

Review Comment:
   This following 2 tests seems unnecessary because they should already be supported.



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


[GitHub] [tvm] AndrewZhaoLuo commented on a diff in pull request #12463: [MetaSchedule] Handle deserializing empty string RVs in trace

Posted by GitBox <gi...@apache.org>.
AndrewZhaoLuo commented on code in PR #12463:
URL: https://github.com/apache/tvm/pull/12463#discussion_r948486545


##########
tests/python/unittest/test_tir_schedule_trace.py:
##########
@@ -275,5 +284,39 @@ def test_apply_json_to_schedule_1():
     tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
 
 
+def _test_apply_annotation_trace_from_json(annotation: str):
+    """Test applying an annotation works without crashing.
+
+    Designed to handle some previously failing edge cases like the
+    empty string.
+    """
+    b0 = BlockRV()
+    trace = Trace(
+        insts=[
+            _make_get_block(name="B", output=b0),
+            _make_annotate(block=b0, annotation=annotation),
+        ],
+        decisions={},
+    )
+    json_obj = trace.as_json()
+    sch = tir.Schedule(elementwise, debug_mask="all")
+    Trace.apply_json_to_schedule(json_obj, sch)
+    tvm.ir.assert_structural_equal(elementwise_inlined, sch.mod["main"])
+
+
+def test_apply_annotation_from_json():
+    # Something reasonable
+    _test_apply_annotation_trace_from_json("SSRSSR")
+
+    # The empty string
+    _test_apply_annotation_trace_from_json("")
+
+    # A string of two quotation marks
+    _test_apply_annotation_trace_from_json('""')

Review Comment:
   This is for completeness of the unittest



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