You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "quic-sanirudh (via GitHub)" <gi...@apache.org> on 2023/04/04 16:05:57 UTC

[GitHub] [tvm] quic-sanirudh opened a new pull request, #14490: [TIR] [Schedule] Add get_output_blocks primitive

quic-sanirudh opened a new pull request, #14490:
URL: https://github.com/apache/tvm/pull/14490

   When scheduling fused ops, its really useful to be able to get all the output blocks and schedule other blocks in the fused op with respect to output blocks. This helps avoid hardcoding block names in manually written schedules in many cases


-- 
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] quic-sanirudh commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1496362120

   cc @Hzfengsy @junrushao @vinx13 


-- 
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] quic-sanirudh commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1497001617

   one more attempt to get cross-isa-minimal working
   @tvm-bot rerun


-- 
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] quic-sanirudh commented on a diff in pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on code in PR #14490:
URL: https://github.com/apache/tvm/pull/14490#discussion_r1158121564


##########
python/tvm/tir/schedule/schedule.py:
##########
@@ -540,6 +540,23 @@ def get_consumers(self, block: Union[BlockRV, str]) -> List[BlockRV]:
         block = self._normalize_block_arg(block)
         return list(_ffi_api.ScheduleGetConsumers(self, block))  # type: ignore # pylint: disable=no-member
 
+    @type_checked
+    def get_output_blocks(
+        self,
+        func_name: Optional[str] = None,
+    ) -> List[BlockRV]:
+        """Get the list of output blocks
+        An output block is a block which has atleast one buffer being written
+        to, but is not allocated within the PrimFunc
+
+        Returns
+        -------
+        output_blocks : List[BlockRV]
+            A list of all blocks that write to some output buffer
+
+        """
+        return list(_ffi_api.ScheduleGetOutputBlocks(self, func_name))  # type: ignore # pylint: disable=no-member

Review Comment:
   Thanks for the suggestion. I thought about that, but since the root block does not have to be passed in, I thought of not taking any arguments, but I guess I can modify it to take a block and return output blocks in the scope of that block.
   
   Do you think that makes more sense? We can then call it with the root block if we need all output blocks for the PrimFunc



-- 
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] quic-sanirudh commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1497002583

   @tvm-bot rerun


-- 
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] quic-sanirudh commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1497859473

   > @gigiblender The cross-isa-minimal test seems to get aborted (exit code 143 suggests that docker was killed by OS), but I don't see any failed tests. Could you please help me out with fixing this issue as I'm not aware of the CI and don't work on ARM.
   > 
   > I saw that you've added the CI, hence thought of asking your help.
   
   Looks like PR #14502 and #14504 are also failing with the same errors.
   
   https://ci.tlcpack.ai/blue/organizations/jenkins/tvm-minimal-cross-isa/detail/PR-14504/2/pipeline
   https://ci.tlcpack.ai/blue/organizations/jenkins/tvm-minimal-cross-isa/detail/PR-14502/3/pipeline


-- 
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] quic-sanirudh commented on a diff in pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on code in PR #14490:
URL: https://github.com/apache/tvm/pull/14490#discussion_r1158350363


##########
python/tvm/tir/schedule/schedule.py:
##########
@@ -540,6 +540,23 @@ def get_consumers(self, block: Union[BlockRV, str]) -> List[BlockRV]:
         block = self._normalize_block_arg(block)
         return list(_ffi_api.ScheduleGetConsumers(self, block))  # type: ignore # pylint: disable=no-member
 
+    @type_checked
+    def get_output_blocks(
+        self,
+        func_name: Optional[str] = None,
+    ) -> List[BlockRV]:
+        """Get the list of output blocks
+        An output block is a block which has atleast one buffer being written
+        to, but is not allocated within the PrimFunc
+
+        Returns
+        -------
+        output_blocks : List[BlockRV]
+            A list of all blocks that write to some output buffer
+
+        """
+        return list(_ffi_api.ScheduleGetOutputBlocks(self, func_name))  # type: ignore # pylint: disable=no-member

Review Comment:
   I've updated the PR with the changes. Please take a look now, thanks.



-- 
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] quic-sanirudh commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1496806037

   @tvm-bot rerun


-- 
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] kparzysz-quic merged pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "kparzysz-quic (via GitHub)" <gi...@apache.org>.
kparzysz-quic merged PR #14490:
URL: https://github.com/apache/tvm/pull/14490


-- 
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] Hzfengsy commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1497294396

   Thanks @quic-sanirudh for the continuously improvement. Let's merge it when the ci is green


