Skip to content

stdsimd fails to build with target_cpu=skylake-avx512 #157

Closed
rust-lang/rust
#47828

Description

@hdevalence

When compiling stdsimd with rustc 1.22.0-nightly (b7960878b 2017-10-18) and -C target_cpu=skylake-avx512, the build fails:

$ RUSTFLAGS="-C target_cpu=skylake-avx512" cargo build --release
   Compiling stdsimd v0.0.2 (file:///<stripped>/stdsimd)
LLVM ERROR: Cannot select: t83: v32i16 = X86ISD::VINSERT t82, t78, Constant:i64<0>
  t82: v32i16 = bitcast t81
    t81: v16i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
      t80: i32 = Constant<0>
  t78: i16 = truncate t5
    t5: i64,ch = CopyFromReg t0, Register:i64 %vreg2
      t4: i64 = Register %vreg2
  t79: i64 = Constant<0>
In function: _ZN61_$LT$stdsimd..v512..u16x32$u20$as$u20$core..fmt..LowerHex$GT$3fmt17h59e1149cebeaa07fE
error: Could not compile `stdsimd`.

To learn more, run the command again with --verbose.

Activity

  1. hdevalence commented on Oct 27, 2017

    @hdevalence
    ContributorAuthor

    Discussion moved from comments here: #146 (comment) and here #146 (comment)

  2. hdevalence commented on Oct 27, 2017

    @hdevalence
    ContributorAuthor

    @alexcrichton re #146 (comment) , one motivation is to have SSE2/AVX2 code written using intrinsics be able to use the extra registers xmm16..xmm31, ymm16..ymm31 that AVX512VL provides. Is this possible using feature detection?

  3. alexcrichton commented on Oct 30, 2017

    @alexcrichton
    Member

    Oh yeah definitely makes sense to fix this! I tested a snippet which I think may have been a reduction of this? It looks like this is fixed in LLVM 5 so this may be blocked on rust-lang/rust#43370

  4. hdevalence commented on Oct 30, 2017

    @hdevalence
    ContributorAuthor

    Building the branch mentioned in that issue and using that as the local Rust toolchain fixed the issue for me.

  5. hdevalence commented on Dec 12, 2017

    @hdevalence
    ContributorAuthor

    Update: using the current nightly Rust and the current stdsimd has stopped working on skylake-avx512.

  6. gnzlbg commented on Dec 12, 2017

    @gnzlbg
    Contributor

    Does it work with a previous stdsimd version but the current nightly Rust?

    Do you have a reproducer? Does it fail to compile, at run-time, etc?


    EDIT: I get the following error:

    RUSTFLAGS="-C target_cpu=skylake-avx512" cargo build --release
       Compiling coresimd v0.0.3 (file:///stdsimd/coresimd)
    LLVM ERROR: Cannot select: 0x1194d1680: v32i16 = X86ISD::VINSERT 0x120351680, 0x12df5d5b0, Constant:i64<0>
      0x120351680: v32i16 = bitcast 0x1203eeb60
        0x1203eeb60: v16i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
          0x1194d3680: i32 = Constant<0>
      0x12df5d5b0: i16 = truncate 0x1194d3f70
        0x1194d3f70: i64,ch = CopyFromReg 0x12df0c730, Register:i64 %vreg2
          0x1194d56e8: i64 = Register %vreg2
      0x1194d5478: i64 = Constant<0>
    In function: _ZN62_$LT$coresimd..v512..u16x32$u20$as$u20$core..fmt..LowerHex$GT$3fmt17h0a46f3602aaf0609E
    error: Could not compile `coresimd`.
    
    To learn more, run the command again with --verbose.
  7. hdevalence commented on Dec 15, 2017

    @hdevalence
    ContributorAuthor

    Oops, sorry, I missed this. I guess you reproduced it; my test case is this AVX2 code: https://github.com/isislovecruft/curve25519-dalek/pull/94

    It doesn't use any 512-bit vectors, but there's a mild performance increase when using AVX512VL since the increase in registers avoids spills.

  8. gnzlbg commented on Dec 15, 2017

    @gnzlbg
    Contributor
  9. added a commit that references this issue on Jan 28, 2018
    d9031ae
  10. added a commit that references this issue on Jan 28, 2018
    38bd381
  11. added a commit that references this issue on Jan 30, 2018
    22d405f
  12. 16 remaining items

  13. added 3 commits that reference this issue on Feb 7, 2018
    ced1f3d
  14. added a commit that references this issue on Feb 9, 2018
    cef95b0
  15. added a commit that references this issue on Feb 10, 2018
    6b7b6b6
  16. added a commit that references this issue on Feb 10, 2018
    39abcc0
  17. alexcrichton commented on Feb 11, 2018

    @alexcrichton
    Member

    I believe this was fixed by rust-lang/rust#47828

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions