Skip to content

support gmm as a custom op for dynamo#7672

Merged
JackCaoG merged 6 commits intomasterfrom
JackCaoG/gmm_custom_op
Jul 12, 2024
Merged

support gmm as a custom op for dynamo#7672
JackCaoG merged 6 commits intomasterfrom
JackCaoG/gmm_custom_op

Conversation

@JackCaoG
Copy link
Copy Markdown
Collaborator

@JackCaoG JackCaoG commented Jul 12, 2024

PyTorch actually will not run functionization inside a custom op. This means we should avoid using the in place ops for all of the custom op implementation. For this op I made gmm functional.

From @bdhirsh

short answer is that functionalization runs on every "primitive" op (both in aten and custom) directly. so if it sees a custom op that is marked as not-mutating-its-inputs, it will assume that op is functional

@JackCaoG JackCaoG requested a review from alanwaketan July 12, 2024 01:35
@JackCaoG JackCaoG marked this pull request as ready for review July 12, 2024 01:35
@JackCaoG JackCaoG requested a review from wonjoo-wj July 12, 2024 01:35
@JackCaoG JackCaoG merged commit 1651e76 into master Jul 12, 2024
@JackCaoG JackCaoG deleted the JackCaoG/gmm_custom_op branch July 12, 2024 17:26
Copy link
Copy Markdown
Collaborator

@alanwaketan alanwaketan left a comment

Choose a reason for hiding this comment

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

LGTM.

import torch_xla
import torch_xla.core.xla_model as xm
import torch_xla.distributed.spmd as xs
import torch_xla.debug.metrics as met
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.

Do you add this in accident?

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.

lol forgot to delete

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