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

[GitHub] [tvm] wrongtest-intellif opened a new pull request, #15665: [Arith] Fix detect non-divisible iteration form like (x % 255) // 16

wrongtest-intellif opened a new pull request, #15665:
URL: https://github.com/apache/tvm/pull/15665

   Previously, the optimization from `floordiv(floormod(..))` to `floormod(floordiv(..))` do not check the divisibility. Which may create wrong  iteration form. The change add a default handling and let it just fail in followup validity checks.
   
   For example, ` (x % 255) // 16` should not get transformed to `(x // 16) % 15`. The change make it as `(x % 255) // 16 % ceildiv(255, 16)`.
   
   It currently could not pass the surjective check though the mapping actually is surjective. We could improve it in the future.


-- 
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 #15665: [Arith] Fix detect non-divisible iteration form like (x % 255) // 16

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

   Thanks for the fix!


-- 
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 merged pull request #15665: [Arith] Fix detect non-divisible iteration form like (x % 255) // 16

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


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


Re: [PR] [Arith] Fix detect non-divisible iteration form like (x % 255) // 16 [tvm]

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

   @vinx13 I don't think that simplification would hold.  If I use `x==-16`, `(x % 255) // 16` evaluates to 14, while `(x // 16) % ceildiv(255, 16)` evaluates to 15.
   
   That said, if we know that `x` is on the range `0 <= x < 255`, such that `x % 255 == x`, then the simplification would be valid.


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


Re: [PR] [Arith] Fix detect non-divisible iteration form like (x % 255) // 16 [tvm]

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

   The simplification @Lunderberg mentioned should work. Actually we can get the extent from the source `IterMark` of the split.
   Say we want to compute `floordiv(lhs, rhs)` where `lhs == floormod(floordiv(x, c1), ext)`, `x == IterMark(extent=ext_x)`, and `ext % rhs != 0`.
   
   if we can prove `ext_x // c1 \in [0, ext)`, it can be simplified as `floordiv(lhs, rhs) == floordiv(x, c1 * rhs) == IterSplit(x, lower_factor=c1*rhs, extent=ceildiv(ext, rhs)`


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


Re: [PR] [Arith] Fix detect non-divisible iteration form like (x % 255) // 16 [tvm]

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

   do we need another `IterMark`? I think in this case we can rewrite to `(x // 16) % ceildiv(255, 16)`


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


Re: [PR] [Arith] Fix detect non-divisible iteration form like (x % 255) // 16 [tvm]

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

   This seems to cause a break in MLC LLM q3f16_1, which is a pretty commonly used format. @vinx13 mind sharing what a proper fix should look like?


-- 
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] wrongtest-intellif commented on pull request #15665: [Arith] Fix detect non-divisible iteration form like (x % 255) // 16

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

   Hi, could you kindly take a look at the change? Thank you!  cc @vinx13 @Lunderberg 


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