zyddora / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Android Intel debug build error - libyuv::I422AlphaToARGBRow_SSSE3 out of gpr registers #517

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
GYP_DEFINES="OS=android target_arch=ia32 android_full_debug=1" 
GYP_CROSSCOMPILE=1 ./gyp_libyuv 
ninja -j7 -C out/Debug libyuv_unittest_apk

[147/187] CXX obj/source/libyuv.row_gcc.o
FAILED: 
/usr/local/google/home/fbarchard/src/libyuva/libyuv/third_party/android_tools/nd
k//toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-g++ -MMD -MF 
obj/source/libyuv.row_gcc.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 
-D_FILE_OFFSET_BITS=64 -DNO_TCMALLOC -DDISABLE_NACL -DCHROMIUM_BUILD 
-DCR_CLANG_REVISION=247874-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_WEBRTC=1 
-DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_BROWSER_CDMS 
-DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS 
-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA 
-DFIELDTRIAL_TESTING_ENABLED -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_PRINTING=1 
-DENABLE_BASIC_PRINTING=1 -DENABLE_SPELLCHECK=1 -DUSE_BROWSER_SPELLCHECKER=1 
-DENABLE_SUPERVISED_USERS=1 -DVIDEO_HOLE=1 -DV8_USE_EXTERNAL_STARTUP_DATA 
-DENABLE_WEBVR -DSAFE_BROWSING_DB_REMOTE -DHAVE_JPEG -DUSE_LIBPCI=1 
-DUSE_OPENSSL=1 -DUSE_OPENSSL_CERTS=1 -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -DANDROID -D__GNU_SOURCE=1 '-DCHROME_BUILD_ID=""' 
-DHAVE_SYS_UIO_H -DDYNAMIC_ANNOTATIONS_ENABLED=1 
-DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -Igen -I../../include -I../.. 
-I../../chromium/src/third_party/libjpeg_turbo --param=ssp-buffer-size=4 
-Werror -fno-strict-aliasing -Wall -Wno-unused-parameter 
-Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC 
-Wno-unused-local-typedefs -msse2 -mfpmath=sse -mmmx -m32 -mstackrealign 
-ffunction-sections -funwind-tables -g -fno-short-enums -finline-limit=64 
--sysroot=../../third_party/android_tools/ndk//platforms/android-16/arch-x86 
-isystem../../third_party/android_tools/ndk//sources/cxx-stl/llvm-libc++/libcxx/
include 
-isystem../../third_party/android_tools/ndk//sources/cxx-stl/llvm-libc++abi/libc
xxabi/include 
-isystem../../third_party/android_tools/ndk//sources/android/support/include 
-fno-stack-protector -O0 -g -funwind-tables -fno-exceptions -fno-rtti 
-fno-threadsafe-statics -fvisibility-inlines-hidden -Wsign-compare -std=gnu++11 
-Wno-narrowing -Wno-literal-suffix  -c ../../source/row_gcc.cc -o 
obj/source/libyuv.row_gcc.o
../../source/row_gcc.cc: In function 'void 
libyuv::I422AlphaToARGBRow_SSSE3(const uint8*, const uint8*, const uint8*, 
const uint8*, uint8*, const libyuv::YuvConstants*, int)':
../../source/row_gcc.cc:1766:4: error: 'asm' operand has impossible constraints
   );
    ^
[147/187] CXX 
obj/chromium/src/base/test/test_support_base.sequenced_task_runner_test_template
.o
ninja: build stopped: subcommand failed.

Original issue reported on code.google.com by fbarch...@google.com on 28 Oct 2015 at 9:13

GoogleCodeExporter commented 8 years ago
Tested with quick fix to disable SSSE3 on a baytrail:

util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose 
--release --gtest_filter=*I420*ToA*_Opt -a "--libyuv_width=1280 
--libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1"

