shshankjain / webm

Automatically exported from code.google.com/p/webm
0 stars 0 forks source link

Error Segmentation fault when run encode with VP8 on QEMU for ARM linux #167

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello everybody,
I am porting VP8 (libvpx 0.9.1) on QEMU(version 0.12.5,) for ARM contex A9,
I built ARM linux kernel and run well on QEMU. Now I want build VP8 for ARM to 
run on QEMU, I cross-compile VP8 for ARM(context A9) linux successfully with 
commands
  $./configure --target=armv7-linux-gcc --prefix=/local/simulation/
  $make
  $make install
 and run them on QEMU, When QEMU run, I trying encode a YUV file, but when I run encode with in the following command:
  $./ivfenc input.yuv output.ivf --i420 -w 176 -h 144 --good
then QEMU exited immediately and on Terminal showed error: Segmentation fault.
The input.yuv file is 3.5Mb, I encoded it successfully on I386 with above 
command but on QEMU I can't do it, I think have a conflict about memory between 
QEMU and libvpx. 
 Readly, I can't exactly about the error and I don't know how to fix it, please help me,
Thanks,

Original issue reported on code.google.com by phamvant...@gmail.com on 27 Aug 2010 at 1:46

GoogleCodeExporter commented 9 years ago
Have you tested on real hardware at all? Can you make input.yuv available? I 
have successfully run armv6 in qemu but not armv7. Can you write a sample 
application which uses armv7 instructions to see if qemu is capable of 
executing them?

Original comment by johannkoenig@google.com on 27 Aug 2010 at 2:04

GoogleCodeExporter commented 9 years ago
qemu is known to crash on complex neon code and libvpx makes use of neon a 
lot....

Original comment by vlado...@gmail.com on 27 Aug 2010 at 2:05

GoogleCodeExporter commented 9 years ago
I build other for armv7 on QEMU and they run ok, but VP8 it not. 

Original comment by phamvant...@gmail.com on 27 Aug 2010 at 2:19

GoogleCodeExporter commented 9 years ago
Is the other stuff you build using NEON instructions? To find out, run objdump 
and look for instructions that start with a v:

arm-none-linux-gnueabi-objdump -D libvpx.a | cut -f3 | grep ^v

Original comment by johannkoenig@google.com on 27 Aug 2010 at 2:26

GoogleCodeExporter commented 9 years ago
as said, it is not armv7 that fails qemu, but (complex) neon code. I tried once 
to use qemu for neon and gave up quickly after somebody from arm told me that 
it does not work... neon patches to qemu were supposed to be "in the works", I 
have no idea what has happened since then.

Original comment by vlado...@gmail.com on 27 Aug 2010 at 4:11

GoogleCodeExporter commented 9 years ago
If you'd like to work on arm with qemu, please use armv6. Otherwise, raise a 
bug with qemu

Original comment by johannkoenig@google.com on 27 Aug 2010 at 4:45

GoogleCodeExporter commented 9 years ago
Thanks for your comment. I built VP8 for ARMv6 and it run successful. But I 
still want to build it on ARMv7. I also learn about NEON instructions and have 
many people say that QEMU don't support some instructions of cortex-a9, but I 
don't sure. I run debug but I still can't sure that QEMU don't support some 
instructions, yes, no?. Can you say the instructions for me? and can I fix them?

Original comment by phamvant...@gmail.com on 7 Sep 2010 at 4:53

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You can build it for v6 and get it linking and running, then just swap out the 
library for the v7 one when you have actual hardware. The libraries and their 
interfaces are functionally identical. It's not worth working around qemu bugs 
to make it run in an emulator. It will run correctly on cortex-a9 hardware. If 
it doesn't, I will be more than happy to fix it.

Original comment by johannkoenig@google.com on 7 Sep 2010 at 5:54

GoogleCodeExporter commented 9 years ago
Thank you!
When I built it for armv6 it ran, and I also made encode and decode 
successfully and I also can calculate performance for armv6 but I can't 
calculate performance of it for cortex-a9 when I can't built it for armv7, 
moreover each arm version will have different instructions, so performance for 
VP8 that will difference for each arm verion. Now I want to calculate 
performance for it on cortex-a9. How must I do? I also find a patch for QEMU to 
fix it but I was not successful. I also want ask you more the differance about 
performance of VP8 on each arm version 

Original comment by phamvant...@gmail.com on 8 Sep 2010 at 1:57

GoogleCodeExporter commented 9 years ago
You can't use QEMU to make performance measurements. An ordinary emulator does 
not model the execution time of individual instructions or pipeline stalls, 
etc. You need a cycle accurate simulator to do this. We've used the one that 
ARM sells with their Real View Development Suite, which can model any ARM core 
you'd like to use, and does properly support the NEON instructions used in 
libvpx.

Original comment by jkoles...@google.com on 8 Sep 2010 at 11:22

GoogleCodeExporter commented 9 years ago
I think I will use a tool to calculate PSNR for it, so I only use qemu to run 
encode and decode for an input file then I will get output file to calculate 
PSNR.If I modify NEON instrutions by use other instructions to runit on qemu 
successdful then is the performance for vp8 has change?

Original comment by phamvant...@gmail.com on 9 Sep 2010 at 3:44

GoogleCodeExporter commented 9 years ago
It might help to know what your intended application is.

The instructions don't affect quality (PSNR) directly. You should get the same 
output for armv6 and armv7 (and x86) for a given set of conditions. You could 
use QEMU in this case, since you don't care about speed, you only care about 
whether the output is correct. It's unfortunate that QEMU doesn't support our 
NEON code right now, as I'd like to use it for this sort of testing too.

Things are slightly different in real-time mode. In this case, the speed the 
encoder runs at affects the complexity it chooses, which affects the quality. 
In this case, you can't use QEMU, you need to use a simulator.

If you modify the libvpx assembly code, that will affect the performance.

Original comment by jkoles...@google.com on 9 Sep 2010 at 12:11

GoogleCodeExporter commented 9 years ago
Thank for your reply, I losed some days to run debug on VP8, and I knew that 
when VP8 run to the instructions:
  Cp_width_128_loop
  Vld1.8 {q0, q1}
  Vld1.8 {q4, q5}
In the vp8_vpxyv12_copysrcframe_func_neon.asm file then QEMU will stop.Now, I 
want to know exactly what are VP8 NEON instructions that QEMU's not support. 
Can you send for me all neon instructions on VP8 that QEMU's not support?

Original comment by phamvant...@gmail.com on 13 Sep 2010 at 3:30

GoogleCodeExporter commented 9 years ago
Without knowing what you're trying to accomplish, I don't have much advice for 
you.

It seems very unusual that qemu would have trouble with the vld instructions. 
You will probably get better answers on a qemu mailing list though.

Original comment by johannkoenig@google.com on 13 Sep 2010 at 5:19