Skip to content

isaspec: Rework decoder

Christian Gmeiner requested to merge austriancoder/mesa:isapsec-fix-decoder into main

What does this MR do and why?

I have run into some issues with the decoder when mesa is build with freedreno and etnaviv.

Lets have a look at the baseline disasm output of an example shader (seen in deqp).

000 [0081103c 00000800 bb306850 00000000] no match: 000008000081103c
001 [60000850 00000007 bb306850 00000001] no match: 0000000760000850
002 [00811001 00001800 bb306850 00000002] no match: 0000180000811001
003 [40000000 78000408 bb306850 00000003] no match: 7800040840000000
004 [07811032 39201800 bb306850 00000004] no match: 3920180007811032
005 [80020040 00000002 bb306850 00000005] no match: 0000000280020040
006 [0082103c 2a800800 bb306850 00000006] no match: 2a8008000082103c
007 [60000850 00000007 bb306850 00000007] no match: 0000000760000850
008 [00821001 00002800 bb306850 00000008] no match: 0000280000821001
009 [40000000 78000408 bb306850 00000009] no match: 7800040840000000
010 [07821032 39202800 bb306850 0000000a] no match: 3920280007821032
011 [80020040 00000002 bb306850 0000000b] no match: 0000000280020040
012 [07811001 39001800 bb306850 0000000c] no match: 3900180007811001
013 [00000000 00390028 bb306850 0000000d] no match: 0039002800000000
014 [0082103c 3fc00800 bb306850 0000000e] no match: 3fc008000082103c
015 [60000850 00000007 bb306850 0000000f] no match: 0000000760000850
016 [00821001 00002800 bb306850 00000010] no match: 0000280000821001
017 [40000000 78000408 bb306850 00000011] no match: 7800040840000000
018 [07821032 39202800 bb306850 00000012] no match: 3920280007821032
019 [80020040 00000002 bb306850 00000013] no match: 0000000280020040
020 [07811001 39001800 bb306850 00000014] no match: 3900180007811001
021 [00000000 00390028 bb306850 00000015] no match: 0039002800000000
022 [0082103c 00001800 bb306850 00000016] no match: 000018000082103c
023 [60000850 00000007 bb306850 00000017] no match: 0000000760000850
024 [00821001 00002800 bb306850 00000018] no match: 0000280000821001
025 [40000000 78000408 bb306850 00000019] no match: 7800040840000000
026 [07821032 39202800 bb306850 0000001a] no match: 3920280007821032
027 [80020040 00000002 bb306850 0000001b] no match: 0000000280020040
028 [07811001 39001800 bb306850 0000001c] no match: 3900180007811001
029 [00000000 00390028 bb306850 0000001d] no match: 0039002800000000

The output is wrong in multiple ways:

  • number of instructions is wrong
  • pre_instr_cb(..) output is wrong bb306850 000000XX
  • no matches

With commit isaspec: deocde: Remove generic functions from public interface we are getting this output:

000 [0081103c 00000800 60000850 00000007] no match: 0000000760000850000008000081103c
001 [00811001 00001800 40000000 78000408] no match: 78000408400000000000180000811001
002 [07811032 39201800 80020040 00000002] no match: 00000002800200403920180007811032
003 [0082103c 2a800800 60000850 00000007] no match: 00000007600008502a8008000082103c
004 [00821001 00002800 40000000 78000408] no match: 78000408400000000000280000821001
005 [07821032 39202800 80020040 00000002] no match: 00000002800200403920280007821032
006 [07811001 39001800 00000000 00390028] no match: 00390028000000003900180007811001
007 [0082103c 3fc00800 60000850 00000007] no match: 00000007600008503fc008000082103c
008 [00821001 00002800 40000000 78000408] no match: 78000408400000000000280000821001
009 [07821032 39202800 80020040 00000002] no match: 00000002800200403920280007821032
010 [07811001 39001800 00000000 00390028] no match: 00390028000000003900180007811001
011 [0082103c 00001800 60000850 00000007] no match: 0000000760000850000018000082103c
012 [00821001 00002800 40000000 78000408] no match: 78000408400000000000280000821001
013 [07821032 39202800 80020040 00000002] no match: 00000002800200403920280007821032
014 [07811001 39001800 00000000 00390028] no match: 00390028000000003900180007811001

The output is much better but we sill have no matches.

With the last commit - isaspec: deocde: Make isa_bitset arrays static we are seeing the expected output.

000 [0081103c 00000800 60000850 00000007] imullo0.s32.pack  t1.x___, u0.xxxx, 16, void
001 [00811001 00001800 40000000 78000408] add.s32.pack      t1.x___, t1.xxxx, void, 64
002 [07811032 39201800 80020040 00000002] load.u32.pack     t1, t1.xyzw, u0.yxxx, void
003 [0082103c 2a800800 60000850 00000007] imullo0.s32.pack  t2.x___, u0.zzzz, 16, void
004 [00821001 00002800 40000000 78000408] add.s32.pack      t2.x___, t2.xxxx, void, 64
005 [07821032 39202800 80020040 00000002] load.u32.pack     t2, t2.xyzw, u0.yxxx, void
006 [07811001 39001800 00000000 00390028] add.pack          t1, t1.xyzw, void, t2.xyzw
007 [0082103c 3fc00800 60000850 00000007] imullo0.s32.pack  t2.x___, u0.wwww, 16, void
008 [00821001 00002800 40000000 78000408] add.s32.pack      t2.x___, t2.xxxx, void, 64
009 [07821032 39202800 80020040 00000002] load.u32.pack     t2, t2.xyzw, u0.yxxx, void
010 [07811001 39001800 00000000 00390028] add.pack          t1, t1.xyzw, void, t2.xyzw
011 [0082103c 00001800 60000850 00000007] imullo0.s32.pack  t2.x___, u1.xxxx, 16, void
012 [00821001 00002800 40000000 78000408] add.s32.pack      t2.x___, t2.xxxx, void, 64
013 [07821032 39202800 80020040 00000002] load.u32.pack     t2, t2.xyzw, u0.yxxx, void
014 [07811001 39001800 00000000 00390028] add.pack          t1, t1.xyzw, void, t2.xyzw

Thanks @robclark for your ideas on how to fix this issue.

Merge request reports