Skip to content

Type stability #16

@milankl

Description

@milankl

Counting the float operations, we currently aren't as type-stable as I was expecting

julia> using GenericFFT, GFlops
julia> rfft_plan = plan_rfft(zeros(Float16,1024))
GenericFFT.DummyrFFTPlan{ComplexF16, false, UnitRange{Int64}}(1024, 1:1, #undef)

julia> @count_ops rfft_plan*randn(Float16,1024)
Flop Counter: 61382 flop
┌────────┬─────────┬─────────┬─────────┐
│        │ Float16 │ Float32 │ Float64 │
├────────┼─────────┼─────────┼─────────┤
│    fma │       004 │
│ muladd │       00153 │
│    add │   18449083 │
│    sub │   16447039 │
│    mul │   2462201250 │
│    div │      40232 │
│    abs │      401917 │
│    neg │      1503 │
│   sqrt │       0190 │
└────────┴─────────┴─────────┴─────────┘

The Float32 operations might be miscounted similar to triscale-innov/GFlops.jl#40 but I doubt the Float64 operations are. Just raising this as we may want to ensure type stability and explicit conversions rather than relying on promotions (which can easily cascade into Float64s where we don't actually want to use them). The output may still be of eltype T but users of this package probably want a Fourier transform fully in T when they provide an input vector of eltype T?

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