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?)
@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
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?
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?
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 :)
bint
supports any bool type as input.
Ah, I was missing the last ; run...
directive, sorry about that. Yes, I see the same assert
bint
should support scalars and vectors, as bjorn3 says; it appears it only supports vectors in aarch64 right now
bools aren't used at all by the cranelift-wasm frontend, so I'm not surprised this hasn't been adequately exercised
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
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.
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 :-)
I don't use them for scalar code. I may use them in the future for simd masks.
I think that issues with bint
on AArch64 have been encountered before, e.g. check issue #3335.
(deleted)
Last updated: Dec 23 2024 at 12:05 UTC