diff --git a/python/tvm/topi/cuda/scatter.py b/python/tvm/topi/cuda/scatter.py index be602c8ab7a3..48da7e1cfd80 100644 --- a/python/tvm/topi/cuda/scatter.py +++ b/python/tvm/topi/cuda/scatter.py @@ -21,10 +21,7 @@ from ..scatter import _verify_scatter_nd_inputs from .nms import atomic_add from .sort import stable_sort_by_key_thrust, is_thrust_available - - -def ceil_div(a, b): - return (a + b - 1) // b +from ..utils import ceil_div def gen_ir_1d(data, indices, updates, axis, out, update_func): diff --git a/python/tvm/topi/cuda/sparse.py b/python/tvm/topi/cuda/sparse.py index c59e6887d47e..5cc4d284d565 100644 --- a/python/tvm/topi/cuda/sparse.py +++ b/python/tvm/topi/cuda/sparse.py @@ -23,7 +23,7 @@ from tvm import relay, te from .. import nn -from ..utils import traverse_inline +from ..utils import traverse_inline, ceil_div def sparse_dense(data, weight_data, weight_indices, weight_indptr): @@ -152,10 +152,6 @@ def sparse_dense_tir(data, w_data, w_indices, w_indptr): with either default_function_kernel0 for the transpose or default_function_kernel1 for the multiply. """ - - def ceil_div(a, b): - return (a + (b - 1)) // b - def gen_ir(data, w_data, w_indices, w_indptr, out): # pylint: disable=invalid-name # TODO(tkonolige): use tensorcores for block multiply diff --git a/python/tvm/topi/utils.py b/python/tvm/topi/utils.py index c3e14eff3919..769aa436fb08 100644 --- a/python/tvm/topi/utils.py +++ b/python/tvm/topi/utils.py @@ -487,3 +487,7 @@ def is_empty_shape(shape): Whether input shape is empty or has dimesion with size 0. """ return cpp.utils.is_empty_shape(shape) + + +def ceil_div(a, b): + return (a + b - 1) // b