nautasolva commented on issue #15505:
URL: https://github.com/apache/tvm/issues/15505#issuecomment-1689626089
I managed to reproduce this issue:
```python
import tempfile
import tvm
import tvm.relay as relay
# cin = 17 = 16 + 1, so padding is necessary for fitting in a WMMA fragment
# bug is not present when cin = 16
cin, cout = 17, 16
h, w = 1, 1
inp = relay.var("input", shape=(1, cin, h, w), dtype="float16")
w = relay.var("weight", shape=(cout, cin, 1, 1), dtype="float16")
b = relay.var("bias", shape=(cout,), dtype="float16")
out = relay.nn.bias_add(relay.nn.conv2d(inp, w), b)
mod = tvm.IRModule.from_expr(out)
import tvm.meta_schedule
target = tvm.target.Target({
"kind": "cuda",
"arch": "sm_80",
"max_threads_per_block": 1024,
"max_shared_memory_per_block": 49152,
})
with tempfile.TemporaryDirectory() as tuning_dir:
tasks =
tvm.meta_schedule.relay_integration.tune_relay(tvm.IRModule.from_expr(out),
params={}, target=target, work_dir=tuning_dir, max_trials_global=32)
```
The error is triggered when the MultiLevelTilingTensorCore rule tries to
[inline a block
](https://github.com/apache/tvm/blob/d0c94d447ba438966c09a70a454f3ecf22fa5f55/src/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc#L569)that
was previously inlined (hence does not exist anymore). For example, when
trying to add padding so that we can fit a WMMA fragment, we [inline consumers
of the newly created padding
blocks](https://github.com/apache/tvm/blob/d0c94d447ba438966c09a70a454f3ecf22fa5f55/src/tir/schedule/transform.cc#L328C36-L328C36),
effectively consuming the block.
The solution I found was to [guard the inlining
operation](https://github.com/nautasolva/tvm/commit/4e0191e3e303daa62edb8050df444d6b99df1048).
Please let met know if this fix is acceptable, I can submit a pull request.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]