simd-json icon indicating copy to clipboard operation
simd-json copied to clipboard

Not building with i686 toolchain for either avx2 or sse42

Open hkratz opened this issue 4 years ago • 3 comments

Besides some fixable unused import warnings which are counted as errors there is now also code like .cast::<std::arch::x86_64::__m256i>()

$ cargo +stable-i686 build
   Compiling simd-json v0.4.2-alpha.0 (C:\Users\hans\Documents\dev\countcount\simd-json)
error[E0432]: unresolved import `std::arch::x86::_mm_cvtsi128_si64`
  --> src\avx2\stage1.rs:12:27
   |
12 |     _mm_clmulepi64_si128, _mm_cvtsi128_si64, _mm_set1_epi8, _mm_set_epi64x,
   |                           ^^^^^^^^^^^^^^^^^
   |                           |
   |                           no `_mm_cvtsi128_si64` in `arch::x86`
   |                           help: a similar name exists in the module: `_mm_cvtsi128_si32`

error[E0433]: failed to resolve: could not find `x86_64` in `arch`
   --> src\numberparse.rs:150:40
    |
150 |                     .cast::<std::arch::x86_64::__m128i>(),
    |                                        ^^^^^^ could not find `x86_64` in `arch`

error[E0433]: failed to resolve: could not find `x86_64` in `arch`
  --> src\avx2\deser.rs:52:78
   |
52 |                 _mm256_loadu_si256(src.as_ptr().add(src_i).cast::<std::arch::x86_64::__m256i>())
   |                                                                              ^^^^^^ could not find `x86_64` in `arch`

error[E0433]: failed to resolve: could not find `x86_64` in `arch`
   --> src\avx2\deser.rs:106:78
    |
106 |                 _mm256_loadu_si256(src.as_ptr().add(src_i).cast::<std::arch::x86_64::__m256i>())
    |                                                                              ^^^^^^ could not find `x86_64` in `arch`

error[E0433]: failed to resolve: could not find `x86_64` in `arch`
   --> src\avx2\deser.rs:114:44
    |
114 |                         .cast::<std::arch::x86_64::__m256i>(),
    |                                            ^^^^^^ could not find `x86_64` in `arch`

error[E0433]: failed to resolve: could not find `x86_64` in `arch`
  --> src\avx2\stage1.rs:57:71
   |
57 |                 v0: _mm256_loadu_si256(ptr.as_ptr().cast::<std::arch::x86_64::__m256i>()),
   |                                                                       ^^^^^^ could not find `x86_64` in `arch`

error[E0433]: failed to resolve: could not find `x86_64` in `arch`
  --> src\avx2\stage1.rs:58:79
   |
58 |                 v1: _mm256_loadu_si256(ptr.as_ptr().add(32).cast::<std::arch::x86_64::__m256i>()),
   |                                                                               ^^^^^^ could not find `x86_64` in `arch`

error[E0433]: failed to resolve: could not find `x86_64` in `arch`
   --> src\avx2\stage1.rs:246:44
    |
246 |                         .cast::<std::arch::x86_64::__m256i>(),
    |                                            ^^^^^^ could not find `x86_64` in `arch`

error: unused import: `_mm256_cmpeq_epi8`
 --> src\avx2\utf8check.rs:3:52
  |
3 |     __m256i, _mm256_alignr_epi8, _mm256_and_si256, _mm256_cmpeq_epi8, _mm256_cmpgt_epi8,
  |                                                    ^^^^^^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src\lib.rs:4:9
  |
4 | #![deny(warnings)]
  |         ^^^^^^^^
  = note: `#[deny(unused_imports)]` implied by `#[deny(warnings)]`

error: aborting due to 9 previous errors
[...]

Will submit a pull request shortly. Maybe adding a test for that would be good as well?

hkratz avatar Apr 09 '21 08:04 hkratz

I'm curious about that, what kind of CPU are you trying to compile it for. Does i686 even support sse4.2?

Licenser avatar Apr 09 '21 12:04 Licenser

Of course older CPUs like the Pentium 3 do not support it, but one can run 32-bit operating systems on newer CPUs and have access to the SIMD extensions. On Windows 10 32-bit binaries still run out-of-the box.

Unfortunately though supporting it is not as easy as I initially thought because the _mm_cvtsi128_si64 intrinsic is missing from std::arch::x86.

hkratz avatar Apr 09 '21 14:04 hkratz

Oh, never thought about that :D it's a neat idea.

That sadly makes some sense on some of the commands missing :( we have the same issue with aarch64, as it's not as a big ecosystem as x86_64 rust is lagging behind in supporting them

Licenser avatar Apr 09 '21 15:04 Licenser