-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
core: fix missing vec_cvfo on IBM POWER9 due to unavailable VSX float64 conversion #27633
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
base: 4.x
Are you sure you want to change the base?
Conversation
static inline vec_double2 vec_cvfo(const vec_float4& a) | ||
{ | ||
double r0 = static_cast<double>(reinterpret_cast<const float*>(&a)[0]); | ||
double r1 = static_cast<double>(reinterpret_cast<const float*>(&a)[1]); | ||
return (vec_double2){r0, r1}; | ||
} |
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.
Documentation for vec_floate says: "Converts an input vector to a vector of single-precision numbers. The even-numbered target elements are obtained by converting the source elements to single-precision numbers." So the replacement is not equivalent.
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.
Sorry, how about this?
static inline vec_double2 vec_cvfo(const vec_float4& a)
{
double r0 = static_cast<double>(reinterpret_cast<const float*>(&a)[0]);
double r1 = static_cast<double>(reinterpret_cast<const float*>(&a)[2]);
return (vec_double2){r0, r1};
}
…onversion Some POWER9 systems fail to build downstream projects (e.g. ncnn) due to undefined references to `vec_cvfo`. This happens because POWER9 does not support the VSX float64 conversion instructions introduced in POWER10. This patch introduces a fallback for `vec_cvfo` using scalar operations when building on POWER9. All other architectures (including POWER10, x86, ARM) will continue using the optimized VSX conversions. Fixes: undefined symbol vec_cvfo on POWER9 with OpenCV 4.12.0 Tested on: - POWER9 (fallback used, links correctly) - POWER10 and x86 (optimized path used as expected)
#27635
Some POWER9 systems fail to build downstream projects (e.g. ncnn) due to undefined references to
vec_cvfo
. This happens because POWER9 does not support the VSX float64 conversion instructions introduced in POWER10.This patch introduces a fallback for
vec_cvfo
using scalar operations when building on POWER9. All other architectures (including POWER10, x86, ARM) will continue using the optimized VSX conversions.Fixes: undefined symbol vec_cvfo on POWER9 with OpenCV 4.12.0
Tested on:
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.