Skip to content

Make empty_symint support dynamism - #4524

Closed
vanbasten23 wants to merge 104 commits into
functionalizationfrom
fixEmptySymint
Closed

vanbasten23 wants to merge 104 commits into
functionalizationfrom
fixEmptySymint

Conversation

@vanbasten23

Copy link
Copy Markdown
Collaborator

No description provided.

@vanbasten23
vanbasten23 changed the base branch from master to functionalization January 27, 2023 05:54
@JackCaoG

Copy link
Copy Markdown
Collaborator

Thanks, I will take a look

Comment thread torch_xla/csrc/aten_xla_type.cpp Resolved
Comment thread torch_xla/csrc/tensor_methods.cpp Resolved

@JackCaoG JackCaoG left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you dump HLO when it crashed? Then it should obvious why it failed.

@vanbasten23

Copy link
Copy Markdown
Collaborator Author

can you dump HLO when it crashed? Then it should obvious why it failed.

  1. When I do debug_flag save_hlo python pytorch/xla/test/test_dynamic_shapes.py TestDynamicShapes.test_empty_symint or debug_flag save_ir python pytorch/xla/test/test_dynamic_shapes.py TestDynamicShapes.test_empty_symint, neither the hlo dump or ir dump showed up. (fyi I have alias save_hlo="XLA_SAVE_TENSORS_FMT='hlo' XLA_SAVE_TENSORS_FILE='/tmp/save1.hlo'" in my bashrc). I have my command output but I don't find much hint on why the hlo dump was not generated. Any idea on how to debug this issue?

  2. To unblock myself, I ended up doing print(torch_xla._XLAC._get_xla_tensors_text([t2])) and print(torch_xla._XLAC._get_xla_tensors_hlo([t2])). I was able to get the dump this way. Here is what I found: if I comment out this line https://github.com/pytorch/xla/pull/4524/files#diff-036cb21341ff8e390cc250e74fe9e3f0f15f259ea4bec4abcce49d95febf1553R154 print('t1=', t1), the test would actually succeed (here is the ir and hlo dump https://paste.googleplex.com/6398046270128128). On the other hand, if I execute the above line, the test would crash with error with ir/hlo dump.

Comment thread torch_xla/csrc/xla_graph_executor.cpp Resolved
Summary:
This pull request tries to fix the following two tests:
1. test_allgather: allgather uses copy_ internally to update the input and copy_ being decomposed into copy which we need to lower.
2. test_send: send uses t.data to update t’s data which is not supported in functionalization. See functorch.functionalize doesn't allow t.data update pytorch#91093. After switching to copy_, it looks like the problem is fixed.

Test Plan:
CI.
Summary:
test_logcumsumexp fails because the shape check on logcumsumexp.out is not
executed after functionalized decomposition. As disccused in pytorch/pytorch#92912,
this will be hard to fix. Since we never lower logcumsumexp, our users are
highly likely not going to use it.

Test Plan:
CI.
…4526)

Summary:
According to pytorch/pytorch#91789, this test is added for the cpu device.
Let's properly skip it.

Test Plan:
CI
Summary:
The dynamic shape tests are broken because of upstream changes that decompose dynamic ops into different ways. Adds new lowering to fix that.

Corresponding upstream changes for SymBool: pytorch/pytorch#92149.

Test Plan:
CI

@alanwaketan alanwaketan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Generally LGTM. Let's wait for the CI results and the answers to the crash.

Comment thread test/test_dynamic_shapes.py Resolved
Comment thread torch_xla/csrc/xla_graph_executor.cpp Resolved
Comment thread torch_xla/csrc/xla_op_builder.cpp Resolved
fix linter

fix build

fix build and linter
@JackCaoG

Copy link
Copy Markdown
Collaborator

Is test passing with the new symint change?

@JackCaoG
JackCaoG self-requested a review January 31, 2023 23:47
@vanbasten23

Copy link
Copy Markdown
Collaborator Author

Is test passing with the new symint change?

The PR is intended to fix the test TestDynamicShapeModels.test_forward_pass_dynamic_input_correctness. Now the original error is gone and it failed with error XLASymNodeImpl::sub has not been implemented. (https://paste.googleplex.com/6638495719227392)

@JackCaoG JackCaoG left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mostly lgtm. My general comments is whether we can just merge this pr to the master and let functionization branch to rebase. This way we don't need to block this change that is also required by head for months.

@vanbasten23

Copy link
Copy Markdown
Collaborator Author

Mostly lgtm. My general comments is whether we can just merge this pr to the master and let functionization branch to rebase. This way we don't need to block this change that is also required by head for months.

Agreed. What's the best way to do that at this point? I was planning to cherry pick this commit to the master branch after this pr is merged.

@vanbasten23
vanbasten23 marked this pull request as ready for review February 1, 2023 17:56
@JackCaoG

JackCaoG commented Feb 1, 2023

Copy link
Copy Markdown
Collaborator

Mostly lgtm. My general comments is whether we can just merge this pr to the master and let functionization branch to rebase. This way we don't need to block this change that is also required by head for months.

Agreed. What's the best way to do that at this point? I was planning to cherry pick this commit to the master branch after this pr is merged.

You can just create a pr with most of the independent bits of this pr and merge it to master. Ask @wonjoolee95 to rebase then hopefully all test will pass.

@vanbasten23

Copy link
Copy Markdown
Collaborator Author

You can just create a pr with most of the independent bits of this pr and merge it to master. Ask @wonjoolee95 to rebase then hopefully all test will pass.

done #4550. I'll mark the current pr draft again

@vanbasten23
vanbasten23 marked this pull request as draft February 1, 2023 20:44
@wonjoo-wj
wonjoo-wj force-pushed the functionalization branch 2 times, most recently from 1c75e4c to ae08eb5 Compare February 2, 2023 18:21
@vanbasten23
vanbasten23 force-pushed the functionalization branch 2 times, most recently from 974c3a9 to caccc62 Compare February 3, 2023 19:26
@vanbasten23

Copy link
Copy Markdown
Collaborator Author

Closing this. There's another identical PR that has been merged into master branch.

@vanbasten23 vanbasten23 closed this Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants