Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix][ONNX] Skip constant If node generated by PyTorch #17383

Merged
merged 10 commits into from
Sep 22, 2024

Conversation

xhmelon
Copy link
Contributor

@xhmelon xhmelon commented Sep 18, 2024

This PR adds a check for If nodes for ONNX frontend of Relay to skip the broadcast if the predicate is constant.
Sometimes PyTorch to ONNX inserts silly if nodes that produce dynamic ranks, and ONNX frontend of TVM would broadcast the lower dimensions between branches, which is irrational for some cases, e.g. 5×5×3×4 to 5×5×3×4×1. The predicate of silly if might be constant and reasonable to skip to avoid the broadcast problem.
This issue was captured in #16898 and #17050.

xhmelon and others added 10 commits April 18, 2023 16:40
VTA FSIM could not be built on macOS, for it leverages malloc.h and
memalign, yet both have been deprecated and are not provided by
macOS. This issue was captured in apache#13173.

This commit stops including malloc.h in VTA Runtime as stdlib.h has
provided functions we need.

This commit uses posix_memalign instead of memalign. It is a portable standard function.
This commit adds a check for If nodes for ONNX frontend of Relay
to skip the broadcast if the predicate is constant.
Sometimes PyTorch to ONNX inserts silly if nodes that produce dynamic
ranks, and ONNX frontend of TVM would broadcast the lower dimensions
between branches, which is irrational for some cases, e.g. 5×5×3×4 to
5×5×3×4×1. The predicate of silly if might be constant and reasonable
to skip to avoid the broadcast problem.
This issue was captured in apache#16898.
@shaoyuyoung
Copy link

cc @Hzfengsy

@Hzfengsy
Copy link
Member

Thanks @xhmelon for the contribution. As we are moving towards the Unity strategy with Relax, we may deprecate Relay in the future (ref). We encourage the community to move to Relax stack.

Meanwhile, this PR is self-contained, we can get this in

@Hzfengsy Hzfengsy merged commit 72d542e into apache:main Sep 22, 2024
19 of 20 checks passed
@xhmelon xhmelon deleted the fix-onnx-if branch September 23, 2024 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants