Lunderberg commented on PR #16562: URL: https://github.com/apache/tvm/pull/16562#issuecomment-1955842490
> I'm surprised that the previous logic failed. Yeah, I was pretty surprised at it, too. I think the core issue is the mismatch between the internal representation of a `relax::If` node and the python-ish TVMScript that represents it. In order to bridge that mismatch, something needs to either be duplicated, or hoisted outside the `relax::If`, and that hoisting is where the error crept in. (Because it introduces a new scope, I think the body of a `relax::If` is closer to a new python function than to a python if/else block. Hypothetically, we could represent it with a new function in TVMScript, but that representation would be ambiguous with a local `relax::Function` definition.) I suspect there's some similar edge cases that could be hunted down within a similar space. For example, a `relax::MatchCast` whose bound value is `relax::If`, or a `relax::If` whose output value is not the last binding of the branch. I suspect that those cases would most the `relax::MatchCast` inside the `relax::If`, or introduce a trivial binding, but I haven't tested it. At least, those differences should be semantically equivalent, even if they have slightly different IR representations. -- 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]
