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

Limit use of the indexing war for resize #3515

Merged
merged 4 commits into from
Dec 4, 2024
Merged

Limit use of the indexing war for resize #3515

merged 4 commits into from
Dec 4, 2024

Conversation

naoyam
Copy link
Collaborator

@naoyam naoyam commented Dec 3, 2024

Fixes this error of #3505

Error from segmentation group 9:  INTERNAL ASSERT FAILED at "/Fuser/csrc/id_model/indexing_traversal.cpp":102, please report a bug with repro script to NVFuser at https://github.com/NVIDIA/Fuser/issues. Indexing path for resize not found: iblockIdx.y376{( ceilDiv(1280, blockDim.x) )}

The error happens when trying to use the indexing WAR for resize that was recently added (#3454). The war itself is limited, in particular it does not work with promoted loop IDs. The limitation should be fine for the RoPE scheduling I've been working on, but it's a real issue in general.

This PR avoids the issue by limiting the use of the WAR. Currently, the WAR is used whenever there's at least a single resize expr in a single math expr. That is actually overly pessimistic since the indexing issue only happens when there's multiple resize exprs that result in a cycle in the exact graph. For example, if there's only one resize, there must be no cycle, thus the indexing WAR is not necessary.

This PR attempts to limit the use of the WAR by doing a little deeper analysis. The added check should entirely disable the WAR for the current default scheduling, where resize is only allowed with fusion inputs, which means there can be no multiple dependent resize exprs in a single fusion.

The limitation of the WAR remains, but it does not matter for RoPE, and with this PR it should also not matter for general cases.

@naoyam
Copy link
Collaborator Author

naoyam commented Dec 3, 2024

!test

@naoyam naoyam marked this pull request as ready for review December 3, 2024 08:18
@naoyam
Copy link
Collaborator Author

naoyam commented Dec 3, 2024

!test

@naoyam
Copy link
Collaborator Author

naoyam commented Dec 3, 2024

H100 manually checked

@naoyam naoyam requested a review from jacobhinkle December 3, 2024 08:19
// used rather than the local model. Here, since we just need to
// know if there are multiple dependent resize exprs, and loop
// promotion should not further add resize exprs, it is sufficient
// to analyze only the IDs of this expr only.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// to analyze only the IDs of this expr only.
// to analyze only the IDs of this expr.

csrc/id_model/indexing_traversal.cpp Show resolved Hide resolved
@naoyam
Copy link
Collaborator Author

naoyam commented Dec 3, 2024

!build

@naoyam naoyam merged commit 67127c9 into main Dec 4, 2024
17 checks passed
@naoyam naoyam deleted the resize_war_fix branch December 4, 2024 01:59
naoyam added a commit that referenced this pull request Dec 9, 2024
This is a second attempt to fix #3505. The first attempt is #3515. As
mentioned
[here](#3505 (comment)),
the first fix isn't sufficient when an expr has multiple resized inputs,
like concat. The actual condition we need to check is between each
producer and consumer pair, not between producers, so this second
attempt is just changing how we check the condition.
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.

2 participants