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

Fix crash due to complex types not being considered in KernelDispatch.cpp #19185

Closed

Conversation

giacs-epic
Copy link
Contributor

When querying the element type's bitwidth via Type::getIntOrFloatBitwidth() the underlying assumption is that Type is IntegerType or FloatType. However ComplexType is also a valid type in this situation.

Adds a computation of the complex element type size.

@giacs-epic giacs-epic changed the title Fix crash due to calls to Type::getIntOrFloatBitwidth() in KernelDispatch.cpp Fix crash due to complex types not being considered in KernelDispatch.cpp Nov 18, 2024
Copy link
Contributor

@hanhanW hanhanW left a comment

Choose a reason for hiding this comment

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

I'm not aware that we have complex types as inputs. Can you elaborate how you discover the case and how does it get to the CPU codegen inputs?

@hanhanW
Copy link
Contributor

hanhanW commented Nov 18, 2024

I'm not aware that we have complex types as inputs. Can you elaborate how you discover the case and how does it get to the CPU codegen inputs?

I just learned from the other comment that we should support complex types. This looks good to me, but a test is needed. Perhaps we can let @IanWood1 land his PR with the change, and add you to co-author. What do you think?

@IanWood1
Copy link
Contributor

Fixed with #19172 and added as coauthor

@IanWood1 IanWood1 closed this Nov 19, 2024
@giacs-epic
Copy link
Contributor Author

@hanhanW @IanWood1 Thanks for taking care of this, absolutely fine with how this was landed.
Just to add a further example, this comes from implementing torch.stft https://pytorch.org/docs/stable/generated/torch.stft.html which has complex outputs. In my implementation the output is returned from a torch.prim.Loop and this triggered the crash.

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