Skip to content

Remove checking for training specific parameters in EmbeddingBag lowering#3782

Merged
rafaelubalmw merged 3 commits into
llvm:mainfrom
Hanumanth04:fixForEmbeddingBagLowering
Oct 15, 2024
Merged

Remove checking for training specific parameters in EmbeddingBag lowering#3782
rafaelubalmw merged 3 commits into
llvm:mainfrom
Hanumanth04:fixForEmbeddingBagLowering

Conversation

@Hanumanth04

Copy link
Copy Markdown

Torch-to-linalg pass fails for EmbeddingBag when the training only specific properties of the operator are set to true. For instance, this operator's sparse input/property is training-specific, and if the value of this property is true, the existing lowering bails out. However, we don't need to check for training-specific parameters and bailout from the legalization since we don't care about these properties during the eval/inference mode.

@Hanumanth04

Copy link
Copy Markdown
Author

Since I don't have permission to add reviewers, I am tagging @vidsinghal here. Vidush, Could you please take a look at this change?

@vidsinghal

Copy link
Copy Markdown
Collaborator

LGTM.

@Hanumanth04

Hanumanth04 commented Oct 14, 2024

Copy link
Copy Markdown
Author

LGTM.

Thank you for looking into this. Since I don't have permission to merge this change, could you please help merge it?

@vidsinghal

Copy link
Copy Markdown
Collaborator

LGTM.

Thank you for looking into this. Since I don't have permission to merge this change, could you please help merge it?

I will merge it when all the tests pass.

@Hanumanth04

Copy link
Copy Markdown
Author

LGTM.

Thank you for looking into this. Since I don't have permission to merge this change, could you please help merge it?

I will merge it when all the tests pass.

I needed to run pre-commit to fix indentations, which I was not aware :) I have run the pre-commit, and the checks passed on my end. Could you please check now?

@rafaelubalmw rafaelubalmw merged commit 895f490 into llvm:main Oct 15, 2024
@vidsinghal

Copy link
Copy Markdown
Collaborator

LGTM.

Thank you for looking into this. Since I don't have permission to merge this change, could you please help merge it?

I will merge it when all the tests pass.

I needed to run pre-commit to fix indentations, which I was not aware :) I have run the pre-commit, and the checks passed on my end. Could you please check now?

Ah ok, seems like someone already merged it.

@Hanumanth04

Copy link
Copy Markdown
Author

LGTM.

Thank you for looking into this. Since I don't have permission to merge this change, could you please help merge it?

I will merge it when all the tests pass.

I needed to run pre-commit to fix indentations, which I was not aware :) I have run the pre-commit, and the checks passed on my end. Could you please check now?

Ah ok, seems like someone already merged it.

My colleague @rafaelubalmw has merge access and he did the merge. Thanks again, Vidush.

Comment on lines -225 to -227
Value scaleGradByFreq = op.getScaleGradByFreq();
Value mode = op.getMode();
Value sparse = op.getSparse();

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.

Hi @Hanumanth04, isn't silently removing those operands from the code wrong? I mean it's fine that we're not making use of those args but let's say for an instance of this op if those args are present then wouldn't the behavior of this IR be wrong or not as expected in that case?

@Hanumanth04 Hanumanth04 Oct 16, 2024

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi @vivekkhandelwal1 ,
These are training-only specific arguments, and the existing implementation doesn't have the lowering for training-specific logic. We can introduce these arguments back if we ever decide to add lowering logic for training. However, I don't know if there is a use case for this though. Please note that I have only removed these arguments from the lowering as they were unused after my change. However, the tablegen file corresponding to this operator still has these arguments. I believe removing these unused arguments is not an issue here.

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.

Hi @Hanumanth04, since they are training-specific args how come they were set for instances where only eval/inference is done? I'm not able to understand if they are only training specific args then any code doing inference should not be setting them and if that's not true then the issue is where that PyTorch code is written at higher level not at the lowering level.

@Hanumanth04 Hanumanth04 deleted the fixForEmbeddingBagLowering branch November 11, 2024 12:08
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