Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Dagger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ include("utils/fetch.jl")
include("utils/chunks.jl")
include("utils/logging.jl")
include("submission.jl")
abstract type MemorySpace end
include("utils/memory-span.jl")
include("utils/interval_tree.jl")
include("memory-spaces.jl")

# Task scheduling
Expand All @@ -83,7 +86,12 @@ include("utils/caching.jl")
include("sch/Sch.jl"); using .Sch

# Data dependency task queue
include("datadeps.jl")
include("datadeps/aliasing.jl")
include("datadeps/chunkview.jl")
include("datadeps/remainders.jl")
include("datadeps/queue.jl")

# Stencils
include("utils/haloarray.jl")
include("stencil.jl")

Expand Down
32 changes: 31 additions & 1 deletion src/argument.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function pos_kw(pos::ArgPosition)
@assert pos.kw != :NULL
return pos.kw
end

mutable struct Argument
pos::ArgPosition
value
Expand All @@ -41,6 +42,35 @@ function Base.iterate(arg::Argument, state::Bool)
return nothing
end
end

Base.copy(arg::Argument) = Argument(ArgPosition(arg.pos), arg.value)
chunktype(arg::Argument) = chunktype(value(arg))

mutable struct TypedArgument{T}
pos::ArgPosition
value::T
end
TypedArgument(pos::Integer, value::T) where T = TypedArgument{T}(ArgPosition(true, pos, :NULL), value)
TypedArgument(kw::Symbol, value::T) where T = TypedArgument{T}(ArgPosition(false, 0, kw), value)
Base.setproperty!(arg::TypedArgument, name::Symbol, value::T) where T =
throw(ArgumentError("Cannot set properties of TypedArgument"))
ispositional(arg::TypedArgument) = ispositional(arg.pos)
iskw(arg::TypedArgument) = iskw(arg.pos)
pos_idx(arg::TypedArgument) = pos_idx(arg.pos)
pos_kw(arg::TypedArgument) = pos_kw(arg.pos)
raw_position(arg::TypedArgument) = raw_position(arg.pos)
value(arg::TypedArgument) = arg.value
valuetype(arg::TypedArgument{T}) where T = T
Base.iterate(arg::TypedArgument) = (arg.pos, true)
function Base.iterate(arg::TypedArgument, state::Bool)
if state
return (arg.value, false)
else
return nothing
end
end
Base.copy(arg::TypedArgument{T}) where T = TypedArgument{T}(ArgPosition(arg.pos), arg.value)
chunktype(arg::TypedArgument) = chunktype(value(arg))

Argument(arg::TypedArgument) = Argument(arg.pos, arg.value)

const AnyArgument = Union{Argument, TypedArgument}
Loading