-- 
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] quic-sanirudh commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1497690418

   @gigiblender The cross-isa-minimal test seems to get aborted (exit code 143 suggests that docker was killed by OS), but I don't see any failed tests. Could you please help me out with fixing this issue as I'm not aware of the CI and don't work on ARM.
   
   I saw that you've added the CI, hence thought of asking your help.


-- 
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] quic-sanirudh commented on a diff in pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on code in PR #14490:
URL: https://github.com/apache/tvm/pull/14490#discussion_r1158188742


##########
python/tvm/tir/schedule/schedule.py:
##########
@@ -540,6 +540,23 @@ def get_consumers(self, block: Union[BlockRV, str]) -> List[BlockRV]:
         block = self._normalize_block_arg(block)
         return list(_ffi_api.ScheduleGetConsumers(self, block))  # type: ignore # pylint: disable=no-member
 
+    @type_checked
+    def get_output_blocks(
+        self,
+        func_name: Optional[str] = None,
+    ) -> List[BlockRV]:
+        """Get the list of output blocks
+        An output block is a block which has atleast one buffer being written
+        to, but is not allocated within the PrimFunc
+
+        Returns
+        -------
+        output_blocks : List[BlockRV]
+            A list of all blocks that write to some output buffer
+
+        """
+        return list(_ffi_api.ScheduleGetOutputBlocks(self, func_name))  # type: ignore # pylint: disable=no-member

Review Comment:
   Sure, thanks. I'll update the PR to take a block and return output blocks in that scope.



-- 
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] quic-sanirudh commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "quic-sanirudh (via GitHub)" <gi...@apache.org>.
quic-sanirudh commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1498740087

   @tvm-bot rerun


-- 
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] Hzfengsy commented on a diff in pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on code in PR #14490:
URL: https://github.com/apache/tvm/pull/14490#discussion_r1158111988


##########
python/tvm/tir/schedule/schedule.py:
##########
@@ -540,6 +540,23 @@ def get_consumers(self, block: Union[BlockRV, str]) -> List[BlockRV]:
         block = self._normalize_block_arg(block)
         return list(_ffi_api.ScheduleGetConsumers(self, block))  # type: ignore # pylint: disable=no-member
 
+    @type_checked
+    def get_output_blocks(
+        self,
+        func_name: Optional[str] = None,
+    ) -> List[BlockRV]:
+        """Get the list of output blocks
+        An output block is a block which has atleast one buffer being written
+        to, but is not allocated within the PrimFunc
+
+        Returns
+        -------
+        output_blocks : List[BlockRV]
+            A list of all blocks that write to some output buffer
+
+        """
+        return list(_ffi_api.ScheduleGetOutputBlocks(self, func_name))  # type: ignore # pylint: disable=no-member

Review Comment:
   One thing a bit tricky is that the output block is based on the parent scope/block instead of PrimFunc. Would be great to use root block as input if you'd like to get the output blocks of the prim function



-- 
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] Hzfengsy commented on a diff in pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on code in PR #14490:
URL: https://github.com/apache/tvm/pull/14490#discussion_r1158133904


##########
python/tvm/tir/schedule/schedule.py:
##########
@@ -540,6 +540,23 @@ def get_consumers(self, block: Union[BlockRV, str]) -> List[BlockRV]:
         block = self._normalize_block_arg(block)
         return list(_ffi_api.ScheduleGetConsumers(self, block))  # type: ignore # pylint: disable=no-member
 
+    @type_checked
+    def get_output_blocks(
+        self,
+        func_name: Optional[str] = None,
+    ) -> List[BlockRV]:
+        """Get the list of output blocks
+        An output block is a block which has atleast one buffer being written
+        to, but is not allocated within the PrimFunc
+
+        Returns
+        -------
+        output_blocks : List[BlockRV]
+            A list of all blocks that write to some output buffer
+
+        """
+        return list(_ffi_api.ScheduleGetOutputBlocks(self, func_name))  # type: ignore # pylint: disable=no-member

Review Comment:
   Thanks for your update.
   Taking no arguments is a good choice for the root block. And also "take a block and return output blocks in the scope of that block." makes more sense to me. That helps if we have nested blocks.



-- 
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] tvm-bot commented on pull request #14490: [TIR] [Schedule] Add get_output_blocks primitive

Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14490:
URL: https://github.com/apache/tvm/pull/14490#issuecomment-1496238692

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * cc @Hzfengsy, @junrushao, @shingjan <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


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