-
Notifications
You must be signed in to change notification settings - Fork 519
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
Non-value semantic ops should have stronger verifiers #2490
Comments
I wanted to start contributing to From what I understand,
How would you like me to proceed? What else can we do? |
It would be great to get a patch for this. The primary complexity here is that the code in that TD file is generated from the pytorch op registry, so you have to teach torch_ods_gen.py how to do it. I'm afk but I believe that there is a tablegen type for value tensors vs non value tensors. You probably don't need to further constrain these by dtype. |
Have a look at #2519 when you have time. Thank you. |
Attempt to solve #2490 Changes for Non Value Semantic Ops having the `IsTrailingUnderscoreInplaceVariant` trait : - AnyTorchTensorType -> Torch_NonValueTensorType - AnyTorchOptionalTensorType -> AnyTorchOptionalNonValueTensorType - AnyTorchListOfOptionalTensorType -> AnyTorchListOfOptionalNonValueTensorType - AnyTorchListOfTensorType -> AnyTorchListOfNonValueTensorType Created three new tensor types for optional and list non value tensors.
Can we close this, @stellaraccident @gptsarthak ? |
Yep. Looks fixed |
Currently, in-place ops are defined like:
The result is that if a
!torch.vtensor
is inadvertently passed, bad things happen later during lowering. We should tighten up verification by one of:IsTrailingUnderscoreInplaceVariant
trait perform stronger verification of the first argument/result type.torch_ods_gen.py
to emit the proper, more constrained types (vsAnyTorchTensorType
).Either would produce the correct result but 2 is more explicit and provides better documentation value. Doing that would require some minor refactoring of the
raw_emit_op
helper oftorch_ods_gen.py
so that it tweaks the types if the trait is present.On the other hand, implementing in 1 would allow us to emit a much more friendly error message, which may help for exotic cases.
The text was updated successfully, but these errors were encountered: