dprankratz opened a new pull request #5666:
URL: https://github.com/apache/incubator-tvm/pull/5666


   ## Build times
   
   I experienced hangs when attempting to build a compute statement that 
depended on deep TIR expressions involving the `tir.floormod` and 
`tir.floordiv` operaors. The build times can be reproduced  with the script 
[here](https://github.com/dpankratz/TVMFuzz/blob/master/bugs/floormod/measure_build_times.py).
 This is due to the very complicated TIR expression generated when FloorMod or 
FloorDiv are lowered. 
   
   I was able to improve upon this by changing how these operators were lowered 
to use the `tir.floor` intrinsic which also has the benefit of matching the 
[definitions of the 
operators](https://www.geeksforgeeks.org/math-floormod-method-in-java/). 
   
   ## Topi testcase
   
   There are existing tests for `tir.floormod` and `tir.floordiv` through the 
topi `test_topi_broadcast.py` file. However, I noticed that this files used 
`np.fmod` and `np.floor_divide` as points of reference which are not equivalent 
to `floormod` and `floordiv`.
   
   I fixed the testcase to use a correct version of `floormod` and `floordiv`. 


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to