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

Optimization ideas #18

Open
9 of 12 tasks
phipsgabler opened this issue Oct 30, 2019 · 3 comments
Open
9 of 12 tasks

Optimization ideas #18

phipsgabler opened this issue Oct 30, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@phipsgabler
Copy link
Member

phipsgabler commented Oct 30, 2019

  • Play with @inline and @nospecialize (see inlineable!)
  • Type stability of record! and trackedcall
  • Type stability of graph API, esp. referenced
  • Add position field with a TapeReference to each node, and reuse this in subsequent references
  • Make sure that IR objects are saved only once and cached
  • Inline IRIndex values
  • Inline TapeConstants where possible
  • Use fixed parent node value, instead of calling getfield(..., :incomplete_node) every time.
  • Replace Base.getfield(%5, :context) by using the context argument directly.
  • Turn argument lists in nodes into NTuples
  • Make canrecur generated again (and other defaults as well, if possible)
  • Make forward use less than quadratic time by using references instead of dependencies?
@phipsgabler phipsgabler added the enhancement New feature or request label Oct 31, 2019
@phipsgabler
Copy link
Member Author

phipsgabler commented Jan 17, 2020

Actually, I should first start to investigate type stability and benchmark things properly.

See: https://juliaci.github.io/PkgBenchmark.jl/stable/

@phipsgabler
Copy link
Member Author

phipsgabler commented Feb 3, 2020

One possible remaining problem is that f(args...), aka Core._apply(f, args), is not type-stable for f::Core.IntrinsicFunction. This breaks correct inference in trackedprimitive.

@generated function stable_apply(fn, args)
    :(fn($((:(args[$i]) for i in length(args.parameters))...)))
end

won't help.

@phipsgabler
Copy link
Member Author

Ha, adding some concrete types wouldn't be the dumbest idea either:

struct TapeCall{T} <: TapeExpr{T}
    value::T
    f::TapeValue
    arguments::ArgumentTuple{TapeValue}
    varargs::Union{ArgumentTuple{TapeValue}, Nothing}
end

🤦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant