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
signed 8-bit integer support #3507
base: master
Are you sure you want to change the base?
Conversation
Hey, things look good but I am getting the same failures you are. Do you need us to fix these or do you think you can handle this? |
I am looking into it, but if you could look into the remaining failing tests, that would be very much appreciated! The last 3 are all related to bilinear interpolation, but I'm not sure about the RichardsonLucyOnGrayscale test. |
include/af/defines.h
Outdated
@@ -227,6 +227,7 @@ typedef enum { | |||
#if AF_API_VERSION >= 37 | |||
, f16 ///< 16-bit floating point value | |||
#endif | |||
, s8 ///< 8-bit signed integral value /// TODO AF_API_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, s8 ///< 8-bit signed integral value /// TODO AF_API_VERSION | |
#if AF_APU_VERSION >= 310 | |
, s8 ///< 8-bit signed integral value /// TODO AF_API_VERSION | |
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current system, if I use 310
API versions 4.0+ will need to be set to 400
, not 40
. This is not really a problem currently, but maybe needs to be looked at in the future?
include/af/traits.hpp
Outdated
|
||
template<> | ||
struct dtype_traits<signed char> { | ||
enum { | ||
af_type = s8 , | ||
ctype = f32 | ||
}; | ||
typedef signed char base_type; | ||
static const char* getName() { return "schar"; } | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
template<> | |
struct dtype_traits<signed char> { | |
enum { | |
af_type = s8 , | |
ctype = f32 | |
}; | |
typedef signed char base_type; | |
static const char* getName() { return "schar"; } | |
}; | |
#if AF_API_VERSION >= 310 | |
template<> | |
struct dtype_traits<signed char> { | |
enum { | |
af_type = s8 , | |
ctype = f32 | |
}; | |
typedef signed char base_type; | |
static const char* getName() { return "schar"; } | |
}; | |
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Public interface changes need to be surrounded with these ifdefs. This includes anything in the include
folder but not in the src
folder.
Image loading with a shift causes the test data to contain negative values. This test passes when the data is limited to 0-127 instead.
This test data cannot be trivially shifted since rotate sets out-of-bounds values to 0, not -128. Limiting the range to 0-127 mostly works, but introduces rounding errors between output and gold.
This also slightly extends the interface macros.
9ff74ea
to
94e7674
Compare
@@ -1393,6 +1428,7 @@ namespace af | |||
AFAPI array operator&(const array& lhs, const long long& rhs); | |||
AFAPI array operator&(const array& lhs, const long& rhs); | |||
AFAPI array operator&(const array& lhs, const short& rhs); | |||
AFAPI array operator&(const array& lhs, const signed char& rhs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the bitwise and logical AND operators need to be protected by the ifdefs? None of the other types have guards.
Description
Adds signed 8-bit integer support to all arrayfire backends. So far all backends build and most tests pass. Failing tests:
AnisotropicDiffusion/4.GradientGrayscaleAnisotropicDiffusion/4.GradientColorImageAnisotropicDiffusion/4.CurvatureGrayscaleAnisotropicDiffusion/4.CurvatureColorImageInverseDeconvolution/1.TikhonovOnGrayscaleIterativeDeconvolution/1.LandweberOnGrayscaleIterativeDeconvolution/1.RichardsonLucyOnGrayscale(skipped)RichardsonLucy doesn't work well with negative values. Test passes when data is 0-127.
RotateLinear/6.*(skipped)Test data for every non-cardinal rotation doesn't work well with s8.
TransformInt/6.PerspectiveBilinearTransformInt/6.PerspectiveBilinearInvertAll of the image loading tests appear to be failing due to unsigned->signed conversion overflow related to image loading.(fixed)Changes to Users
No additional build flags have been added for this feature.
Checklist