Stream: cranelift

Topic: Simd runtests issues on aarch64


view this post on Zulip Freddie Liardet (Feb 28 2022 at 16:24):

Hello, I am trying to create some "runtests" for simd comparisons on aarch64. At the moment I am getting this error:

$ cat temp.clif
test run

function %simd_icmp_eq_i32(i32x4) -> b32x4 {
block0(v0: i32x4):
    v1 = iconst.i32 0
    v2 = splat.i32x4 v1
    v3 = icmp eq v0, v2
    return v3
}
; run: %simd_icmp_eq_i32([-1 0 1 100]) == [false true false false]
$ ./target/debug/clif-util run -v temp.clif
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `V128`,
 right: `I64`', cranelift/codegen/src/isa/aarch64/inst/emit.rs:101:5

Is there a way around this error?
(Also the "simd-comparison.clif" file runs tests just by using "; run", what does this mean?)

view this post on Zulip Chris Fallin (Feb 28 2022 at 17:36):

@Freddie Liardet that's quite odd that we wouldn't have seen that before. I'm not actually able to reproduce -- tested just now with latest main of 2a6969d2bd9652d4c0f4992dc78664d6ff840fcd, on an aarch64 machine and with your exact temp.clif, I get:

cfallin@arm2-ci:~/work/wasmtime$ target/debug/clif-util run -v ~/temp.clif
/home/cfallin/temp.clif
1 file
cfallin@arm2-ci:~/work/wasmtime$

I'll note too that usually we execute tests with clif-util test file.clif (run just executes functions, it doesn't handle test directives); if I do clif-util test temp.clif and add a target aarch64 under test run (the test harness needs to know which target(s) a test is meant for), it passes successfully

view this post on Zulip Sam Parker (Mar 01 2022 at 08:12):

On a similar note, how many SIMD runtests do we have for comparisons? From my quick browsing it looks like all but one test are for the interpreter only. The test which does run for a target doesn't check the results of the functions... any ideas why?

view this post on Zulip Sam Parker (Mar 01 2022 at 10:56):

So, I've just run this on two different aarch64 machines and found the same bug. as @Freddie Liardet . I've tracked it down to the lowering of Bint, which doesn't support vectors but the type check fails as it looks as the output, rather than the input. So I can only assume that bint hasn't been tested for aarch64..? But I think I'm more concerned that you're not seeing the same problem @Chris Fallin , any ideas of the divergence?

view this post on Zulip Sam Parker (Mar 01 2022 at 11:06):

Also, from what I can tell bint only supports vector types, so I'm so confused about what is going on in the aarch64 backend :)

view this post on Zulip bjorn3 (Mar 01 2022 at 12:08):

bint supports any bool type as input.

view this post on Zulip Chris Fallin (Mar 01 2022 at 18:14):

Ah, I was missing the last ; run... directive, sorry about that. Yes, I see the same assert

view this post on Zulip Chris Fallin (Mar 01 2022 at 18:14):

bint should support scalars and vectors, as bjorn3 says; it appears it only supports vectors in aarch64 right now

view this post on Zulip Chris Fallin (Mar 01 2022 at 18:15):

bools aren't used at all by the cranelift-wasm frontend, so I'm not surprised this hasn't been adequately exercised

view this post on Zulip Chris Fallin (Mar 01 2022 at 18:15):

at some point when we are able to extend CLIF-level fuzzing to cover all the CLIF opcodes, we should have better coverage for issues like this

view this post on Zulip Sam Parker (Mar 02 2022 at 08:31):

Ah, sorry, the instruction description was a bit misleading. Do we know what forms of vector bools other frontends use? And if they not used, and not really tested, do we need them..? I know boolean representation is being tracked in #3205 but that doesn't seem to have progressed recently.

view this post on Zulip Chris Fallin (Mar 02 2022 at 18:35):

Yeah, that's definitely a good question, I'm not as familiar with what is used by other frontends; @bjorn3 do you use greater-than-1-bit bools in cg_clif?

I'm hoping to get around to regularizing and cleaning up which opcodes take which types eventually; possibly when the current push with ISLE and ra2 integration ends I can give it a closer look. In any case all of this should be better-documented, sorry :-)

view this post on Zulip bjorn3 (Mar 02 2022 at 18:36):

I don't use them for scalar code. I may use them in the future for simd masks.

view this post on Zulip Anton Kirilov (Mar 02 2022 at 19:04):

I think that issues with bint on AArch64 have been encountered before, e.g. check issue #3335.

Hey, It looks like SIMD icmp is failing to compile on aarch64. We have a similar situation on #3334 for x64, but for different reasons. The test below is only for icmp eq, but this fails for any co...

view this post on Zulip uwu (Mar 03 2022 at 00:53):

(deleted)


Last updated: Nov 22 2024 at 16:03 UTC