-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
GH-20213: [C++] Implement cast to/from halffloat #40067
Conversation
|
This still needs work, but I would greatly appreciate someone who is more familiar with the arrow code-base to comment on whether my approach is sane or not. |
|
Thanks for posting this. The approach is sane, I posted some comments. You will have to decide whether you want to tackle casting to string, or prefer leaving that for later/another contributor. |
So far this PR seems to work for the following casts:
@pitrou you mentioned string cast(s). Is that:
? What other casts are required to consider this done? |
Yes.
Ideally, integer-to-half and half-to-integer would be implemented as well. |
|
1 similar comment
|
Please correct me if I'm wrong, but it seems like float32/float64 cast to string is ultimately handled by this vendored library There doesn't seem to be a direct way to cast from a half float ultimately represented by a |
Yes, it's acceptable. The only annoyance would be the superfluous precision, but that's not a blocking issue. |
By the way, you'll have to implement unit tests at some point (in C++). |
@ClifHouck thanks for working on this! Small bit of housekeeping: There is a note in
Could you please push a commit here that removes that note? Looks like you will need to rebase first because there have been some changes in |
So one question I currently have is, should I specialize |
Which method would you specialize? |
After reading more code, more likely I need to specialize or modify |
If you're struggling on this, someone else can take a look and help. Perhaps @benibus or @felipecrv ? |
I'm currently stuck on getting a new |
|
I think I've fixed things with my latest commit. Turned out a specialization of |
I added a few more TODOs but I think this is very close to being ready for review. |
|
Done. |
Any objections to @kou merging this? |
Oh, sorry. I missed this. I'll merge this. |
Oops, sorry that I couldn't give this a review earlier. |
I'll address any additional code-related changes needed here in a follow-up PR. |
…41084) ### Rationale for this change Address remaining tasks brought up post-merge in this PR: #40067 ### What changes are included in this PR? Adds a couple of tests and cleans up cruft on another test. ### Are these changes tested? Yes, as these are test-only related changes. ### Are there any user-facing changes? No. * GitHub Issue: #41089 Authored-by: Clif Houck <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
…casts (apache#41084) ### Rationale for this change Address remaining tasks brought up post-merge in this PR: apache#40067 ### What changes are included in this PR? Adds a couple of tests and cleans up cruft on another test. ### Are these changes tested? Yes, as these are test-only related changes. ### Are there any user-facing changes? No. * GitHub Issue: apache#41089 Authored-by: Clif Houck <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
### Rationale for this change ### What changes are included in this PR? This PR implements casting to and from float16 types using the vendored float16 library included in arrow at `cpp/arrrow/util/float16.*`. ### Are these changes tested? Unit tests are included in this PR. ### Are there any user-facing changes? In that casts to and from float16 will now work, yes. * Closes: apache#20213 ### TODO - [x] Add casts to/from float64. - [x] String <-> float16 casts. - [x] Integer <-> float16 casts. - [x] Tests. - [x] Update https://github.com/apache/arrow/blob/main/docs/source/status.rst about half float. - [x] Rebase. - [x] Run clang format over this PR. * GitHub Issue: apache#20213 Authored-by: Clif Houck <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
…casts (apache#41084) ### Rationale for this change Address remaining tasks brought up post-merge in this PR: apache#40067 ### What changes are included in this PR? Adds a couple of tests and cleans up cruft on another test. ### Are these changes tested? Yes, as these are test-only related changes. ### Are there any user-facing changes? No. * GitHub Issue: apache#41089 Authored-by: Clif Houck <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
### Rationale for this change ### What changes are included in this PR? This PR implements casting to and from float16 types using the vendored float16 library included in arrow at `cpp/arrrow/util/float16.*`. ### Are these changes tested? Unit tests are included in this PR. ### Are there any user-facing changes? In that casts to and from float16 will now work, yes. * Closes: apache#20213 ### TODO - [x] Add casts to/from float64. - [x] String <-> float16 casts. - [x] Integer <-> float16 casts. - [x] Tests. - [x] Update https://github.com/apache/arrow/blob/main/docs/source/status.rst about half float. - [x] Rebase. - [x] Run clang format over this PR. * GitHub Issue: apache#20213 Authored-by: Clif Houck <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
…casts (apache#41084) ### Rationale for this change Address remaining tasks brought up post-merge in this PR: apache#40067 ### What changes are included in this PR? Adds a couple of tests and cleans up cruft on another test. ### Are these changes tested? Yes, as these are test-only related changes. ### Are there any user-facing changes? No. * GitHub Issue: apache#41089 Authored-by: Clif Houck <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
### Rationale for this change ### What changes are included in this PR? This PR implements casting to and from float16 types using the vendored float16 library included in arrow at `cpp/arrrow/util/float16.*`. ### Are these changes tested? Unit tests are included in this PR. ### Are there any user-facing changes? In that casts to and from float16 will now work, yes. * Closes: apache#20213 ### TODO - [x] Add casts to/from float64. - [x] String <-> float16 casts. - [x] Integer <-> float16 casts. - [x] Tests. - [x] Update https://github.com/apache/arrow/blob/main/docs/source/status.rst about half float. - [x] Rebase. - [x] Run clang format over this PR. * GitHub Issue: apache#20213 Authored-by: Clif Houck <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
…casts (apache#41084) ### Rationale for this change Address remaining tasks brought up post-merge in this PR: apache#40067 ### What changes are included in this PR? Adds a couple of tests and cleans up cruft on another test. ### Are these changes tested? Yes, as these are test-only related changes. ### Are there any user-facing changes? No. * GitHub Issue: apache#41089 Authored-by: Clif Houck <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
### Rationale for this change ### What changes are included in this PR? This PR implements casting to and from float16 types using the vendored float16 library included in arrow at `cpp/arrrow/util/float16.*`. ### Are these changes tested? Unit tests are included in this PR. ### Are there any user-facing changes? In that casts to and from float16 will now work, yes. * Closes: apache#20213 ### TODO - [x] Add casts to/from float64. - [x] String <-> float16 casts. - [x] Integer <-> float16 casts. - [x] Tests. - [x] Update https://github.com/apache/arrow/blob/main/docs/source/status.rst about half float. - [x] Rebase. - [x] Run clang format over this PR. * GitHub Issue: apache#20213 Authored-by: Clif Houck <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
…casts (apache#41084) ### Rationale for this change Address remaining tasks brought up post-merge in this PR: apache#40067 ### What changes are included in this PR? Adds a couple of tests and cleans up cruft on another test. ### Are these changes tested? Yes, as these are test-only related changes. ### Are there any user-facing changes? No. * GitHub Issue: apache#41089 Authored-by: Clif Houck <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
### Rationale for this change ### What changes are included in this PR? This PR implements casting to and from float16 types using the vendored float16 library included in arrow at `cpp/arrrow/util/float16.*`. ### Are these changes tested? Unit tests are included in this PR. ### Are there any user-facing changes? In that casts to and from float16 will now work, yes. * Closes: apache#20213 ### TODO - [x] Add casts to/from float64. - [x] String <-> float16 casts. - [x] Integer <-> float16 casts. - [x] Tests. - [x] Update https://github.com/apache/arrow/blob/main/docs/source/status.rst about half float. - [x] Rebase. - [x] Run clang format over this PR. * GitHub Issue: apache#20213 Authored-by: Clif Houck <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
…casts (apache#41084) ### Rationale for this change Address remaining tasks brought up post-merge in this PR: apache#40067 ### What changes are included in this PR? Adds a couple of tests and cleans up cruft on another test. ### Are these changes tested? Yes, as these are test-only related changes. ### Are there any user-facing changes? No. * GitHub Issue: apache#41089 Authored-by: Clif Houck <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 72d20ad. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 4 possible false positives for unstable benchmarks that are known to sometimes produce them. |
Rationale for this change
What changes are included in this PR?
This PR implements casting to and from float16 types using the vendored float16 library included in arrow at
cpp/arrrow/util/float16.*
.Are these changes tested?
Unit tests are included in this PR.
Are there any user-facing changes?
In that casts to and from float16 will now work, yes.
TODO