Skip to content

Type-unstable hot loops #79

@luke-kiernan

Description

@luke-kiernan

Address type-unstable hot loops. Things worth trying, or order of invasiveness:

  1. Introduce a function barrier. Replace
for d in devices # typeof(d) varies: loop body is type unstable.
    # code here won't specialize.
end

with

for d in devices
    _inner!(container, d, ...)
end

function _inner!(contrainer, d::D, ...) where {D}
    # compiled per concrete D: code here will specialize
    # (still a runtime dispatch, though)
end

If the loop body is sufficiently complex, and devices contains a couple different concrete types, the 2nd should win out. This may increase compile-time, though, so it's worth measuring.

  1. Add a replacement for FlattenedIterator that unrolls across the different types. See IS #505. Requires interface work in IS (prototyped in that PR) plus rewriting the loops to use map and similar.

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