Skip to content

[Bug]: bigram_filter.rs -> explicitly use x86 or x86_64 arch, not the same. #686

Description

@andar1an

Which fff frontend?

Other / multiple

has logs

error[E0432]: unresolved import `std::arch::x86_64`
   --> /builds/andar1an/aports/community/nushell/src/nushell-0.114.1/vendor/fff-search/src/bigram_filter.rs:626:20
    |
626 |     use std::arch::x86_64::*;
    |                    ^^^^^^ could not find `x86_64` in `arch`

Description

When compiling nushell in ci, I noticed that fff was selecting the wrong architecture for x86 systems and would err on compilation due to bigram_filter.rs arch specification.

Patching with the following seems to remedy:

diff --git a/crates/fff-core/src/bigram_filter.rs b/crates/fff-core/src/bigram_filter.rs
index bd41a5f..1500be7 100644
--- a/crates/fff-core/src/bigram_filter.rs
+++ b/crates/fff-core/src/bigram_filter.rs
@@ -623,7 +623,10 @@ fn normalize_bytes_scalar(src: &[u8], dst: &mut [u8]) {
 #[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
 #[target_feature(enable = "avx2")]
 unsafe fn normalize_bytes_avx2(src: &[u8], dst: &mut [u8]) {
+    #[cfg(target_arch = "x86_64")]
     use std::arch::x86_64::*;
+    #[cfg(target_arch = "x86")]
+    use std::arch::x86::*;
     let len = src.len();
     let mut i = 0;
     let p_lo = _mm256_set1_epi8(32);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpotentially-fixedLikely fixed by recent change; awaiting reporter confirmationtriaged

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions