Skip to content

[Functionalization] Remove CreateAsStridedViewInfo#5084

Merged
alanwaketan merged 4 commits intomasterfrom
alanwaketan/as_strided_2
Jun 14, 2023
Merged

[Functionalization] Remove CreateAsStridedViewInfo#5084
alanwaketan merged 4 commits intomasterfrom
alanwaketan/as_strided_2

Conversation

@alanwaketan
Copy link
Copy Markdown
Collaborator

Summary:
This PR removes the usage of CreateAsStridedViewInfo in tensor_methods::as_strided.

Test Plan:
PJRT_DEVICE=CPU python ../test/test_view_ops.py -v -k TestViewOpsXLA.test_as_strided

@vanbasten23
Copy link
Copy Markdown
Collaborator

Thanks a lot. Since TORCH.AS_STRIDED "Create a view of an existing torch.Tensor" and we have already enabled functionalization, I wonder why is this function still called.

@alanwaketan
Copy link
Copy Markdown
Collaborator Author

Thanks a lot. Since TORCH.AS_STRIDED "Create a view of an existing torch.Tensor" and we have already enabled functionalization, I wonder why is this function still called.

Well, we can rename it to as_strided_copy but I guess it doesn't matter for now... Will resolve the CI issue later.

Summary:
This PR removes the usage of CreateAsStridedViewInfo in
tensor_methods::as_strided.

Test Plan:
PJRT_DEVICE=CPU python ../test/test_view_ops.py -v -k TestViewOpsXLA.test_as_strided
@alanwaketan alanwaketan force-pushed the alanwaketan/as_strided_2 branch from 42aeb4b to f948036 Compare June 14, 2023 19:59
Comment thread torch_xla/csrc/tensor_methods.cpp Outdated
std::vector<int64_t> stride,
c10::optional<int64_t> storage_offset) {
// See Note: [Disabling functionalization]
if (xla::sys_util::GetEnvBool("XLA_DISABLE_FUNCTIONALIZATION", false)) {
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.

I'm trying to figure out how you fix the test. Right now, which branch is being run, the if block or the else block?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

By default the flag is off, we have a dedicated run of test_operations.py with the flag on.

@alanwaketan alanwaketan merged commit d438315 into master Jun 14, 2023
@alanwaketan
Copy link
Copy Markdown
Collaborator Author

Thanks everyone for approving the PR.

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.

4 participants