Skip to content

Commit

Permalink
add warning
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Feb 22, 2021
1 parent 720d0ee commit f688f64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions python/tvm/contrib/thrust.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@
# specific language governing permissions and limitations
# under the License.
"""Utilities for thrust"""
import logging

from tvm._ffi import get_global_func


def maybe_warn(target, func_name):
if get_global_func(func_name, allow_missing=True) and not "thrust" in target.libs:
logging.warning("TVM is built with thrust but thrust is not used.")
if "thrust" in target.libs and get_global_func(func_name, allow_missing=True) is None:
logging.warning("thrust is requested but TVM is not built with thrust.")


def can_use_thrust(target, func_name):
maybe_warn(target, func_name)
return (
target.kind.name in ["cuda", "nvptx"]
and "thrust" in target.libs
Expand All @@ -27,6 +37,7 @@ def can_use_thrust(target, func_name):


def can_use_rocthrust(target, func_name):
maybe_warn(target, func_name)
return (
target.kind.name == "rocm"
and "thrust" in target.libs
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/relay/op/strategy/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def dense_strategy_cuda(attrs, inputs, out_type, target):
name="dense_tensorcore.cuda",
plevel=20,
)
if target.kind.name in ["cuda", "nvptx"] and "cublas" in target.libs:
if target.kind.name in ["cuda", "nvptx"] and "cublas" in target.libs:
strategy.add_implementation(
wrap_compute_dense(topi.cuda.dense_cublas),
wrap_topi_schedule(topi.cuda.schedule_dense_cublas),
Expand Down

0 comments on commit f688f64

Please sign in to comment.