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

Relax dynamic restriction on ScatterND stablehlo conversion #2772

Merged
merged 4 commits into from
Apr 3, 2024

Conversation

srcarroll
Copy link
Contributor

The previous implementation asserted that all dims of the indices operand were static. First of all, assertion isn't appropriate here as the definition of the op allows dynamic. This is a condition for the pattern match and thus should fail the match with notifyMatchFailure. Second, the implementation only relies on the last dim being static, so we can relax the match condition and only fail if last dim is dynamic.

@jenkins-droid
Copy link
Collaborator

Can one of the admins verify this patch?

@srcarroll
Copy link
Contributor Author

I'll be honest. I don't completely understand the lowering of ScatterND so I'm not sure if the result is correct. But I just noticed that the assertion was too restrictive based on the fact that only the last dim of indices needed to be static. So I'm assuming everything else is correct when relaxing the restriction. Please confirm.

@AlexandreEichenberger
Copy link
Collaborator

@jenkins-droid test this please

@jenkins-droid
Copy link
Collaborator

Can one of the admins verify this patch?

@AlexandreEichenberger
Copy link
Collaborator

@jenkins-droid test this please

Copy link
Collaborator

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to get a second opinion from an HLO expert.

@AlexandreEichenberger
Copy link
Collaborator

@srcarroll let me know when you are ready for me to push the code.

@Connor-XY
Copy link
Contributor

I'll be honest. I don't completely understand the lowering of ScatterND so I'm not sure if the result is correct. But I just noticed that the assertion was too restrictive based on the fact that only the last dim of indices needed to be static. So I'm assuming everything else is correct when relaxing the restriction. Please confirm.

The assertion is restrictive since I would like to provide a basic implementation for static-shaped tensors first, and fail dynamic ones temporarily. I believe that you are now supporting dynamic cases and we could remove some restrictions gradually. As for the ScatterND op, it indeed only requires the last dim of indices to be static, and your test case should work as I don't see any problem with it.

@srcarroll
Copy link
Contributor Author

I'll be honest. I don't completely understand the lowering of ScatterND so I'm not sure if the result is correct. But I just noticed that the assertion was too restrictive based on the fact that only the last dim of indices needed to be static. So I'm assuming everything else is correct when relaxing the restriction. Please confirm.

The assertion is restrictive since I would like to provide a basic implementation for static-shaped tensors first, and fail dynamic ones temporarily. I believe that you are now supporting dynamic cases and we could remove some restrictions gradually. As for the ScatterND op, it indeed only requires the last dim of indices to be static, and your test case should work as I don't see any problem with it.

@Connor-XY Thanks for the confirmation! @AlexandreEichenberger you can merge. I'm rebasing now just in case

@jenkins-droid
Copy link
Collaborator

Can one of the admins verify this patch?

@AlexandreEichenberger
Copy link
Collaborator

@jenkins-droid test this please

@AlexandreEichenberger AlexandreEichenberger merged commit f563c41 into onnx:main Apr 3, 2024
8 checks passed
@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #14626 [push] Relax dynamic restrictio... started at 11:37

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #14596 [push] Relax dynamic restrictio... started at 10:37

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #13621 [push] Relax dynamic restrictio... started at 11:47

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #14596 [push] Relax dynamic restrictio... passed after 1 hr 3 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #14626 [push] Relax dynamic restrictio... passed after 1 hr 24 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #13621 [push] Relax dynamic restrictio... passed after 1 hr 59 min

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.

5 participants