abc767234318 opened issue #9508:
I constructed a clif file that contains the f16const instruction, and I got an error when I used the following command.
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib clif-util test test.clif
The error is:
ERROR cranelift_filetests::concurrent > FAIL: failed to parse test.clif FAIL test.clif: failed to parse test.clif Caused by: 16: Unknown opcode: 'f16const' 1 tests Error: 1 failure
In addition, I found a test file for the f16const instruction in the cranelift/filetests/filetests/isa/riscv64/f16const.clif.
cfallin commented on issue #9508:
Interesting -- it seems we should, since it's in a test and tests are passing on CI.
A few things to verify:
- Can you check that your version of
clif-util
is the latest, i.e. built from currentmain
?- Can you check if you're able to run
clif-util test
oncranelift/filetests/filetests/isa/riscv64/f16const.clif
?- If things are still not working, can you share the full CLIF input file, exact version (commit) and command line you're running?
abc767234318 closed issue #9508:
I constructed a clif file that contains the f16const instruction, and I got an error when I used the following command.
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib clif-util test test.clif
The error is:
ERROR cranelift_filetests::concurrent > FAIL: failed to parse test.clif FAIL test.clif: failed to parse test.clif Caused by: 16: Unknown opcode: 'f16const' 1 tests Error: 1 failure
In addition, I found a test file for the f16const instruction in the cranelift/filetests/filetests/isa/riscv64/f16const.clif.
abc767234318 commented on issue #9508:
Interesting -- it seems we should, since it's in a test and tests are passing on CI.
A few things to verify:
- Can you check that your version of
clif-util
is the latest, i.e. built from currentmain
?- Can you check if you're able to run
clif-util test
oncranelift/filetests/filetests/isa/riscv64/f16const.clif
?- If things are still not working, can you share the full CLIF input file, exact version (commit) and command line you're running?
It seems that my version of wasmtime is wrong, I will close this issue.
abc767234318 reopened issue #9508:
I constructed a clif file that contains the f16const instruction, and I got an error when I used the following command.
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib clif-util test test.clif
The error is:
ERROR cranelift_filetests::concurrent > FAIL: failed to parse test.clif FAIL test.clif: failed to parse test.clif Caused by: 16: Unknown opcode: 'f16const' 1 tests Error: 1 failure
In addition, I found a test file for the f16const instruction in the cranelift/filetests/filetests/isa/riscv64/f16const.clif.
abc767234318 commented on issue #9508:
@cfallin Here is my CLIF input file.
output.zipHowever, I still can't run this file by using the following command line:
qemu-riscv64 -L /usr/riscv64-linux-gnu -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib riscv64gc-unknown-linux-gnu/debug/clif-util run -v output.clif
The error is :
output.clif: The target ISA specified in the file is not compatible with the host ISA 1 file Error: 1 failure
And I try to run the f16const.clif, it also outputs the similar error:
qemu-riscv64 -L /usr/riscv64-linux-gnu -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib riscv64gc-unknown-linux-gnu/debug/clif-util run -v ../cranelift/filetests/filetests/isa/riscv64/f16const.clif ../cranelift/filetests/filetests/isa/riscv64/f16const.clif: The target ISA specified in the file is not compatible with the host ISA 1 file Error: 1 failure
The commit version of my wasmtime is:
~/wasmtime$ git rev-parse HEAD c255a853f47188f43fb004389581fccc74bfc362
bjorn3 commented on issue #9508:
You are probably missing
target riscv64
at the top of the test file (didn't download your zip).
afonso360 commented on issue #9508:
FP16 on the RISC-V backend is only supported with the
Zfh
extension. You need to add thehas_zfh
flag to thetarget
field. (i.e.target riscv64 has_zfh
)You also have to specify support for the
Zfh
extension in qemu otherwise it likely won't run the test. There's a flag somewhere to do it, I don't know exactly what it is.
afonso360 edited a comment on issue #9508:
FP16 on the RISC-V backend is only supported with the
Zfh
extension. You need to add thehas_zfh
flag to thetarget
field. (i.e.target riscv64 has_zfh
)You also have to specify support for the
Zfh
extension in qemu otherwise it likely won't run the test. There's a flag somewhere to do it, I don't know exactly what it is.I should also note, there are some operations that we don't yet support for FP16.
bjorn3 commented on issue #9508:
FP16 on the RISC-V backend is only supported with the Zfh extension.
For cg_clif f16const and f16 arguments and return values will need to work unconditionally. Math on f16 can be lowered to libcalls just fine when
Zfh
is not enabled however.
afonso360 commented on issue #9508:
I'm not entirely sure how it's currently implemented, but I think that should work. We already save and restore the entire registers, instead of just the used portion. I haven't tested that yet though.
afonso360 commented on issue #9508:
@abc767234318 I'm not entirely sure why the
clif-util run
command doesn't work, but running the test withclif-util test
does work on my machine.I also tried to run
clif-util compile --target riscv64 --set has_zfh output.clif
, but that failed because we don't support f128 types.
abc767234318 commented on issue #9508:
@abc767234318 I'm not entirely sure why the
clif-util run
command doesn't work, but running the test withclif-util test
does work on my machine.I also tried to run
clif-util compile --target riscv64 --set has_zfh output.clif
, but that failed because we don't support f128 types.Where can I find the set of IR instructions supported by each cpu architecture? I also found that x86 cpu don't seem to support the iconst.i128 instruction.
The line 13 is
v7 = iconst.i128 -2319861032952027390
, but I get the following errorERROR cranelift_filetests::concurrent > FAIL: failed to parse file_tests/multi_func.clif FAIL file_tests/multi_func.clif: failed to parse file_tests/multi_func.clif Caused by: 13: expected one of the following type: i8, i16, i32 or i64 1 tests Error: 1 failure
bjorn3 commented on issue #9508:
iconst.i128
is not allowed on any architecture afaik. You have to use twoiconst.i64
+ aniconcat
with both halves to get ani128
. Theiconst
instruction only accepts a 64bit immediate value.
cfallin commented on issue #9508:
To add a bit more: we don't support
iconst.i128
because it would imply that the size of anInstructionData
is at least 128 bits (16 bytes) plus the opcode; whereas we try to keep the entireInstructionData
to 16 bytes for performance and memory-overhead reasons. The tradeoff is that the one instruction that has a huge immediate (iconst.i128
) is not possible to encode directly.
Last updated: Dec 23 2024 at 12:05 UTC