antinucleon opened a new pull request #7053:
URL: https://github.com/apache/tvm/pull/7053
This PR enables correctness check for a generated schedule.
It is useful for:
- Metal / ROCM: For some invalid schedule, driver may skip it instead of
return any errors (which will show as an impossble large FLOPS number)
- Sparse kernel search
Example 1: correctness check. This will generate random buffers for
correctness check
```
if train_flag:
#measure_ctx = auto_scheduler.LocalRPCMeasureContext(min_repeat_ms=300)
measure_runner = auto_scheduler.RPCRunner("m1", "127.0.0.1", 9190,
min_repeat_ms=300, timeout=30, repeat=3)
tune_option = auto_scheduler.TuningOptions(
num_measure_trials=1500,
check_correctness=True,
builder_n_parallel=1,
runner=measure_runner,
measure_callbacks=[auto_scheduler.RecordToFile(log_file)],
verbose=2,
)
sch, args = auto_scheduler.auto_schedule(task,
tuning_options=tune_option)
```
Example 2: Sparse tuning, this will register given buffers for measure.
```
if train_flag:
#measure_ctx = auto_scheduler.LocalRPCMeasureContext(min_repeat_ms=300)
measure_runner = auto_scheduler.RPCRunner("m1", "127.0.0.1", 9190,
min_repeat_ms=300, timeout=30, repeat=3)
tune_option = auto_scheduler.TuningOptions(
num_measure_trials=1500,
#runner=measure_ctx.runner,
check_correctness=False,
builder_n_parallel=1,
runner=measure_runner,
measure_callbacks=[auto_scheduler.RecordToFile(log_file)],
verbose=2,
)
for k, v in BUFFER.items():
tune_option.register_buffer(k, v)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]