Skip to content

Add f16 support for modulus and norm #3258

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

Merged
merged 10 commits into from
Mar 7, 2025

Conversation

umar456
Copy link
Member

@umar456 umar456 commented Jun 10, 2022

Add support for f16 for modulus and norm. This PR also adds tests for the norm function

Description

  • Adds support for modulus operation for half type. This operation is missing in the CUDA backend because it is not supported by the CUDA math library. We are now implementing this function in software
  • Add support for norm for half type.
  • Add tests for norm
  • We now use ff functions that accept float types as inputs in CUDA kernels.
  • Add tests for additional binary operations

Fixes: #3256

Changes to Users

  • Users can now call modulus and norm from user code

Checklist

  • Rebased on latest master
  • Code compiles
  • Tests pass
  • [ ] Functions added to unified API
  • [ ] Functions documented

@umar456 umar456 force-pushed the half_mod branch 4 times, most recently from 6e0dec7 to 9c1389e Compare June 10, 2022 22:40
@edwinsolisf edwinsolisf self-assigned this Jan 28, 2025
@melonakos melonakos added this to the 3.10 milestone Feb 11, 2025
@edwinsolisf
Copy link
Contributor

edwinsolisf commented Feb 18, 2025

For bookkeeping and future reference:

For integers, af_rem_t/af::rem and af_mod_t/af::mod should produce the output as just using the % operator on integers.

For floats, af_rem_t/af::rem should reproduce the output of remainder/std::remainder from the C/C++ math headers, and af_mod_t/af::mod should reproduce the output of fmod/std::fmod.

@christophe-murphy christophe-murphy dismissed syurkevi’s stale review March 7, 2025 17:08

Comments have been addressed.

@christophe-murphy christophe-murphy merged commit 408b504 into arrayfire:master Mar 7, 2025
2 of 4 checks passed
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.

fp16 norm is not supported
5 participants