I  118.028s run_tests_on_device(21A0F6A0)  [==========] Running 6 tests from 1 
test case.
I  118.028s run_tests_on_device(21A0F6A0)  [----------] Global test environment 
set-up.
I  118.028s run_tests_on_device(21A0F6A0)  [----------] 6 tests from 
LibYUVConvertTest
I  118.028s run_tests_on_device(21A0F6A0)  [ RUN      ] 
LibYUVConvertTest.I420ToARGB_Opt
I  118.028s run_tests_on_device(21A0F6A0)  [       OK ] 
LibYUVConvertTest.I420ToARGB_Opt (2758 ms)
I  118.028s run_tests_on_device(21A0F6A0)  [ RUN      ] 
LibYUVConvertTest.I420ToABGR_Opt
I  118.029s run_tests_on_device(21A0F6A0)  [       OK ] 
LibYUVConvertTest.I420ToABGR_Opt (2848 ms)
I  118.029s run_tests_on_device(21A0F6A0)  [ RUN      ] 
LibYUVConvertTest.I420ToARGB1555_Opt
I  118.029s run_tests_on_device(21A0F6A0)  [       OK ] 
LibYUVConvertTest.I420ToARGB1555_Opt (4384 ms)
I  118.029s run_tests_on_device(21A0F6A0)  [ RUN      ] 
LibYUVConvertTest.I420ToARGB4444_Opt
I  118.029s run_tests_on_device(21A0F6A0)  [       OK ] 
LibYUVConvertTest.I420ToARGB4444_Opt (3717 ms)
I  118.029s run_tests_on_device(21A0F6A0)  [ RUN      ] 
LibYUVConvertTest.I420AlphaToARGB_Opt
I  118.029s run_tests_on_device(21A0F6A0)  [       OK ] 
LibYUVConvertTest.I420AlphaToARGB_Opt (47744 ms)
I  118.029s run_tests_on_device(21A0F6A0)  [ RUN      ] 
LibYUVConvertTest.I420AlphaToABGR_Opt
I  118.029s run_tests_on_device(21A0F6A0)  [       OK ] 
LibYUVConvertTest.I420AlphaToABGR_Opt (51709 ms)
I  118.029s run_tests_on_device(21A0F6A0)  [----------] 6 tests from 
LibYUVConvertTest (113164 ms total)
I  118.029s run_tests_on_device(21A0F6A0)  
I  118.029s run_tests_on_device(21A0F6A0)  [----------] Global test environment 
tear-down
I  118.029s run_tests_on_device(21A0F6A0)  [==========] 6 tests from 1 test 
case ran. (113165 ms total)
I  118.030s run_tests_on_device(21A0F6A0)  [  PASSED  ] 6 tests.

Original comment by fbarch...@google.com on 28 Oct 2015 at 11:04

GoogleCodeExporter commented 8 years ago
debug builds ok:
GYP_DEFINES="OS=android target_arch=ia32" GYP_CROSSCOMPILE=1 ./gyp_libyuv 
ninja -v -d keeprsp -C out/Debug libyuv_unittest_apk

/usr/local/google/home/fbarchard/src/libyuva/libyuv/third_party/android_tools/nd
k//toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-g++ -MMD -MF 
obj/source/libyuv.row_gcc.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 
-D_FILE_OFFSET_BITS=64 -DNO_TCMALLOC -DDISABLE_NACL -DCHROMIUM_BUILD 
-DCR_CLANG_REVISION=247874-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_WEBRTC=1 
-DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_BROWSER_CDMS 
-DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS 
-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA 
-DFIELDTRIAL_TESTING_ENABLED -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_PRINTING=1 
-DENABLE_BASIC_PRINTING=1 -DENABLE_SPELLCHECK=1 -DUSE_BROWSER_SPELLCHECKER=1 
-DENABLE_SUPERVISED_USERS=1 -DVIDEO_HOLE=1 -DV8_USE_EXTERNAL_STARTUP_DATA 
-DENABLE_WEBVR -DSAFE_BROWSING_DB_REMOTE -DHAVE_JPEG -DUSE_LIBPCI=1 
-DUSE_OPENSSL=1 -DUSE_OPENSSL_CERTS=1 -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -DANDROID -D__GNU_SOURCE=1 '-DCHROME_BUILD_ID=""' 
-DHAVE_SYS_UIO_H -DDYNAMIC_ANNOTATIONS_ENABLED=1 
-DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -Igen -I../../include -I../.. 
-I../../chromium/src/third_party/libjpeg_turbo --param=ssp-buffer-size=4 
-Werror -fno-strict-aliasing -Wall -Wno-unused-parameter 
-Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC 
-Wno-unused-local-typedefs -msse2 -mfpmath=sse -mmmx -m32 -mstackrealign 
-ffunction-sections -funwind-tables -g -fno-short-enums -finline-limit=64 
--sysroot=../../third_party/android_tools/ndk//platforms/android-16/arch-x86 
-isystem../../third_party/android_tools/ndk//sources/cxx-stl/llvm-libc++/libcxx/
include 
-isystem../../third_party/android_tools/ndk//sources/cxx-stl/llvm-libc++abi/libc
xxabi/include 
-isystem../../third_party/android_tools/ndk//sources/android/support/include 
-fno-stack-protector -Os -g -fdata-sections -ffunction-sections 
-fomit-frame-pointer -funwind-tables -fno-exceptions -fno-rtti 
-fno-threadsafe-statics -fvisibility-inlines-hidden -Wsign-compare -std=gnu++11 
-Wno-narrowing -Wno-literal-suffix  -c ../../source/row_gcc.cc -o 
obj/source/libyuv.row_gcc.o

