[PATCH] D87188: [InstCombine] Canonicalize SPF to abs intrinc

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 04:11:29 PST 2020


mstorsjo added a comment.

In D87188#2461510 <https://reviews.llvm.org/D87188#2461510>, @mstorsjo wrote:

> In D87188#2461497 <https://reviews.llvm.org/D87188#2461497>, @lebedev.ri wrote:
>
>> @mstorsjo i've bothered @dmajor to give this a try on some of mozilla's CI, and unfortunately it came back green..
>> I don't recall if i can reproduce it locally (on vanilla test suite, i'll recheck),
>> but right now it would seem that you are the only one who can reproduce this :/
>>
>> Were you able to make any progress on a somewhat more actionable reproducer?
>>
>> What would be really helpful is a standalone source that can be compiled and run (here by be locally, on linux x86_64)
>> that produces different result with/without this change.
>
> IIRC I'm only able to reproduce this for aarch64 (and possibly arm) targets unfortunately. I can make a kind of standalone testcase with one single file built from source, linked and executed along with a bigger piece of code (either from source or prebuilt object files), but it'd be for aarch64-linux (or aarch64-darwin if that helps - I haven't tried reproducing it there but I'd presume it behaves the same as I noticed the bug first on aarch64 windows).

Ok, here's a reproduction environment, requiring aarch64 linux (tested on ubuntu 18.04, but anything similar or newer should be fine, and AWS and other cloud providers makes it fairly easy to spin up such an instance) - with https://martin.st/temp/ffmpeg-repro.zip downloaded and unzipped:

  $ gcc -c vc1_block-debug.c -o vc1_block-debug.o
  $ gcc *.o -Wl,--start-group *.a -Wl,--end-group -o ffmpeg -lm -lpthread -lz
  $ ./ffmpeg -v quiet -i SA00040.vc1 -f framecrc -
  #software: Lavf58.65.100
  #tb 0: 1/25
  #media_type 0: video
  #codec_id 0: rawvideo
  #dimensions 0: 176x144
  #sar 0: 1/1
  0,          0,          0,        1,    38016, 0xa6f15db5
  0,          1,          1,        1,    38016, 0xa6f15db5
  0,          2,          2,        1,    38016, 0xa6f15db5
  0,          4,          4,        1,    38016, 0x5c4ef0e7
  0,          5,          5,        1,    38016, 0x53a42d1d
  0,          6,          6,        1,    38016, 0x68f7d89e
  0,          7,          7,        1,    38016, 0xc15f4368
  0,          8,          8,        1,    38016, 0xc15f4368
  0,          9,          9,        1,    38016, 0xd1bd47a8
  0,         10,         10,        1,    38016, 0xd1bd47a8
  0,         11,         11,        1,    38016, 0xe1e821ca
  0,         12,         12,        1,    38016, 0xe1e821ca
  0,         13,         13,        1,    38016, 0xe1e821ca
  0,         14,         14,        1,    38016, 0xe1e821ca
  0,         15,         15,        1,    38016, 0xe1e821ca
  $ clang -c vc1_block-debug.c -o vc1_block-debug.o -O2 # Recompile the problematic function with clang with this patch included
  $ gcc *.o -Wl,--start-group *.a -Wl,--end-group -o ffmpeg -lm -lpthread -lz
  $ ./ffmpeg -v quiet -i SA00040.vc1 -f framecrc -
  #software: Lavf58.65.100
  #tb 0: 1/25
  #media_type 0: video
  #codec_id 0: rawvideo
  #dimensions 0: 176x144
  #sar 0: 1/1
  0,          0,          0,        1,    38016, 0xa6f15db5
  0,          1,          1,        1,    38016, 0xa6f15db5
  0,          2,          2,        1,    38016, 0xa6f15db5
  0,          4,          4,        1,    38016, 0x5c4ef0e7
  0,          5,          5,        1,    38016, 0x53a42d1d
  0,          6,          6,        1,    38016, 0x68f7d89e
  0,          7,          7,        1,    38016, 0xc15f4368
  0,          8,          8,        1,    38016, 0xc15f4368
  0,          9,          9,        1,    38016, 0xd1bd47a8
  0,         10,         10,        1,    38016, 0xd1bd47a8
  0,         11,         11,        1,    38016, 0x3bf00b9a # The hashes from here onwards differ
  0,         12,         12,        1,    38016, 0x3bf00b9a
  0,         13,         13,        1,    38016, 0x3bf00b9a
  0,         14,         14,        1,    38016, 0x3bf00b9a
  0,         15,         15,        1,    38016, 0x3bf00b9a

Alternative repro, fully from source:

  $ git clone https://github.com/mstorsjo/ffmpeg.git
  $ cd ffmpeg
  $ git checkout origin/vc1-debug 
  $ mkdir ../ffmpeg-build; cd ../ffmpeg-build
  $ ../ffmpeg/configure --disable-everything --enable-decoder=vc1 --enable-demuxer=vc1 --enable-encoder=rawvideo --enable-muxer=framecrc --enable-protocol=file --enable-protocol=pipe --enable-parser=vc1 --enable-bsf=extract_extradata --samples=$(pwd)/../samples
  $ make -j$(nproc)
  $ make fate-rsync # Fetch reference test samples
  $ make fate-vc1 # Succeeds
  $ clang -c ../ffmpeg/libavcodec/vc1_block-debug.c -o libavcodec/vc1_block-debug.o -O3 -I../ffmpeg -I. # Recompile the problematic function with clang with this patch included
  $ make fate-vc1 # Fails
  TEST    vc1_sa00040
  --- /home/ubuntu/code/ffmpeg/tests/ref/fate/vc1_sa00040	2020-12-18 12:04:27.216500325 +0000
  +++ tests/data/fate/vc1_sa00040	2020-12-18 12:10:33.352940826 +0000
  @@ -13,8 +13,8 @@
   0,          8,          8,        1,    38016, 0xc15f4368
   0,          9,          9,        1,    38016, 0xd1bd47a8
   0,         10,         10,        1,    38016, 0xd1bd47a8
  -0,         11,         11,        1,    38016, 0xe1e821ca
  -0,         12,         12,        1,    38016, 0xe1e821ca
  -0,         13,         13,        1,    38016, 0xe1e821ca
  -0,         14,         14,        1,    38016, 0xe1e821ca
  -0,         15,         15,        1,    38016, 0xe1e821ca
  +0,         11,         11,        1,    38016, 0x3bf00b9a
  +0,         12,         12,        1,    38016, 0x3bf00b9a
  +0,         13,         13,        1,    38016, 0x3bf00b9a
  +0,         14,         14,        1,    38016, 0x3bf00b9a
  +0,         15,         15,        1,    38016, 0x3bf00b9a
  Test vc1_sa00040 failed. Look at tests/data/fate/vc1_sa00040.err for details.
  /home/ubuntu/code/ffmpeg/tests/Makefile:255: recipe for target 'fate-vc1_sa00040' failed
  make: *** [fate-vc1_sa00040] Error 1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87188/new/

https://reviews.llvm.org/D87188



More information about the llvm-commits mailing list