Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TOPI] Fix CUDA Library Tuning #6132

Merged
merged 3 commits into from
Jul 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python/tvm/autotvm/task/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,11 @@ def add_flop(self, flop):

Parameters
---------
flop: int or float
flop: int or float or IntImm or FloatImm
number of float operations
"""
if not isinstance(flop, (int, float)):
flop = flop.value
self.flop += flop

def raise_error(self, msg):
Expand Down
7 changes: 6 additions & 1 deletion topi/python/topi/cuda/conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""Compute definition for conv2d with cuda backend"""
from tvm import te
from tvm import autotvm
from tvm.autotvm.task.space import OtherOptionEntity
from tvm.contrib import cudnn

from .. import nn, generic
Expand Down Expand Up @@ -99,14 +100,18 @@ def conv2d_cudnn(cfg, data, kernel, strides, padding, dilation, groups=1,
else:
dtype = data.dtype

cfg.define_knob('algo', range(8))
if cfg.is_fallback: # Let CUDNN choose the best algo
cfg['algo'] = OtherOptionEntity(-1)

return cudnn.conv_forward(data,
kernel,
[pt, pl], # cudnn padding pt, pl on both sides of input
[stride_h, stride_w],
[dilation_h, dilation_w],
conv_mode=1,
tensor_format=tensor_format,
algo=-1, # let CUDNN choose the best algo
algo=cfg['algo'],
conv_dtype=dtype,
groups=groups)

Expand Down