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

Add complex numbers #849

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

opfromthestart
Copy link
Contributor

@opfromthestart opfromthestart commented Aug 13, 2023

Closes #821.
I had to use a proxy object to implement cuda traits. It built with cargo build -F complex,cuda,nightly,f16

Comment on lines +115 to +118
#[cfg(feature = "cuda")]
unsafe impl ValidAsZeroBits for Complex {}
#[cfg(feature = "cuda")]
unsafe impl DeviceRepr for Complex {}
Copy link
Owner

Choose a reason for hiding this comment

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

We can add these to cudarc in a PR there behind a feature flag, that should allow us to not need the wrapper type, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was unaware that you controlled cudarc. That would work yes.

@coreylowman
Copy link
Owner

How does this interact with cuda kernels?

@opfromthestart
Copy link
Contributor Author

opfromthestart commented Aug 15, 2023

I don't think it would work at all with cuda kernels atm. Not familiar with how cuda types work, can you overload operators for a custom complex struct?

@coreylowman
Copy link
Owner

I don't think it would work at all with cuda kernels atm. Not familiar with how cuda types work, can you overload operators for a custom complex struct?

We could potentially just merge this for Cpu and make sure we get compile errors for cuda.

You can overload operators in c++, but I'm not sure that's sufficient to make the kernels work in the same way as they do in rust land.

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.

Add support for complex tensors
2 participants