jroesch opened a new issue #7805:
URL: https://github.com/apache/tvm/issues/7805
Function parameters in TIR are incorrectly maintained when lowering. Even
though there is no reason these should be different we don't maintain the
variable identity between the function parameters, the buffer keys, buffer
values and function body.
```python
import tvm
output_shape = input_shape = (10, )
x = tvm.te.placeholder(input_shape, name="x")
y = tvm.te.placeholder(input_shape, name="y")
compute_output = tvm.te.compute(output_shape, lambda i: x[i] + y[i])
schedule = tvm.te.create_schedule([compute_output.op])
lowered = tvm.lower(schedule, [x, y, compute_output], simple_mode=False)
kernel = lowered["main"]
params = kernel.params
buffer_map_keys, buffer_map_values = zip(*kernel.buffer_map.items())
buffer_map_values = [buf.data for buf in buffer_map_values]
for p, k, v in zip(params, buffer_map_keys, buffer_map_values):
print(f"param_match_key {p.same_as(k)}")
print(f"value_match_key {k.same_as(v)}")
print(f"param_match_value {p.same_as(v)}")
print(f"param_match_key {params[0].same_as(buffer_map_keys[0])}")
print(f"value_match_key {buffer_map_keys[0].same_as(buffer_map_values[0])}")
print(f"param_match_value {params[0].same_as(buffer_map_values[0])}")
print(f"params match in body
{params[0].same_as(kernel.body.body.value.a.buffer_var)}")
print(f"key match in body
{buffer_map_keys[0].same_as(kernel.body.body.value.a.buffer_var)}")
print(f"value match in body
{buffer_map_values[0].same_as(kernel.body.body.value.a.buffer_var)}")
```
--
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]