-
Notifications
You must be signed in to change notification settings - Fork 391
Closed
Labels
A-interpreterArea: affects the core interpreterArea: affects the core interpreterC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

Description
constant evaluation error: tried to call a function with ABI RustIntrinsic using caller ABI PlatformIntrinsic
--> …/nightly-2019-03-15-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/../stdsimd/crates/core_arch/src/x86/sse2.rs:819:27
|
819 | transmute::<i8x16, _>(simd_eq(a.as_i8x16(), b.as_i8x16()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tried to call a function with ABI RustIntrinsic using caller ABI PlatformIntrinsic
|
= note: inside call to `std::arch::x86_64::_mm_cmpeq_epi8` at …/memchr/src/x86/sse2.rs:189:34
= note: inside call to `memchr::x86::sse2::forward_search1` at …/memchr/src/x86/sse2.rs:118:22
= note: inside call to `memchr::x86::sse2::memchr`
Metadata
Metadata
Assignees
Labels
A-interpreterArea: affects the core interpreterArea: affects the core interpreterC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
[-]Transmute ABI mismatch within std::arch::x86_64::_mm_cmpeq_epi8[/-][+]SIMD instructions are not supported[/+]RalfJung commentedon Mar 18, 2019
Miri currently does not support SIMD instructions at all. Let's use this issue to track that (I don't think we have one already).
RalfJung commentedon Mar 18, 2019
@flagello a piece of example code would help. Calling
memchr
should not usually invoke SIMD on Miri, I don't think?ghost commentedon Mar 18, 2019
If the machine supports them why not? Consider it‘s
rust-memchr
rather thanlibc
‘s, and it prefers its own SIMD variants where possible.oli-obk commentedon Mar 18, 2019
Related: rust-lang/const-eval#7
RalfJung commentedon Mar 18, 2019
Miri interprets your program, it doesn't run it directly on the hardware. The capabilities of the host machine do not matter.
Because nobody went through the effort of implementing several hundred SIMD intrinsics yet. It's not that we don't want SIMD support, we do, but it's a lot of work.
ghost commentedon Mar 18, 2019
Sorry, I wasn‘t clear enough—with “why not” I meant “why shouldn‘t
memchr
invoke SIMD on Miri when, e.g.,target_arch
isx86_64
.” In fact, thank you for your work on Miri!RalfJung commentedon Mar 18, 2019
Ah. That's a good question indeed. :)
Code doing opportunistic SIMD usually relies on
align_to
. When running in Miri, this method always returns an empty middle slice. That's why thememchr
in libstd works fine in Miri.ghost commentedon Mar 20, 2019
libcore
‘smemchr
(i.e.,core::slice::memchr::memchr
behind#![feature(slice_internals)]
, for anyone else reading) does not rely on explicit SIMD at all as it‘s Andrew‘s “fallback” (memchr::memchr::fallback
) implementation rather than the SSE + AVX ones (which are those that lead to the error when the requirements are satisfied).A quick workaround is of course,
RalfJung commentedon Apr 10, 2021
A little update on this: the issue of supporting SIMD in MIR-based Rust verification tools came up at the Rust Verification Workshop at ETAPS, and there is a lot of interest in finding a shared solution. One avenue we are considering is to have a pure Rust implementation of those intrinsics; tools consuming MIR or LLVM IR should be able to compile that implementation to the required IR and replace intrinsic calls with that IR.
const fn
rust-lang/const-eval#7RalfJung commentedon Apr 26, 2023
Miri now supports the intrinsics needed for potable_simd, which I think closes this issue.