servo / pathfinder

A fast, practical GPU rasterizer for fonts and vector graphics
Apache License 2.0
3.61k stars 204 forks source link

Constructing LineSegment2F crashes Miri #516

Open LoganDark opened 2 years ago

LoganDark commented 2 years ago

Under Miri, pathfinder_simd tries to do something funky:

error: unsupported operation: unimplemented intrinsic: simd_shuffle2
    --> /home/logandark/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/x86/
sse2.rs:2780:5
     |
2780 |     simd_shuffle2!(a, b, [0, 2])
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unimplemented intrinsic: simd_shuffle2
     |
     = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support

     = note: inside `std::arch::x86_64::_mm_unpacklo_pd` at /home/logandark/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs:108:9
     = note: inside `pathfinder_simd::x86::F32x4::concat_xy_xy` at /home/logandark/.cargo/registry/src/github.com-1ecc6299db9ec823/pathfinder_simd-0.5.1/src/x86/mod.rs:359:26
     = note: inside `pathfinder_simd::x86::F32x2::concat_xy_xy` at /home/logandark/.cargo/registry/src/github.com-1ecc6299db9ec823/pathfinder_simd-0.5.1/src/x86/mod.rs:146:9
     = note: inside `pathfinder_geometry::line_segment::LineSegment2F::new` at /home/logandark/.cargo/registry/src/github.com-1ecc6299db9ec823/pathfinder_geometry-0.5.1/src/line_segment.rs:25:23

Literally using a constructor function crashes the interpreter.

I assume this isn't intended?

s3bk commented 2 years ago

This does look like a bug in miri.

LoganDark commented 2 years ago

Is it possible to workaround by not using that intrinsic on miri?

s3bk commented 2 years ago

You can try enabling https://github.com/servo/pathfinder/blob/master/simd/Cargo.toml#L13