opencv: disable broken Intel FP16 detection
PATCH 1/1 opencv: disable broken Intel FP16 detection
With opencv-3.2, the configuration detects if the target supports half-precision floating-point format. This fails to compile for some Intel targets such as skylake with an error such as:
error: '_mm_cvtph_ps' was not declared in this scope
The configuration worked in opencv-3.1 so revert two commits to drop the FP16 detection even though it may make opencv slower. The only change in the configure log is:
--- FP16: Compiler support is available
+-- FP16: Compiler support is not available
The patch should be dropped when a newer version of opencv that includes commit:
https://github.com/opencv/opencv/commit/e5d9b608c47d54e43496041595025fa282fa9de5
is available. Backporting that fix was involved many files and
a cherry-picking explosion so it's not worthwhile.
--- .../0001-Revert-cuda-fix-fp16-compilation.patch | 27 +++ ...vert-check-FP16-build-condition-correctly.patch | 245 +++++++++++++++++++++ meta-oe/recipes-support/opencv/opencv_3.2.bb | 2 + 3 files changed, 274 insertions(+) create mode 100644 meta-oe/recipes-support/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch create mode 100644 meta-oe/recipes-support/opencv/opencv/0002-Revert-check-FP16-build-condition-correctly.patch
meta-oe/recipes-support/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch new file +27 -0
@@ -0,0 +1,27 @@ +From 69f9707678190f6a0948a547dce948251f972676 Mon Sep 17 00:00:00 2001 +From: Randy MacLeod <[email protected]> +Date: Wed, 26 Apr 2017 14:57:30 -0400 +Subject: [PATCH 1/2] Revert "cuda: fix fp16 compilation" + +This reverts commit 12e00827be40576b686ea4438a6e6ef85208743d. +--- + modules/core/include/opencv2/core/cvdef.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h +index 699b166..efc24ca 100644 +--- a/modules/core/include/opencv2/core/cvdef.h ++++ b/modules/core/include/opencv2/core/cvdef.h +@@ -303,8 +303,7 @@ enum CpuFeatures { + #define CV_2PI 6.283185307179586476925286766559 + #define CV_LOG2 0.69314718055994530941723212145818 + +-#if defined __ARM_FP16_FORMAT_IEEE \ +- && !defined __CUDACC__ ++#if defined (__ARM_FP16_FORMAT_IEEE) + # define CV_FP16_TYPE 1 + #else + # define CV_FP16_TYPE 0 +-- +2.9.3 +
meta-oe/recipes-support/opencv/opencv/0002-Revert-check-FP16-build-condition-correctly.patch new file +245 -0
245 lines not on this page · raw message
meta-oe/recipes-support/opencv/opencv_3.2.bb +2 -0
@@ -27,6 +27,8 @@ SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \ file://fixpkgconfig.patch \ file://uselocalxfeatures.patch;patchdir=../contrib/ \ file://useoeprotobuf.patch;patchdir=../contrib/ \ + file://0001-Revert-cuda-fix-fp16-compilation.patch \ + file://0002-Revert-check-FP16-build-condition-correctly.patch \ " PV = "3.2+git${SRCPV}"
Signature · 1 line
2.9.3
Quoted 11 lines · Randy MacLeod
With opencv-3.2, the configuration detects if the target supports half-precision floating-point format. This fails to compile for some Intel targets such as skylake with an error such as:
error: '_mm_cvtph_ps' was not declared in this scopeThe configuration worked in opencv-3.1 so revert two commits to drop the FP16 detection even though it may make opencv slower. The only change in the configure log is:
--- FP16: Compiler support is available
+-- FP16: Compiler support is not available
Quoted 7 lines
The patch should be dropped when a newer version of opencv that includes commit:
https://github.com/opencv/opencv/commit/e5d9b608c47d54e43496041595025fa282fa9de5is available. Backporting that fix was involved many files and a cherry-picking explosion so it's not worthwhile.
Signed-off-by Randy MacLeod <[email protected]>---
I'm not particularly happy with this patch but it does fix a build problem and doesn't appear to break any arches. It's probably best if I soak it on our build cluster and that I take a more time to confirm that I haven't broken anything.
I'm off work until Monday now so I thought that some people on the list might be interested in the patch or in pitching in. If not, I'll follow up next week.
Btw, I'm pinging the opencv devs to see when the next release is expected.
Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5
Quoted 6 lines · Randy MacLeod
The configuration worked in opencv-3.1 so revert two commits to drop the FP16 detection even though it may make opencv slower. The only change in the configure log is:
--- FP16: Compiler support is available
+-- FP16: Compiler support is not available
...
Martin,
Thanks for merging this fix.
My long log was truncated by the line beginning with "---" above but the code changes are fine.
It seems that either I need to learn how to format my email or you have a bug in your patch handling tools or both. :) I suspect that indenting those lines would work-around the problem.
Should I send a fix that reverts the truncated commit log and then modifies the log formatting?
Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5
--- are normal separator of commit message, so all git handling tools would strip this as did patchwork as you can see:
https://patchwork.openembedded.org/patch/139481/
I'm fine either way (leave the complete message only on ML or you sending new patch with fixed formatting and I'll apply it together with revert of previous version.
Quoted 30 lines · Randy MacLeod
Quoted 7 lines · Randy MacLeod
The configuration worked in opencv-3.1 so revert two commits to drop the FP16 detection even though it may make opencv slower. The only change in the configure log is:
--- FP16: Compiler support is available
+-- FP16: Compiler support is not available...
Martin,
Thanks for merging this fix.
My long log was truncated by the line beginning with "---" above but the code changes are fine.
It seems that either I need to learn how to format my email or you have a bug in your patch handling tools or both. :) I suspect that indenting those lines would work-around the problem.
Should I send a fix that reverts the truncated commit log and then modifies the log formatting?
--
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5