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

Support half #265

Open
vorj opened this issue Feb 5, 2020 · 5 comments
Open

Support half #265

vorj opened this issue Feb 5, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@vorj
Copy link

vorj commented Feb 5, 2020

Related to #264 .

We should support half type regardless of whether the environment supports cl_khr_fp16 or not.

@LWisteria
Copy link
Member

@vorj Do you mean that you want to implement all half operations with software functions? How much do you need it? I think it's reasonable to give up half support if the device doesn't support the extensions for it.

@vorj
Copy link
Author

vorj commented Feb 6, 2020

@LWisteria

Do you mean that you want to implement all half operations with software functions?

Yes, and I think that we can implement almost of them like float_to_half(float_operation(half_to_float(half_value))) .
The exception is nextafter , but this has been already implemented.

I think it's reasonable to give up half support if the device doesn't support the extensions for it.

I thought so when we had no idea to solve the issue, but now I have an idea, and it's worth to try to get ClPy's features closer to CuPy's ones I think.

@ybsh
Copy link
Collaborator

ybsh commented Feb 6, 2020

Talked with @LWisteria about who should work on this issue .
We agreed that this task is more appropriate for an intern, considering this task seems to require a fair amount of time, and I'm not currently very sure if I can spare as much time.
I will continue the performance improvement issue: #153

@LWisteria
Copy link
Member

@vorj OK, I understand that you want to use Ultima to convert a + b where a and b are half to f2h(h2f(a)+h2f(b)), right?

Then, how will you deal rounding errors etc? f2h(h2f(a)+h2f(b)) does not exactly match native a+b.

@vorj
Copy link
Author

vorj commented Feb 7, 2020

@LWisteria

I understand that you want to use Ultima to convert a + b where a and b are half to f2h(h2f(a)+h2f(b)), right?

Yes, that's it.

how will you deal rounding errors etc?

That's the problem. I'm still thinking about it.
Well, I have a question. Although currently we calculate sqrt(int8_value) as f2h(sqrt(i2f(int8_value))) , does the casting in this situation have no problem?

Or we can use some open source software implementation of half as an alternative option. However, even this option requires member function support to ultima, and I don't know the half implementation supporting for not only arithmetic operator but also mathmatical functions since my investigation is insufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants