Skip to content

Commit

Permalink
update message
Browse files Browse the repository at this point in the history
  • Loading branch information
comaniac committed Jan 24, 2021
1 parent 0509e45 commit 04ceaaf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
4 changes: 1 addition & 3 deletions python/tvm/auto_scheduler/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,7 @@ def query(self, target, workload_key, has_complex_op, dag):
"-----------------------------------\n"
"Cannot find tuned schedules for target=%s, workload_key=%s. "
"A fallback TOPI schedule is used, "
"which may hurt performance or fail to compile. "
"If you've tuned this workload before, you may need to update workload_key "
"using the script in https://github.com/apache/tvm/pull/7317. "
"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:
Expand Down
29 changes: 29 additions & 0 deletions python/tvm/auto_scheduler/measure_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,35 @@ class RecordReader(Object):
"""

def __init__(self, filename):
# a set to prevent print duplicated message
self.messages = set()

self.__init_handle_by_constructor__(_ffi_api.RecordReader, filename)

def check_workload_key(self, inputs):
"""Check and throw warnings for records with old format workload key.
Parameters
----------
inputs: List[MeasureInput]
The measure inputs to be checked.
Notes
-----
This checker could be deprecated in the future.
"""
for inp in inputs:
_, args = decode_workload_key(inp.task.workload_key)
if not args:
msg = (
"MeasureInput with old format workload key %s should be updated "
"using the script from https://github.com/apache/tvm/pull/7317."
% inp.task.workload_key
)
if msg not in self.messages:
self.messages.add(msg)
logger.warning(msg)

def read_lines(self, max_lines=None, skip_lines=0):
"""Read multiple lines from the log file.
Expand Down Expand Up @@ -89,13 +116,15 @@ def read_lines(self, max_lines=None, skip_lines=0):
inputs, results = _ffi_api.RecordReaderReadLines(
self, max_lines if max_lines else -1, skip_lines
)
self.check_workload_key(inputs)
return inputs, results

def __iter__(self):
while True:
ret = _ffi_api.RecordReaderReadNext(self)
if not ret:
break
self.check_workload_key([ret[0]])
yield ret[0], ret[1] # (input, result)


Expand Down

0 comments on commit 04ceaaf

Please sign in to comment.