Stream: git-wasmtime

Topic: wasmtime / issue #5714 Cranelift: `fcvt_to_sint_sat.{i8,i...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 05 2023 at 18:09):

afonso360 edited issue #5714:

:wave: Hey,

Fuzzgen found this, Its hard to minimize because changing an unrelated instruction spontaneously causes the test to start passing again.

.clif Test Case

test interpret
test run
target riscv64gc

function %a(i32 sext, f64, f32, i64 uext) -> f32, i8, i8 system_v {
block0(v0: i32, v1: f64, v2: f32, v3: i64):
    v12 -> v1
    v14 -> v2
    v16 -> v2
    v4 = iconst.i16 0x4242
    v5 = iconst.i64 0x0042_4242_4242_4242
    jump block1

block1:
    v13 = fcvt_to_sint_sat.i8 v12
    v15 -> v13
    brif v13, block2, block1

block2:
    return v14, v15, v15
}

; run: %a(1111441986, -0x1.ffa8b425b4242p128, 0x0.00859ep-126, 0) == [0x0.00859ep-126, -128, -128]

<details>
<summary>Edit: This testcase segfaults instead of going into an infinite loop</summary>

test interpret
test run
target riscv64gc

function %a(i8 sext, i128 sext, f32, f64, f64, f64, f64, f64, f64, i32 uext, i16 uext, i64 sext) -> f64, f32, i64 sext, i64 sext, i32, f32, f32, f32, f32 system_v {
block0(v0: i8, v1: i128, v2: f32, v3: f64, v4: f64, v5: f64, v6: f64, v7: f64, v8: f64, v9: i32, v10: i16, v11: i64):
    v24 -> v4
    v25 -> v11
    v16 = iconst.i8 0
    v17 = iconst.i16 0
    v18 = iconst.i32 0
    v19 = iconst.i64 0
    v20 = uextend.i128 v19  ; v19 = 0
    v21 = fcvt_to_sint_sat.i16 v5
    v23 -> v21
    v22 = sshr v9, v9
    v26 -> v22
    brif v22, block1(v2, v2), block1(v2, v2)

block1(v12: f32, v13: f32):
    brif.i16 v23, block2(v13, v13), block2(v13, v13)

block2(v14: f32, v15: f32):
    return v24, v15, v25, v25, v26, v15, v15, v15, v15
}

; run: %a(47, 19850, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0) == [0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0]
; run: %a(0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0) == [0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0]

</details>

Steps to Reproduce

Expected Results

The test to pass

Actual Results

The test case goes into an infinite loop due to a wrong result from fcvt_to_sint_sat

Versions and Environment

Cranelift version or commit: main
Operating system: Linux
Architecture: riscv64

cc: @yuyang-ok

view this post on Zulip Wasmtime GitHub notifications bot (Feb 07 2023 at 03:24):

yuyang-ok commented on issue #5714:

@afonso360 Yeah,This is a bug.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 08 2023 at 00:13):

yuyang-ok edited a comment on issue #5714:

@afonso360 Yeah,This is a bug.
I think I can try fix this in few days.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 13 2023 at 23:01):

yuyang-ok commented on issue #5714:

ERROR cranelift_filetests::concurrent > FAIL: failed to parse ./xxx.clif
FAIL ./xxx.clif: failed to parse ./xxx.clif

Caused by:
17: Unknown opcode: 'brif'

Stack backtrace:
0: <E as anyhow::context::ext::StdError>::ext_context
at /home/yuyang/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.66/src/context.rs:27:29


view this post on Zulip Wasmtime GitHub notifications bot (Feb 14 2023 at 01:50):

yuyang-ok edited a comment on issue #5714:

ERROR cranelift_filetests::concurrent > FAIL: failed to parse ./xxx.clif
FAIL ./xxx.clif: failed to parse ./xxx.clif

Caused by:
17: Unknown opcode: 'brif'

Stack backtrace:
0: <E as anyhow::context::ext::StdError>::ext_context
at /home/yuyang/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.66/src/context.rs:27:29

@afonso360  No `brif` instruction??

view this post on Zulip Wasmtime GitHub notifications bot (Feb 14 2023 at 05:08):

elliottt commented on issue #5714:

You might need to rebase on main, we replaced brz/brnz with brif recently.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 14 2023 at 05:29):

yuyang-ok commented on issue #5714:

@elliottt ok, thanks.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2023 at 06:12):

yuyang-ok commented on issue #5714:

I tested it,The latest code works fine.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 21 2023 at 06:12):

yuyang-ok deleted a comment on issue #5714:

I tested it,The latest code works fine.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 26 2023 at 17:10):

afonso360 closed issue #5714:

:wave: Hey,

Fuzzgen found this, Its hard to minimize because changing an unrelated instruction spontaneously causes the test to start passing again.

.clif Test Case

test interpret
test run
target riscv64gc

function %a(i32 sext, f64, f32, i64 uext) -> f32, i8, i8 system_v {
block0(v0: i32, v1: f64, v2: f32, v3: i64):
    v12 -> v1
    v14 -> v2
    v16 -> v2
    v4 = iconst.i16 0x4242
    v5 = iconst.i64 0x0042_4242_4242_4242
    jump block1

block1:
    v13 = fcvt_to_sint_sat.i8 v12
    v15 -> v13
    brif v13, block2, block1

block2:
    return v14, v15, v15
}

; run: %a(1111441986, -0x1.ffa8b425b4242p128, 0x0.00859ep-126, 0) == [0x0.00859ep-126, -128, -128]

<details>
<summary>Edit: This testcase segfaults instead of going into an infinite loop</summary>

test interpret
test run
target riscv64gc

function %a(i8 sext, i128 sext, f32, f64, f64, f64, f64, f64, f64, i32 uext, i16 uext, i64 sext) -> f64, f32, i64 sext, i64 sext, i32, f32, f32, f32, f32 system_v {
block0(v0: i8, v1: i128, v2: f32, v3: f64, v4: f64, v5: f64, v6: f64, v7: f64, v8: f64, v9: i32, v10: i16, v11: i64):
    v24 -> v4
    v25 -> v11
    v16 = iconst.i8 0
    v17 = iconst.i16 0
    v18 = iconst.i32 0
    v19 = iconst.i64 0
    v20 = uextend.i128 v19  ; v19 = 0
    v21 = fcvt_to_sint_sat.i16 v5
    v23 -> v21
    v22 = sshr v9, v9
    v26 -> v22
    brif v22, block1(v2, v2), block1(v2, v2)

block1(v12: f32, v13: f32):
    brif.i16 v23, block2(v13, v13), block2(v13, v13)

block2(v14: f32, v15: f32):
    return v24, v15, v25, v25, v26, v15, v15, v15, v15
}

; run: %a(47, 19850, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0) == [0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0]
; run: %a(0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0) == [0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0]

</details>

Steps to Reproduce

Expected Results

The test to pass

Actual Results

The test case goes into an infinite loop due to a wrong result from fcvt_to_sint_sat

Versions and Environment

Cranelift version or commit: main
Operating system: Linux
Architecture: riscv64

cc: @yuyang-ok


Last updated: Nov 22 2024 at 16:03 UTC