mlc-ai / relax

Apache License 2.0
140 stars 70 forks source link

[Unity] Fix LazyTransformParams use-def analysis and binding emission #235

Closed MasterJH5574 closed 1 year ago

MasterJH5574 commented 1 year ago

Previously the pass LazyTransformParams did not take the case where an output variable is used by other bindings inside the function. It generates wrong Relax function in this case.

This PR fixes this issue. The new test case is an example to elaborate the issue. This PR introduces a sanity assertion check to ensure we handle the case properly.

This PR also enhances variable naming. For binding variables of set_item and kill_object, we now use an underscore ("_") as its name, compared with the previous lv name.

Kathryn-cat commented 1 year ago

LGTM! thanks for the fix!!