Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor package into one part dealing with LLVM and one part that builds a Vec on top of that #63

Merged
merged 20 commits into from
Mar 31, 2020

Commits on Feb 21, 2020

  1. This PR pretty much rewrites the package from scratch (with the

    exception of some of the indexing implemented by tkf) while keeping the
    API intact. The reason for this is that I felt that the code could gain
    a lot of clarity by clearly separating the parts that deals with
    LLVM/`llvmcall` and then build a `Vec` on top of that. The number of
    lines of code has also been reduced from ~1600 to 1000.
    
    The code is structured as follows:
    
    - `LLVM_Intrinsics.jl` is pretty much a direct mapping of Julia Vectors
    (`NTuple{N, VecElement{T}}`) to the operators and intrinsics defined in
    https://llvm.org/docs/LangRef.html. It contains almost no higher level
    logic.  - `simdvec.jl` contains the `Vec` (wrapping the tuple of
    `VecElement`s) with definitions defined on it that maps to the
    intrinsics defined in `LLVM.jl`. In some cases this is pretty automatic
    but in some cases requires some logic (like in the bitshifts partly to
    avoid undefined behavior or in the different conversions).  -
    `arrayops.jl` is the stuff that deals with Julia `Array` like `vload`,
    `vstore`, `vgather`.
    
    Things that have gotten added to the API:
    
    - The `count_ones, count_zeros, leading_ones, leading_zeros,
    trailing_ones, trailing_zeros` family of functions.
    
    - Type conversions and different types of reinterprets from scalar to
    vectors and back and between vectors of different size:
    
    ```jl
    julia> v = Vec((Int32(2), Int32(4)))
    <2 x Int32>[2, 4]
    
    julia> reinterpret(Int64, v)
    17179869186
    
    julia> reinterpret(Vec{4, Int16}, v)
    <4 x Int16>[2, 0, 4, 0]
    
    julia> reinterpret(Vec{2, Int32}, 4)
    <2 x Int32>[4, 0]
    
    julia> convert(Vec{2, Float32}, v)
    <2 x Float32>[2.0, 4.0]
    ```
    
    - Uses the LLVM vector reduction intrinsics
    (https://llvm.org/docs/LangRef.html#experimental-vector-reduction-intrinsics)
    instead of a hand rolled reducer.
    
    Things that has been removed from the API:
    
    - Removed the `Val` arguments from many functions (`setindex`, `>>`
    etc). Julia's constant propagation + LLVM's optimization are enough for
    these not to be needed. Things are specialized on the constant just as
    well as if using `Val`.
    
    - Removed the `Val{}` arguments and just use `Val()` consistently everywhere.
    
    - Removed `exp10`. This used to just call `10^v` but the reason you
    would use `exp10` is that there is a more efficient implementation for
    it than the naive one. I feel that providing `exp10` gives the false
    impression that it provides a benefit over the naive version
    
    Co-Authored-By: Valentin Churavy <vchuravy@users.noreply.github.com>
    KristofferC and vchuravy committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    83a7471 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    68c0b2d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e3321e5 View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2020

  1. fix supported element types

    fixup: fix supported element types
    KristofferC committed Feb 22, 2020
    Configuration menu
    Copy the full SHA
    bf71b69 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f237a54 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9efd543 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    86805c2 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bca864d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bbd89f8 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0706d0f View commit details
    Browse the repository at this point in the history
  8. add overflow arithmetic

    KristofferC committed Feb 22, 2020
    Configuration menu
    Copy the full SHA
    5167673 View commit details
    Browse the repository at this point in the history
  9. throw when trying to call mul with overflow on Int64 on i686 because

    the error we get is "LLVM ERROR: Symbols not found: { __mulodi4 }" which seems
    like it would require compiler-rt support"
    KristofferC committed Feb 22, 2020
    Configuration menu
    Copy the full SHA
    5fb86c2 View commit details
    Browse the repository at this point in the history
  10. add conversion from Bool

    KristofferC committed Feb 22, 2020
    Configuration menu
    Copy the full SHA
    67372bf View commit details
    Browse the repository at this point in the history

Commits on Feb 23, 2020

  1. Configuration menu
    Copy the full SHA
    5de3b15 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8204863 View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2020

  1. Configuration menu
    Copy the full SHA
    bdfd585 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2020

  1. Configuration menu
    Copy the full SHA
    05949bc View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2020

  1. fix some boundschecks

    Kristoffer Carlsson authored Mar 22, 2020
    Configuration menu
    Copy the full SHA
    37b2340 View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2020

  1. add docs for fastmath

    KristofferC committed Mar 23, 2020
    Configuration menu
    Copy the full SHA
    e8f5815 View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2020

  1. this release should be non-breaking

    Kristoffer Carlsson authored Mar 31, 2020
    Configuration menu
    Copy the full SHA
    90d54fd View commit details
    Browse the repository at this point in the history