Internals

Internals

UseSIMD{ivdep}()

Tell the reducible to run the inner reducing function using @simd. The reducible can support it using @simd_if.

source
_teezip_lens(rf) :: Lens

Return a lens to the .value field of the first "unbalanced" Joiner. A Joiner matched with preceding Splitter would be treated as a regular reducing function node. Thus, reducing function rf must have one more Joiner than Splitter.

source
Transducers.airMethod.
air.(broadcasting_expression) :: Broadcasted

Broadcast without materialization.

The idea is taken from @dawbarton's _lazy function: https://discourse.julialang.org/t/19641/20.

source
foldl_nocomplete(rf, init, coll)

Call __foldl__ without calling complete.

source
maybe_usesimd(xform, simd)

Insert UseSIMD to xform if appropriate.

Arguments

  • xform::Transducer
  • simd: false, true, or :ivdep.

Examples

julia> using Transducers
       using Transducers: maybe_usesimd

julia> maybe_usesimd(eduction(Map(identity), 1:1).rf, false)
Reduction{▶ Int64}(
    Map(identity),
    BottomRF{▶ Int64}(
        Completing{typeof(push!)}(push!)))

julia> maybe_usesimd(eduction(Map(identity), 1:1).rf, true)
Reduction{▶ Int64}(
    Transducers.UseSIMD{false}(),
    Reduction{▶ Int64}(
        Map(identity),
        BottomRF{▶ Int64}(
            Completing{typeof(push!)}(push!))))

julia> maybe_usesimd(eduction(Cat(), 1:1).rf, true)
Reduction{▶ Int64}(
    Cat(),
    Reduction{▶ Int64}(
        Transducers.UseSIMD{false}(),
        BottomRF{▶ Int64}(
            Completing{typeof(push!)}(push!))))

julia> maybe_usesimd(eduction(Map(sin) |> Cat() |> Map(cos), 1:1).rf, :ivdep)
Reduction{▶ Int64}(
    Map(sin),
    Reduction{▶ Float64}(
        Cat(),
        Reduction{▶ Float64}(
            Transducers.UseSIMD{true}(),
            Reduction{▶ Float64}(
                Map(cos),
                BottomRF{▶ Float64}(
                    Completing{typeof(push!)}(push!))))))

julia> maybe_usesimd(eduction(Map(sin) |> Cat() |> Map(cos) |> Cat() |> Map(tan), 1:1).rf, true)
Reduction{▶ Int64}(
    Map(sin),
    Reduction{▶ Float64}(
        Cat(),
        Reduction{▶ Float64}(
            Map(cos),
            Reduction{▶ Float64}(
                Cat(),
                Reduction{▶ Float64}(
                    Transducers.UseSIMD{false}(),
                    Reduction{▶ Float64}(
                        Map(tan),
                        BottomRF{▶ Float64}(
                            Completing{typeof(push!)}(push!))))))))
source
Transducers.reformMethod.
reform(rf, f)

Reset "bottom" reducing function of rf to f.

source
simple_transduce(xform, step, init, coll)

Simplified version of transduce. For simple transducers Julia may be able to emit a good code. This function exists only for performance tuning.

source
usesimd(rf::Reduction, xfsimd::UseSIMD)

Wrap the inner-most loop of reducing function rf with xfsimd. xfsimd is inserted after the inner-most Cat if rf includes Cat.

source
@simd_if rf for ... end

Wrap for-loop with @simd if the outer most transducer of the reducing function rf is UseSIMD.

source
Transducers.@~Macro.
(@~ broadcasting_expression) :: Broadcasted
source