Re: [FFmpeg-devel] [PATCH] avutil: disable arch specific intmath routines if optimizations are disabled
On 02/17/2016 03:19 AM, Hendrik Leppkes wrote: > On Tue, Feb 16, 2016 at 4:00 PM, Yu Xiaolei wrote: >> On Tue, Feb 16, 2016 at 9:01 PM, Michael Niedermayer >> wrote: >> >>> On Tue, Feb 16, 2016 at 02:40:10PM +0800, Xiaolei Yu wrote: Current intmath routines for arm require inter-procedure constant >>> propagation and fail to compile when optimizations are disabled. --- configure | 1 + libavutil/intmath.h | 2 ++ 2 files changed, 3 insertions(+) >>> >>> on arm without opts and this patch i get >>> src/libavcodec/arm/aac.h: In function ‘VMUL4S’: >>> src/libavcodec/arm/aac.h:102:5: error: can't find a register in class >>> ‘LO_REGS’ while reloading ‘asm’ >>> src/libavcodec/arm/aac.h:102:5: error: ‘asm’ operand has impossible >>> constraints >>> make: *** [libavcodec/aacdec.o] Error 1 >>> >>> >> This error seems unrelated to the patch, but I am not sure as I am only >> building some selected codecs. >> Can you build again without the patch? >> >> Without the patch I get: >> In file included from src/libavutil/intmath.h:30:0, >> from src/libavutil/common.h:106, >> from src/libavutil/avutil.h:288, >> from src/libavutil/samplefmt.h:24, >> from src/libavcodec/avcodec.h:31, >> from src/libavcodec/internal.h:33, >> from src/libavcodec/h264_direct.c:28: >> src/libavutil/arm/intmath.h: In function 'get_scale_factor': >> src/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn't >> match constraints >> __asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1)); >> ^ >> src/libavutil/arm/intmath.h:69:5: error: impossible constraint in 'asm' >> >> on x86 build passes with and without the patch here >>> with what compiler is this needed ? >>> >>> >> Yes, x86 builds fine without this patch. But the underlying problem is not >> arch specific and may be encountered in other inline asm. I think current >> patch is more consistent if we consider these routines as manual >> optimizations. >> > > --disable-optimization is just meant to disable compiler optimizations > so that debugging is easier, its not meant to disable any kind of > hand-written ASM, this may even be a target of the debugging in some > cases. > If one wanted to get rid of all ASM, there are other options for that. > Point taken. I will post a new patch that only disables these two functions. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: disable arch specific intmath routines if optimizations are disabled
On Tue, Feb 16, 2016 at 4:00 PM, Yu Xiaolei wrote: > On Tue, Feb 16, 2016 at 9:01 PM, Michael Niedermayer > wrote: > >> On Tue, Feb 16, 2016 at 02:40:10PM +0800, Xiaolei Yu wrote: >> > Current intmath routines for arm require inter-procedure constant >> propagation >> > and fail to compile when optimizations are disabled. >> > --- >> > configure | 1 + >> > libavutil/intmath.h | 2 ++ >> > 2 files changed, 3 insertions(+) >> >> on arm without opts and this patch i get >> src/libavcodec/arm/aac.h: In function ‘VMUL4S’: >> src/libavcodec/arm/aac.h:102:5: error: can't find a register in class >> ‘LO_REGS’ while reloading ‘asm’ >> src/libavcodec/arm/aac.h:102:5: error: ‘asm’ operand has impossible >> constraints >> make: *** [libavcodec/aacdec.o] Error 1 >> >> > This error seems unrelated to the patch, but I am not sure as I am only > building some selected codecs. > Can you build again without the patch? > > Without the patch I get: > In file included from src/libavutil/intmath.h:30:0, > from src/libavutil/common.h:106, > from src/libavutil/avutil.h:288, > from src/libavutil/samplefmt.h:24, > from src/libavcodec/avcodec.h:31, > from src/libavcodec/internal.h:33, > from src/libavcodec/h264_direct.c:28: > src/libavutil/arm/intmath.h: In function 'get_scale_factor': > src/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn't > match constraints > __asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1)); > ^ > src/libavutil/arm/intmath.h:69:5: error: impossible constraint in 'asm' > > on x86 build passes with and without the patch here >> with what compiler is this needed ? >> >> > Yes, x86 builds fine without this patch. But the underlying problem is not > arch specific and may be encountered in other inline asm. I think current > patch is more consistent if we consider these routines as manual > optimizations. > --disable-optimization is just meant to disable compiler optimizations so that debugging is easier, its not meant to disable any kind of hand-written ASM, this may even be a target of the debugging in some cases. If one wanted to get rid of all ASM, there are other options for that. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: disable arch specific intmath routines if optimizations are disabled
On Tue, Feb 16, 2016 at 11:00:38PM +0800, Yu Xiaolei wrote: > On Tue, Feb 16, 2016 at 9:01 PM, Michael Niedermayer > wrote: > > > On Tue, Feb 16, 2016 at 02:40:10PM +0800, Xiaolei Yu wrote: > > > Current intmath routines for arm require inter-procedure constant > > propagation > > > and fail to compile when optimizations are disabled. > > > --- > > > configure | 1 + > > > libavutil/intmath.h | 2 ++ > > > 2 files changed, 3 insertions(+) > > > > on arm without opts and this patch i get > > src/libavcodec/arm/aac.h: In function ‘VMUL4S’: > > src/libavcodec/arm/aac.h:102:5: error: can't find a register in class > > ‘LO_REGS’ while reloading ‘asm’ > > src/libavcodec/arm/aac.h:102:5: error: ‘asm’ operand has impossible > > constraints > > make: *** [libavcodec/aacdec.o] Error 1 > > > > > This error seems unrelated to the patch, but I am not sure as I am only > building some selected codecs. > Can you build again without the patch? > > Without the patch I get: > In file included from src/libavutil/intmath.h:30:0, > from src/libavutil/common.h:106, > from src/libavutil/avutil.h:288, > from src/libavutil/samplefmt.h:24, > from src/libavcodec/avcodec.h:31, > from src/libavcodec/internal.h:33, > from src/libavcodec/h264_direct.c:28: > src/libavutil/arm/intmath.h: In function 'get_scale_factor': > src/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn't > match constraints > __asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1)); > ^ > src/libavutil/arm/intmath.h:69:5: error: impossible constraint in 'asm' yes, its worse without teh patch > > on x86 build passes with and without the patch here > > with what compiler is this needed ? > > > > > Yes, x86 builds fine without this patch. But the underlying problem is not > arch specific and may be encountered in other inline asm. I think current > patch is more consistent if we consider these routines as manual > optimizations. i dont uderstand the problem is specific to 2 arm asm functions you disable all intmath arm functions you disable all intmath x86 functions (none use the immedeate operand so cannot be affected) you leave all other x86 and arm functions enabled I think the 2 affected functions should be put under #if there should be no need to disable anything else its just the functions that use the immedeate operand which fail id assume [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I know you won't believe me, but the highest form of Human Excellence is to question oneself and others. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: disable arch specific intmath routines if optimizations are disabled
On Tue, Feb 16, 2016 at 9:01 PM, Michael Niedermayer wrote: > On Tue, Feb 16, 2016 at 02:40:10PM +0800, Xiaolei Yu wrote: > > Current intmath routines for arm require inter-procedure constant > propagation > > and fail to compile when optimizations are disabled. > > --- > > configure | 1 + > > libavutil/intmath.h | 2 ++ > > 2 files changed, 3 insertions(+) > > on arm without opts and this patch i get > src/libavcodec/arm/aac.h: In function ‘VMUL4S’: > src/libavcodec/arm/aac.h:102:5: error: can't find a register in class > ‘LO_REGS’ while reloading ‘asm’ > src/libavcodec/arm/aac.h:102:5: error: ‘asm’ operand has impossible > constraints > make: *** [libavcodec/aacdec.o] Error 1 > > This error seems unrelated to the patch, but I am not sure as I am only building some selected codecs. Can you build again without the patch? Without the patch I get: In file included from src/libavutil/intmath.h:30:0, from src/libavutil/common.h:106, from src/libavutil/avutil.h:288, from src/libavutil/samplefmt.h:24, from src/libavcodec/avcodec.h:31, from src/libavcodec/internal.h:33, from src/libavcodec/h264_direct.c:28: src/libavutil/arm/intmath.h: In function 'get_scale_factor': src/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn't match constraints __asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1)); ^ src/libavutil/arm/intmath.h:69:5: error: impossible constraint in 'asm' on x86 build passes with and without the patch here > with what compiler is this needed ? > > Yes, x86 builds fine without this patch. But the underlying problem is not arch specific and may be encountered in other inline asm. I think current patch is more consistent if we consider these routines as manual optimizations. The code __asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1)) is in fact illegal as the bit position (p+1) is not a compile time constant. The compiler can emit code only because p is known after constant propagation. I am using gcc-4.9 shipped by android ndk r10e. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: disable arch specific intmath routines if optimizations are disabled
On Tue, Feb 16, 2016 at 02:40:10PM +0800, Xiaolei Yu wrote: > Current intmath routines for arm require inter-procedure constant propagation > and fail to compile when optimizations are disabled. > --- > configure | 1 + > libavutil/intmath.h | 2 ++ > 2 files changed, 3 insertions(+) on arm without opts and this patch i get src/libavcodec/arm/aac.h: In function ‘VMUL4S’: src/libavcodec/arm/aac.h:102:5: error: can't find a register in class ‘LO_REGS’ while reloading ‘asm’ src/libavcodec/arm/aac.h:102:5: error: ‘asm’ operand has impossible constraints make: *** [libavcodec/aacdec.o] Error 1 on x86 build passes with and without the patch here with what compiler is this needed ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avutil: disable arch specific intmath routines if optimizations are disabled
Current intmath routines for arm require inter-procedure constant propagation and fail to compile when optimizations are disabled. --- configure | 1 + libavutil/intmath.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/configure b/configure index 2148f11..70e0161 100755 --- a/configure +++ b/configure @@ -1950,6 +1950,7 @@ HAVE_LIST=" $THREADS_LIST $TOOLCHAIN_FEATURES $TYPES_LIST +optimizations atomics_native dos_paths dxva2_lib diff --git a/libavutil/intmath.h b/libavutil/intmath.h index 9573109..d15f210 100644 --- a/libavutil/intmath.h +++ b/libavutil/intmath.h @@ -26,12 +26,14 @@ #include "config.h" #include "attributes.h" +#if HAVE_OPTIMIZATIONS #if ARCH_ARM # include "arm/intmath.h" #endif #if ARCH_X86 # include "x86/intmath.h" #endif +#endif #if HAVE_FAST_CLZ #if AV_GCC_VERSION_AT_LEAST(3,4) -- 2.7.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel