Error message: The scope tir.Block#0 is not a stage pipeline.
Definition of a scope that is a stage pipeline:
- The region cover property holds for every of its child blocks
- No write-after-read dependency or opaque dependency,
- only read-after-write and write-after-write are allowed
- All the statements in the scope are schedulable statements, i.e. Block and For
I tried using tensor core to tune my resnet-18 model, and it reports this error.
Could you help to see what’s wrong?
Here is my code:
def compile_onnx(path, use_fp16 = False):
dev = tvm.device('cuda')
print(dev)
import pdb;pdb.set_trace()
onnx_model = onnx.load(path)
mod, params = relay.frontend.from_onnx(onnx_model)
target = tvm.target.Target('nvidia/nvidia-t4')
def convert_layout(mod):
seq = tvm.transform.Sequential(
[relay.transform.ConvertLayout({"nn.conv2d": ["NHWC", "OHWI"]})]
)
with tvm.transform.PassContext(opt_level=3):
mod = seq(mod)
return mod
if use_fp16:
mod = ToMixedPrecision('float16')(mod)
with tempfile.TemporaryDirectory() as work_dir:
with ms.Profiler() as profiler:
converted_mod = convert_layout(mod)
database = ms.relay_integration.tune_relay(
mod=converted_mod,
target=target,
work_dir=work_dir,
max_trials_global=3000,
params=params,
)
rt_mod1 = ms.relay_integration.compile_relay(
database=database,
mod=converted_mod,
target=target,
params=params,
)
print(profiler.table())