Skip to content

SIMD support in the vector library #251

Description

@Magalame

Hi!

I was wondering if there were any plan to add support for SIMD instructions to vector now that GHC supports them even without llvm?

Thanks to @Drezil and @klapaucius I'm aware of this paper and this work, but the branch is 6 years old and so probably doesn't reflect the current direction of vector.

If there's any need for help, I'd be more than happy to contribute!

Activity

  1. Magalame commented on Jul 9, 2019

    @Magalame
    Author
  2. chessai commented on Sep 24, 2019

    @chessai
    Member

    as far as i am aware, that patch you link to doesn't actually work as intended. @bgamari and @AndreasPK would be able to say why, if so.

  3. andrewthad commented on Sep 24, 2019

    @andrewthad
    Contributor
  4. Magalame commented on Sep 24, 2019

    @Magalame
    Author

    Thanks @andrewthad for the link! Do we know when it'll be added back?

  5. chessai commented on Sep 24, 2019

    @chessai
    Member

    @Magalame i know the two individuals that plan on implementing it/supervising its implementation are Ben Gamari and Andreas Klebinger.

  6. bgamari commented on Sep 24, 2019

    @bgamari
    Contributor

    @AndreasPK has indeed expressed interest in picking it up. In short, the commit as written has an overly-simplistic view of register allocation and breaks in some cases.

  7. cartazio commented on Sep 25, 2019

    @cartazio
    Contributor
  8. Magalame commented on Oct 7, 2019

    @Magalame
    Author

    @bgamari @AndreasPK thanks a lot for the work you're putting into this. Do you have a general idea of when it would be available?

  9. Magalame commented on Oct 7, 2019

    @Magalame
    Author

    Thanks @cartazio for the details, I thought the MultisC type would have ensured a relatively seamless integration?

  10. cartazio commented on Oct 9, 2019

    @cartazio
    Contributor

    it worked as a technology demonstrator, but simd as it currently exists in the forseeable future is incredible monomorphic, only really for vectors on Float/Double/Int32/Int64/Word32/Word64, so it would only pay off for a pretty spare/small fraction of user code.

    It is possible that a future version of vector could allow simd integration to the fusion framework, but given engineering priorities for the future of vector as they currently exist, unless we can jointly improve the current O2 compilation performance AND fusion quality first, its not going to happen ever. Adding another rewrite rule layer to the current setup seems like piling architecture debt.

    that aside, not enough compiler support in the GHC layer actually exists to robustly support simd across all supported targets. And since vector is so widely used, that might be a blocker to including it in core vector as a library until conditional compilation / distinct code paths per microarchtecture is sanely supported at the GHC layer.

    if you want to experiment rebasing the multiC change set onto vector master or friends, so we can look at it in an up to date way, i'm all ears. We just genuinely dont have the time/resources/bandwidth though. And i'm skeptical that its the right architecture going forward

  11. Magalame commented on Oct 12, 2019

    @Magalame
    Author

    I see, thanks so much for taking the time to answer!

  12. cartazio commented on Oct 12, 2019

    @cartazio
    Contributor
  13. GeorgeCo commented on Jun 23, 2023

    @GeorgeCo

    I assume that if you compile with llvm you will get SIMD instructions when applicable. Is that false?

  14. cartazio commented on Jun 23, 2023

    @cartazio
    Contributor
  15. Drezil commented on Jun 24, 2023

    @Drezil

    Depends on the operations you do.
    vector is basically an implementation of the "recycle your arrays"-paper. It has streaming-capabilities AND block/buffer ones. What gets done is ruled by compiler optimisations and if the generated llvm looks code looks optimizable for libllvm than those things get turned into simd operations. But it is hit and miss - as far as I remember.
    It has been years when I last looked into it .. so it may have changed in the meantime.

  16. cartazio commented on Jun 24, 2023

    @cartazio
    Contributor
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions