You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't figure out how to create a 128bit constant. My closest attempt was by creating a 128bit vector which I then bitcast into an i128, but that doesn't work
let constant = builder.func.dfg.constants.insert(V128Imm::from(value).into());let vector = builder.ins().vconst(types::I64X2, constant);letmut flags = MemFlags::new();// Endianness is required here since I'm "changing the number of lanes" so this is my best guess for getting correct behavior?
flags.set_endianness(ifcfg!(target_endian = "little"){Endianness::Little}else{Endianness::Big});
builder.ins().bitcast(types::I128, flags, vector)
Cranelift panics with this
thread 'codegen::vtable::tests::proptests::vtables' panicked at 'should be implemented in ISLE: inst = `v4 = bitcast.i128 little v3 ; v3 = const0`, type = `Some(types::I128)`', C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\machinst\lower.rs:747:21
stack backtrace:
0: 0x7ff6532aa862 - std::backtrace_rs::backtrace::dbghelp::trace
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
1: 0x7ff6532aa862 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ff6532aa862 - std::sys_common::backtrace::_print_fmt
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\sys_common\backtrace.rs:65
3: 0x7ff6532aa862 - std::sys_common::backtrace::_print::impl$0::fmt
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\sys_common\backtrace.rs:44
4: 0x7ff6532cd36b - core::fmt::write
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\fmt\mod.rs:1208
5: 0x7ff6532a54aa - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\io\mod.rs:1682
6: 0x7ff6532aa5ab - std::sys_common::backtrace::_print
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\sys_common\backtrace.rs:47
7: 0x7ff6532aa5ab - std::sys_common::backtrace::print
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\sys_common\backtrace.rs:34
8: 0x7ff6532ad6d9 - std::panicking::default_hook::closure$1
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:267
9: 0x7ff6532ad35b - std::panicking::default_hook
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:286
10: 0x7ff6532adf71 - std::panicking::rust_panic_with_hook
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:688
11: 0x7ff6532adcfe - std::panicking::begin_panic_handler::closure$0
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:579
12: 0x7ff6532ab55f - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\sys_common\backtrace.rs:137
13: 0x7ff6532ad9b0 - std::panicking::begin_panic_handler
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:575
14: 0x7ff6532da8a5 - core::panicking::panic_fmt
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\panicking.rs:64
15: 0x7ff652ff136e - cranelift_codegen::machinst::lower::impl$3::lower_clif_block::closure$0<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst>,cranelift_codegen::isa::x64::X64Backend>
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\machinst\lower.rs:747
16: 0x7ff652f3b15b - enum2$<core::option::Option<smallvec::SmallVec<array$<cranelift_codegen::machinst::valueregs::ValueRegs<cranelift_codegen::machinst::reg::Reg>,2> > > >::unwrap_or_else<smallvec::SmallVec<array$<cranelift_codegen::machinst::valueregs::ValueRegs<cranelift_c
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\core\src\option.rs:828
17: 0x7ff652ff0c41 - cranelift_codegen::machinst::lower::Lower<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst> >::lower_clif_block<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst>,cranelift_codegen::isa::x64::X64Backend>
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\machinst\lower.rs:741
18: 0x7ff652ff33ed - cranelift_codegen::machinst::lower::Lower<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst> >::lower<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst>,cranelift_codegen::isa::x64::X64Backend>
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\machinst\lower.rs:1045
19: 0x7ff652e7dc78 - cranelift_codegen::machinst::compile::compile<cranelift_codegen::isa::x64::X64Backend>
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\machinst\compile.rs:40
20: 0x7ff652fc1f16 - cranelift_codegen::isa::x64::X64Backend::compile_vcode
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\isa\x64\mod.rs:61
21: 0x7ff652fc20bc - cranelift_codegen::isa::x64::impl$1::compile_function
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\isa\x64\mod.rs:73
22: 0x7ff652f5b4d4 - cranelift_codegen::context::Context::compile_stencil
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\context.rs:146
23: 0x7ff652f5bef1 - cranelift_codegen::context::Context::compile
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-codegen-0.96.4\src\context.rs:206
24: 0x7ff652dcbe72 - cranelift_jit::backend::impl$2::define_function_with_control_plane
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-jit-0.96.4\src\backend.rs:689
25: 0x7ff651ee1b34 - cranelift_module::module::Module::define_function<cranelift_jit::backend::JITModule>
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\cranelift-module-0.96.4\src\module.rs:919
26: 0x7ff651f187a6 - dataflow_jit::codegen::Codegen::finalize_function
at G:\Users\Chase\Code\Rust\dbsp\crates\dataflow-jit\src\codegen\mod.rs:482
27: 0x7ff651f156db - dataflow_jit::codegen::Codegen::codegen_layout_default
at G:\Users\Chase\Code\Rust\dbsp\crates\dataflow-jit\src\codegen\vtable\default.rs:148
28: 0x7ff651f43f35 - dataflow_jit::codegen::Codegen::make_vtable_for
at G:\Users\Chase\Code\Rust\dbsp\crates\dataflow-jit\src\codegen\vtable\mod.rs:113
29: 0x7ff651f43d11 - dataflow_jit::codegen::Codegen::vtable_for
at G:\Users\Chase\Code\Rust\dbsp\crates\dataflow-jit\src\codegen\vtable\mod.rs:92
30: 0x7ff6522ab963 - dataflow_jit::codegen::vtable::tests::proptests::test_layout
at G:\Users\Chase\Code\Rust\dbsp\crates\dataflow-jit\src\codegen\vtable\tests.rs:702
31: 0x7ff651edc1bb - dataflow_jit::codegen::vtable::tests::proptests::vtables::closure$1
at G:\Users\Chase\Code\Rust\dbsp\crates\dataflow-jit\src\codegen\vtable\tests.rs:801
32: 0x7ff651edb2c1 - core::ops::function::impls::impl$0::call<tuple$<proptest::sugar::NamedArguments<ref$<str$>,dataflow_jit::codegen::vtable::tests::proptests::PropLayout> >,dataflow_jit::codegen::vtable::tests::proptests::vtables::closure_env$1>
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\core\src\ops\function.rs:582
33: 0x7ff652616ec8 - proptest::test_runner::runner::call_test::closure$3<proptest::sugar::NamedArguments<ref$<str$>,dataflow_jit::codegen::vtable::tests::proptests::PropLayout>,ref$<dataflow_jit::codegen::vtable::tests::proptests::vtables::closure_env$1>,alloc::vec::into_iter
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\test_runner\runner.rs:254
34: 0x7ff6523f6acd - core::panic::unwind_safe::impl$23::call_once<enum2$<core::result::Result<tuple$<>,enum2$<proptest::test_runner::errors::TestCaseError> > >,proptest::test_runner::runner::call_test::closure_env$3<proptest::sugar::NamedArguments<ref$<str$>,dataflow_jit::cod
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\core\src\panic\unwind_safe.rs:271
35: 0x7ff65240d315 - std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<proptest::test_runner::runner::call_test::closure_env$3<proptest::sugar::NamedArguments<ref$<str$>,dataflow_jit::codegen::vtable::tests::proptests::PropLayout>,ref$<dataflow_jit::code
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\std\src\panicking.rs:483
36: 0x7ff652411803 - std::panicking::try::do_catch<core::panic::unwind_safe::AssertUnwindSafe<std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0<dbsp::circuit::runtime::impl$5::run::closure$0::closure_env$0<dbsp::circuit::dbsp_handle::impl$0::init_circuit::closur
37: 0x7ff652403451 - std::panicking::try<enum2$<core::result::Result<tuple$<>,enum2$<proptest::test_runner::errors::TestCaseError> > >,core::panic::unwind_safe::AssertUnwindSafe<proptest::test_runner::runner::call_test::closure_env$3<proptest::sugar::NamedArguments<ref$<str$>
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\std\src\panicking.rs:447
38: 0x7ff65231033d - std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<proptest::test_runner::runner::call_test::closure_env$3<proptest::sugar::NamedArguments<ref$<str$>,dataflow_jit::codegen::vtable::tests::proptests::PropLayout>,ref$<dataflow_jit::codegen:
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\std\src\panic.rs:137
39: 0x7ff6525ebbec - proptest::test_runner::runner::call_test<proptest::sugar::NamedArguments<ref$<str$>,dataflow_jit::codegen::vtable::tests::proptests::PropLayout>,ref$<dataflow_jit::codegen::vtable::tests::proptests::vtables::closure_env$1>,alloc::vec::into_iter::IntoIter<
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\test_runner\runner.rs:254
40: 0x7ff65255d648 - proptest::test_runner::runner::TestRunner::run_one_with_replay<proptest::strategy::map::Map<proptest::strategy::map::Map<proptest::collection::VecValueTree<proptest::strategy::unions::TupleUnionValueTree<tuple$<proptest::strategy::lazy::LazyValueTree<prop
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\test_runner\runner.rs:726
41: 0x7ff65253c557 - proptest::test_runner::runner::TestRunner::gen_and_run_case<proptest::strategy::map::Map<proptest::strategy::map::Map<proptest::collection::VecStrategy<proptest::strategy::unions::TupleUnion<tuple$<tuple$<u32,alloc::sync::Arc<proptest::strategy::map::Map<
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\test_runner\runner.rs:668
42: 0x7ff65258ab56 - proptest::test_runner::runner::TestRunner::run_in_process_with_replay<proptest::strategy::map::Map<proptest::strategy::map::Map<proptest::collection::VecStrategy<proptest::strategy::unions::TupleUnion<tuple$<tuple$<u32,alloc::sync::Arc<proptest::strategy:
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\test_runner\runner.rs:602
43: 0x7ff65252b0e6 - proptest::test_runner::runner::TestRunner::run_in_process<proptest::strategy::map::Map<proptest::strategy::map::Map<proptest::collection::VecStrategy<proptest::strategy::unions::TupleUnion<tuple$<tuple$<u32,alloc::sync::Arc<proptest::strategy::map::Map<pr
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\test_runner\runner.rs:574
44: 0x7ff65259fce1 - proptest::test_runner::runner::TestRunner::run<proptest::strategy::map::Map<proptest::strategy::map::Map<proptest::collection::VecStrategy<proptest::strategy::unions::TupleUnion<tuple$<tuple$<u32,alloc::sync::Arc<proptest::strategy::map::Map<proptest::str
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\test_runner\runner.rs:417
45: 0x7ff6522b0ffc - dataflow_jit::codegen::vtable::tests::proptests::vtables
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\sugar.rs:163
46: 0x7ff651edc0e8 - dataflow_jit::codegen::vtable::tests::proptests::vtables::closure$0
at C:\Users\Chase\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\proptest-1.2.0\src\sugar.rs:159
47: 0x7ff651cd0582 - core::ops::function::FnOnce::call_once<dataflow_jit::codegen::vtable::tests::proptests::vtables::closure_env$0,tuple$<> >
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\core\src\ops\function.rs:507
48: 0x7ff6528d162f - core::ops::function::FnOnce::call_once
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\ops\function.rs:507
49: 0x7ff6528d162f - test::__rust_begin_short_backtrace<enum2$<core::result::Result<tuple$<>,alloc::string::String> >,enum2$<core::result::Result<tuple$<>,alloc::string::String> > (*)()>
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\test\src\lib.rs:657
50: 0x7ff652899730 - test::run_test::closure$1
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\test\src\lib.rs:648
51: 0x7ff652899730 - core::ops::function::FnOnce::call_once<test::run_test::closure_env$1,tuple$<> >
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\ops\function.rs:507
52: 0x7ff6528cfe8d - alloc::boxed::impl$45::call_once
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\alloc\src\boxed.rs:2000
53: 0x7ff6528cfe8d - core::panic::unwind_safe::impl$23::call_once
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\panic\unwind_safe.rs:271
54: 0x7ff6528cfe8d - std::panicking::try::do_call
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:483
55: 0x7ff6528cfe8d - std::panicking::try
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:447
56: 0x7ff6528cfe8d - std::panic::catch_unwind
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panic.rs:137
57: 0x7ff6528cfe8d - test::run_test_in_process
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\test\src\lib.rs:680
58: 0x7ff6528cfe8d - test::run_test::run_test_inner::closure$0
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\test\src\lib.rs:574
59: 0x7ff652890a0a - test::run_test::run_test_inner::closure$1
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\test\src\lib.rs:601
60: 0x7ff652890a0a - std::sys_common::backtrace::__rust_begin_short_backtrace<test::run_test::run_test_inner::closure_env$1,tuple$<> >
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\sys_common\backtrace.rs:121
61: 0x7ff652899a0b - std::thread::impl$0::spawn_unchecked_::closure$1::closure$0
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\thread\mod.rs:550
62: 0x7ff652899a0b - core::panic::unwind_safe::impl$23::call_once
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\panic\unwind_safe.rs:271
63: 0x7ff652899a0b - std::panicking::try::do_call
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:483
64: 0x7ff652899a0b - std::panicking::try
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:447
65: 0x7ff652899a0b - std::panic::catch_unwind
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panic.rs:137
66: 0x7ff652899a0b - std::thread::impl$0::spawn_unchecked_::closure$1
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\thread\mod.rs:549
67: 0x7ff652899a0b - core::ops::function::FnOnce::call_once<std::thread::impl$0::spawn_unchecked_::closure_env$1<test::run_test::run_test_inner::closure_env$1,tuple$<> >,tuple$<> >
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\ops\function.rs:507
68: 0x7ff6532b966c - alloc::boxed::impl$45::call_once
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\alloc\src\boxed.rs:2000
69: 0x7ff6532b966c - alloc::boxed::impl$45::call_once
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\alloc\src\boxed.rs:2000
70: 0x7ff6532b966c - std::sys::windows::thread::impl$0::new::thread_start
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\sys\windows\thread.rs:56
71: 0x7ffdcdfd7614 - BaseThreadInitThunk
72: 0x7ffdce8626f1 - RtlUserThreadStart
So I'm not really sure how to deal with that
The text was updated successfully, but these errors were encountered:
Kixiron
added
bug
Incorrect behavior in the current implementation that needs fixing
cranelift
Issues related to the Cranelift code generator
labels
Jul 6, 2023
Yeah, 128-bit constants are currently awkward in Cranelift. Usually we build them out of smaller constants. If the value fits within a 64-bit constant then you can use iconst.i64 followed by uextend (or sextend if you want to sign-extend). Otherwise you can build the two 64-bit halves with iconst.i64 and then combine them with iconcat. There are examples in cranelift/filetests/filetests/runtests/i128-*.clif.
The best way to do that operation currently is to either use a iconcat to merge two iconst.i64's, or use sextend/uextend if your constant can fit in a i64.
See also isplit if you end up needing to separate it out again for whatever reason.
Bitcasting a 128bit vector into a i128 should work, but in practice it's not implemented in any backend (CC: #6104)
Edit: Oops, looks like @jameysharp beat me to it 😄
Hopefully this was all you needed, so I'm going to close this issue. But please re-open it if we missed something!
Ideally we'd either have better documentation explaining this, or we'd remove the weird special case around i128 constants. If anyone runs into this problem, finds this discussion, and wants to try to tackle either of those solutions, let's chat! Otherwise I don't know when either alternative will happen 😅
I can't figure out how to create a 128bit constant. My closest attempt was by creating a 128bit vector which I then bitcast into an i128, but that doesn't work
Cranelift panics with this
So I'm not really sure how to deal with that
The text was updated successfully, but these errors were encountered: