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 f16 support for modulus and norm #3258

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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
ASSERT_ARRAYS_EQ(af::constant(1, shape, s64), rem);
ASSERT_ARRAYS_EQ(af::constant(0, shape, s64), diff);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

test negative modulus, similar to halide/Halide#5773

@@ -0,0 +1,183 @@
/*******************************************************
* Copyright (c) 2014, ArrayFire
Copy link
Contributor

Choose a reason for hiding this comment

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

2022


ASSERT_DOUBLE_EQ(norm_inf, result);
}

Copy link
Contributor

@syurkevi syurkevi Sep 12, 2022

Choose a reason for hiding this comment

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

tests for vector norm?
atleast:
add TODO, open new issue

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
2 participants