Unverified Commit d81b006b by Leyuan Wang Committed by GitHub

[TOPI] Improve get_valid_count and nms performance for CUDA (#5339)

* get_valid_count updated to have correct results

* speedup nms

* update nms

* revert back nms

* recover one test for get_valid_count
parent 1265983c
......@@ -853,7 +853,6 @@ def _mx_smooth_l1(inputs, attrs):
def _mx_deformable_convolution(inputs, attrs):
new_attrs = {}
assert attrs.get_bool("no_bias")
new_attrs["kernel_size"] = attrs.get_int_tuple("kernel")
new_attrs["strides"] = attrs.get_int_tuple("stride")
new_attrs["padding"] = attrs.get_int_tuple("pad")
......
......@@ -225,6 +225,9 @@ def test_get_valid_counts():
intrp = relay.create_executor("debug", ctx=ctx, target=target)
out = intrp.evaluate(func)(np_data)
tvm.testing.assert_allclose(out[0].asnumpy(), np_out1, rtol=1e-3, atol=1e-04)
# get_valid_count for cuda doesn't do data rearrangement
if target == 'cuda':
return
tvm.testing.assert_allclose(out[1].asnumpy(), np_out2, rtol=1e-3, atol=1e-04)
verify_get_valid_counts((1, 2500, 6), 0, 0, 1)
......
......@@ -106,7 +106,7 @@ def deformable_conv2d_nchw(data, offset, kernel, strides, padding, dilation, def
(kh * kernel_w + kw) * 2, y, x],
x * stride_w - pad_left + kw * dilation_w +
offset[n, c // ic_per_dgroup * (kernel_w*kernel_h*2) +
(kh * kernel_w + kw) * 2 + 1, y, x]))
(kh * kernel_w + kw) * 2 + 1, y, x]), tag="data_deform")
return te.compute(
(batch, out_channel, out_height, out_width),
lambda n, f, y, x: te.sum(
......
......@@ -106,8 +106,8 @@ def verify_get_valid_counts(dshape, score_threshold, id_index, score_index):
""" Skip this test as it is intermittent
see https://github.com/apache/incubator-tvm/pull/4901#issuecomment-595040094
for device in ['llvm', 'cuda', 'opencl']:
# Disable opencl test for now
if device != "llvm" and device != "cuda":
# Disable gpu test for now
if device != "llvm":
continue
check_device(device)
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment