[ansor] Does it reasonable to use the axis multiple times ?
- Dominant language
- Python
- Stars
- 13.7k
- Forks
- 4k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 111
Description
### Expected behavior
I expect each axis will be used only one time when it generate sketch design
### Actual behavior
I try to print the sketch design in function SketchPolicyNode::SearchOneRound, we can see some axises will be used multiple times, such as **i.0/j.0** in the following dump (tvm 0.19) ?

```
turning:
Placeholder: A, B, C
for i.0 (None)
for j.0 (None)
for i.0 (None)
for j.0 (None)
for i.1 (None)
for j.1 (None)
for k.0 (None)
for i.2 (None)
for j.2 (None)
for k.1 (None)
for i.3 (None)
for j.3 (None)
matmul = ...
for i.1 (None)
for j.1 (None)
out = ...
```
### Environment (172)
Any environment details, such as: Operating System, TVM version
```
(/py311-tts) root@998ee80b761b:/home/zhongyunde/source/test/ansor# python -c "import tvm; print(tvm.version)"
0.19.dev0
(/py311-tts) root@998ee80b761b:/home/zhongyunde/source/test/ansor# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
```
### Steps to reproduce
The script is get from https://tvm.hyper.ai/docs/tutorial/ops_AutoScheduling
then repeatedly run: python matmul_ansor.py
> (mlir_venv) (base) root@998ee80b761b: ansor# python matmul_ansor.py
[matmul_ansor.py.txt](https://github.com/user-attachments/files/19154408/matmul_ansor.py.txt)
### Triage
Please refer to the list of label tags [here](https://github.com/apache/tvm/wiki/Issue-Triage-Labels) to find the relevant tags and add them below in a bullet format (example below).
* needs-triage
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the matmul_ansor.py reproduction from the linked tutorial and inspect SketchPolicyNode::SearchOneRound, where the sketch dump is printed. Compare the repeated i.0/j.0 axes with the expected one-use-per-axis behavior and determine whether the dump is valid or indicates a bug. Done means providing a confirmed explanation or a narrowly identified correction path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100