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

[AutoScheduler] Improve warning messages #6935

Merged
merged 2 commits into from
Nov 18, 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
7 changes: 4 additions & 3 deletions python/tvm/auto_scheduler/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,11 @@ def query(self, target, workload_key, has_complex_op, dag):

if self.verbose == 2 or (has_complex_op and self.verbose == 1):
msg = (
"Cannot find tuned schedules for target=%s, workload_key=%s, compute:\n%s"
"-----------------------------------\n"
"Cannot find tuned schedules for target=%s, workload_key=%s. "
"A fallback TOPI schedule is used, "
"which may bring great performance regression or even compilation failure."
% (target, workload_key, dag)
"which may bring great performance regression or even compilation failure. "
"Compute DAG info:\n%s" % (target, workload_key, dag)
)
if msg not in self.messages:
self.messages.add(msg)
Expand Down
15 changes: 13 additions & 2 deletions python/tvm/relay/op/strategy/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ def schedule_lrn_cuda(attrs, outs, target):
return topi.cuda.schedule_lrn(outs)


def naive_schedule(_, outs, target):
"""Return the naive default schedule"""
if "gpu" in target.keys:
# For GPU, we at least need thread binding to make a valid schedule.
# So the naive schedule cannot be compiled.
raise RuntimeError(
"Cannot compile for GPU targets if no tuned schedule is found. Please see the warning messages above for more information about the failed workloads."
)
return tvm.te.create_schedule(outs[-1].op)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we need to add a comment saying that it would be a problem for the DAG with multiple outputs.



@conv2d_strategy.register(["cuda", "gpu"])
def conv2d_strategy_cuda(attrs, inputs, out_type, target):
"""conv2d cuda strategy"""
Expand Down Expand Up @@ -224,7 +235,7 @@ def conv2d_strategy_cuda(attrs, inputs, out_type, target):
if use_auto_scheduler and judge_winograd_auto_scheduler:
strategy.add_implementation(
wrap_compute_conv2d(topi.nn.conv2d_winograd_nhwc),
wrap_topi_schedule(tvm.te.create_schedule),
naive_schedule, # this implementation should never be picked by autotvm
Comment on lines -227 to +239
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tvm.te.create_schedule is not a valid topi schedule. Their signatures are different. So I created a new one.

name="conv2d_nhwc.winograd",
plevel=15,
)
Expand Down Expand Up @@ -451,7 +462,7 @@ def conv2d_winograd_without_weight_transfrom_strategy_cuda(attrs, inputs, out_ty
if PassContext.current().config.get("relay.backend.use_auto_scheduler", False):
strategy.add_implementation(
wrap_compute_conv2d(topi.nn.conv2d_winograd_nhwc_without_weight_transform),
wrap_topi_schedule(tvm.te.create_schedule),
naive_schedule, # this implementation should never be picked by autotvm
name="conv2d_nhwc_winograd_without_weight_transform",
plevel=15,
)
Expand Down