full debug fails:
GYP_DEFINES="OS=android target_arch=ia32 android_full_debug=1" 
GYP_CROSSCOMPILE=1 ./gyp_libyuv 
ninja -v -d keeprsp -C out/Debug libyuv_unittest_apk
/usr/local/google/home/fbarchard/src/libyuva/libyuv/third_party/android_tools/nd
k//toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-g++ -MMD -MF 
obj/source/libyuv.row_gcc.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 
-D_FILE_OFFSET_BITS=64 -DNO_TCMALLOC -DDISABLE_NACL -DCHROMIUM_BUILD 
-DCR_CLANG_REVISION=247874-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_WEBRTC=1 
-DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_BROWSER_CDMS 
-DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS 
-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA 
-DFIELDTRIAL_TESTING_ENABLED -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_PRINTING=1 
-DENABLE_BASIC_PRINTING=1 -DENABLE_SPELLCHECK=1 -DUSE_BROWSER_SPELLCHECKER=1 
-DENABLE_SUPERVISED_USERS=1 -DVIDEO_HOLE=1 -DV8_USE_EXTERNAL_STARTUP_DATA 
-DENABLE_WEBVR -DSAFE_BROWSING_DB_REMOTE -DHAVE_JPEG -DUSE_LIBPCI=1 
-DUSE_OPENSSL=1 -DUSE_OPENSSL_CERTS=1 -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -DANDROID -D__GNU_SOURCE=1 '-DCHROME_BUILD_ID=""' 
-DHAVE_SYS_UIO_H -DDYNAMIC_ANNOTATIONS_ENABLED=1 
-DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -Igen -I../../include -I../.. 
-I../../chromium/src/third_party/libjpeg_turbo --param=ssp-buffer-size=4 
-Werror -fno-strict-aliasing -Wall -Wno-unused-parameter 
-Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC 
-Wno-unused-local-typedefs -msse2 -mfpmath=sse -mmmx -m32 -mstackrealign 
-ffunction-sections -funwind-tables -g -fno-short-enums -finline-limit=64 
--sysroot=../../third_party/android_tools/ndk//platforms/android-16/arch-x86 
-isystem../../third_party/android_tools/ndk//sources/cxx-stl/llvm-libc++/libcxx/
include 
-isystem../../third_party/android_tools/ndk//sources/cxx-stl/llvm-libc++abi/libc
xxabi/include 
-isystem../../third_party/android_tools/ndk//sources/android/support/include 
-fno-stack-protector -O0 -g -funwind-tables -fno-exceptions -fno-rtti 
-fno-threadsafe-statics -fvisibility-inlines-hidden -Wsign-compare -std=gnu++11 
-Wno-narrowing -Wno-literal-suffix  -c ../../source/row_gcc.cc -o 
obj/source/libyuv.row_gcc.o

Original comment by fbarch...@google.com on 29 Oct 2015 at 1:27

GoogleCodeExporter commented 8 years ago

Original comment by fbarch...@google.com on 29 Oct 2015 at 6:24

GoogleCodeExporter commented 8 years ago
This appears to be a compiler bug
The code builds ok in debug build, with -fomit-frame-pointer 
android_full_debug=1 doesnt do that, but adding it, and the build works.
The function has __attribute__((optimize("omit-frame-pointer"))) which works if 
compiled with -O1, or works with -O0 if 5 or less registers are used - the ebp 
stack frame is not generated and ebp (and ebx) are not used.  But with 6 
registers the error is generated: error: 'asm' operand has impossible 
constraints
row.h changed to disable I422AlphaToARGBRow_SSSE3 for 32 bit debug gcc.
64 bit and Visual C /clangcl will still work.
So far no good/easy way found to use ebx or ebp.
1. gyp could enable -O1
2. the function could be written in asm with a label, similar to rotate 
functions.
Could test different versions of compilers to see if its fixed in clang or 
other gcc versions.

Original comment by fbarch...@google.com on 29 Oct 2015 at 6:32

GoogleCodeExporter commented 8 years ago
Interesting. felixe here tried to get the optimize attribute to work but never 
figured out why it had no effect. So it only works in certain optimization 
modes...

Yes, I do consider this a compiler problem but reading gcc bug reports gcc 
developers explicitly stated that it was not a goal to handle extreme 
low-register situations so it might not be high priority to change anything.

Original comment by brat...@opera.com on 30 Oct 2015 at 8:39

GoogleCodeExporter commented 8 years ago
Issue 532 has been merged into this issue.

Original comment by fbarch...@google.com on 10 Dec 2015 at 11:36

GoogleCodeExporter commented 8 years ago
This issue came up again on a different build system which did not set _DEBUG.
Changing it to DEBUG seems to work for gyp builds.

clangcl would technically have the same issue except
1. fpic is not used, so ebx is free.
2. 32 bits use row_win.cc not row_gcc.cc
Two functions are affected and disabled for DEBUG 32 bit, but enabled for 
release, 64 bit and/or clangcl.

No good compiler work around, so closing as fixed.  Reopen if better solution 
found.

Original comment by fbarch...@google.com on 10 Dec 2015 at 11:40

GoogleCodeExporter commented 8 years ago

Original comment by fbarch...@google.com on 19 Jan 2016 at 11:04

GoogleCodeExporter commented 8 years ago
This regressed on an invalid configuration where a debug build did not set any 
flags.  May want to followup by disabling the assembly for 32 bit builds, to 
avoid future breakage.  As we transition to 64 bit, the 32 bit performance is 
less important.
Ideally the compiler would be improved to allow ebx and ebp to be used.

Original comment by fbarch...@google.com on 25 Jan 2016 at 11:44