Tape Machine (#30)

Adds a tape machine way of executing the code.
The tape machine is a series of FunctionCall objects, which can either be called one by one, or be used to generate expressions to make up a function.

Reviewed-on: Rubydragon/MetagraphOptimization.jl#30
Co-authored-by: Anton Reinhard <anton.reinhard@proton.me>
Co-committed-by: Anton Reinhard <anton.reinhard@proton.me>
This commit is contained in:
2024-01-03 16:38:32 +01:00
committed by Anton Reinhard
parent 92e0eeaaef
commit 82ed774b7e
21 changed files with 398 additions and 502 deletions

View File

@@ -3,28 +3,10 @@
Fallback implementation of the compute function of a compute task, throwing an error.
"""
function compute(t::AbstractTask; data...)
function compute(t::AbstractTask, data...)
return error("Need to implement compute()")
end
"""
compute(t::FusedComputeTask; data...)
Compute a fused compute task.
"""
function compute(t::FusedComputeTask; data...)
(T1, T2) = collect(typeof(t).parameters)
return compute(T2(), compute(T1(), data))
end
"""
compute(t::AbstractDataTask; data...)
The compute function of a data task, always the identity function, regardless of the specific task.
"""
compute(t::AbstractDataTask; data...) = data
"""
compute_effort(t::AbstractTask)