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

Make sure the inputs are deleted in reversed order #1694

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zcbenz
Copy link
Contributor

@zcbenz zcbenz commented Dec 12, 2024

Refs #1513.

The old code relied on a behavior that elements inserted to unordered_map are iterated in reversed order, which is however not the case with MSVC.

I don't know if it is intentional that the inputs must be destroyed in reversed order, but without doing so would result in crashes when running autograd tests.

@awni
Copy link
Member

awni commented Dec 12, 2024

I don't know if it is intentional that the inputs must be destroyed in reversed order, but without doing so would result in crashes when running autograd tests.

What kind of crash? It's not clear to me why those need to be done in reverse order .. maybe it's correct, not sure.

@zcbenz
Copy link
Contributor Author

zcbenz commented Dec 12, 2024

If you checkout the branch and change the code:

     // The inputs are destroyed in reversed order.
-    for (auto a = input_arrs.rbegin(); a != input_arrs.rend(); ++a) {
+    for (auto a = input_arrs.begin(); a != input_arrs.end(); ++a) {

run the cpp test you can reproduce the crash (or assertion more accurately).

My observation is, some arrays not available for deletion got added to for_deletion.

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