Skip to content

Commit

Permalink
move ceil_div to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Dec 24, 2020
1 parent a9a57e3 commit b7f4ef7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 1 addition & 4 deletions python/tvm/topi/cuda/scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 1 addition & 5 deletions python/tvm/topi/cuda/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions python/tvm/topi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b7f4ef7

Please sign in to comment.