Skip to content

Commit

Permalink
more rename
Browse files Browse the repository at this point in the history
  • Loading branch information
willow-ahrens committed Feb 6, 2025
1 parent 85177ed commit e0133b8
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions src/architecture.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ and copies the data in to it, according to the `device` trait.
function bcast end

"""
virtual_bcast(device, arr)
bcast_send(device, arr)
If the virtual array is not on the given device, copy the array to that device. This
function is used to move data to the device before a kernel is launched.
"""
function virtual_bcast end
function bcast_send end
2 changes: 1 addition & 1 deletion src/interface/abstract_arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ FinchNotation.finch_leaf(x::VirtualAbstractArray) = virtual(x)
virtual_fill_value(ctx, ::VirtualAbstractArray) = 0
virtual_eltype(ctx, tns::VirtualAbstractArray) = tns.eltype

function virtual_bcast(ctx, vec::VirtualAbstractArray, device)
function bcast_send(ctx, vec::VirtualAbstractArray, device)
ex = freshen(ctx, vec.ex)
push_preamble!(
ctx,
Expand Down
4 changes: 2 additions & 2 deletions src/lower.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,14 @@ function lower_parallel_loop(ctx, root, ext::ParallelDimension, device::VirtualC
)

for tns in setdiff(used_in_scope, decl_in_scope)
virtual_bcast(ctx, resolve(ctx, tns), device)
bcast_send(ctx, resolve(ctx, tns), device)
end

virtual_parallel_region(ctx, device) do ctx_2
subtask = get_task(ctx_2)
tid = get_task_num(subtask)
for tns in intersect(used_in_scope, decl_in_scope)
virtual_bcast(ctx_2, resolve(ctx_2, tns), subtask)
bcast_send(ctx_2, resolve(ctx_2, tns), subtask)
end
contain(ctx_2) do ctx_3
open_scope(ctx_3) do ctx_4
Expand Down
12 changes: 6 additions & 6 deletions src/tensors/fibers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ function unfurl(ctx::AbstractCompiler, arr::VirtualFiber, ext, mode, proto)
unfurl(ctx, VirtualSubFiber(arr.lvl, literal(1)), ext, mode, proto)
end

function virtual_bcast(ctx::AbstractCompiler, fbr::VirtualFiber, arch)
virtual_bcast_level(ctx, fbr.lvl, arch)
function bcast_send(ctx::AbstractCompiler, fbr::VirtualFiber, arch)
bcast_send_level(ctx, fbr.lvl, arch)
end

function virtual_bcast(ctx::AbstractCompiler, fbr::VirtualSubFiber, arch)
virtual_bcast_level(ctx, fbr.lvl, arch)
function bcast_send(ctx::AbstractCompiler, fbr::VirtualSubFiber, arch)
bcast_send_level(ctx, fbr.lvl, arch)
end

struct HollowSubFiber{Lvl,Pos,Dirty} <: AbstractFiber{Lvl}
Expand All @@ -171,9 +171,9 @@ function lower(ctx::AbstractCompiler, fbr::VirtualHollowSubFiber, ::DefaultStyle
end
FinchNotation.finch_leaf(x::VirtualHollowSubFiber) = virtual(x)

function virtual_bcast(ctx::AbstractCompiler, fbr::VirtualHollowSubFiber, arch)
function bcast_send(ctx::AbstractCompiler, fbr::VirtualHollowSubFiber, arch)
return VirtualHollowSubFiber(
virtual_bcast_level(ctx, fbr.lvl, arch), fbr.pos, fbr.dirty
bcast_send_level(ctx, fbr.lvl, arch), fbr.pos, fbr.dirty
)
end

Expand Down
2 changes: 1 addition & 1 deletion src/tensors/levels/atomic_element_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function reassemble_level!(ctx, lvl::VirtualAtomicElementLevel, pos_start, pos_s
lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualAtomicElementLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualAtomicElementLevel, arch)
val_2 = freshen(ctx, :val)
push_preamble!(
ctx,
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/dense_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ function freeze_level!(ctx::AbstractCompiler, lvl::VirtualDenseLevel, pos)
return lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualDenseLevel, arch)
virtual_bcast_level(ctx, lvl.lvl, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualDenseLevel, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

struct DenseTraversal
Expand Down
6 changes: 3 additions & 3 deletions src/tensors/levels/dense_rle_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ function virtual_level_resize!(ctx, lvl::VirtualRunListLevel, dims...)
lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualRunListLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualRunListLevel, arch)
ptr_2 = freshen(ctx, lvl.ptr)
right_2 = freshen(ctx, lvl.right)
push_preamble!(
Expand All @@ -314,8 +314,8 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualRunListLevel, ar
$(lvl.right) = $right_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
virtual_bcast_level(ctx, lvl.buf, arch)
bcast_send_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.buf, arch)
end

virtual_level_eltype(lvl::VirtualRunListLevel) = virtual_level_eltype(lvl.lvl)
Expand Down
2 changes: 1 addition & 1 deletion src/tensors/levels/element_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function reassemble_level!(ctx, lvl::VirtualElementLevel, pos_start, pos_stop)
lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualElementLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualElementLevel, arch)
val_2 = freshen(ctx, :val)
push_preamble!(
ctx,
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/mutex_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function thaw_level!(ctx::AbstractCompiler, lvl::VirtualMutexLevel, pos)
return lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualMutexLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualMutexLevel, arch)
#Add for seperation level too.
atomics = freshen(ctx, :locksArray)

Expand All @@ -224,7 +224,7 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualMutexLevel, arch
$(lvl.locks) = $atomics
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

function instantiate(ctx, fbr::VirtualSubFiber{VirtualMutexLevel}, mode)
Expand Down
2 changes: 1 addition & 1 deletion src/tensors/levels/pattern_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct VirtualPatternLevel <: AbstractVirtualLevel
Tp
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualPatternLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualPatternLevel, arch)
end

is_level_injective(ctx, ::VirtualPatternLevel) = []
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/separate_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ virtual_level_size(ctx, lvl::VirtualSeparateLevel) = virtual_level_size(ctx, lvl
virtual_level_eltype(lvl::VirtualSeparateLevel) = virtual_level_eltype(lvl.lvl)
virtual_level_fill_value(lvl::VirtualSeparateLevel) = virtual_level_fill_value(lvl.lvl)

function virtual_bcast_level(ctx, lvl::VirtualSeparateLevel, arch)
function bcast_send_level(ctx, lvl::VirtualSeparateLevel, arch)

# Need to move each pointer...
val_2 = freshen(ctx, lvl.val)
Expand All @@ -163,7 +163,7 @@ function virtual_bcast_level(ctx, lvl::VirtualSeparateLevel, arch)
$(lvl.val) = $val_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

function declare_level!(ctx, lvl::VirtualSeparateLevel, pos, init)
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/shard_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ virtual_level_size(ctx, lvl::VirtualShardLevel) = virtual_level_size(ctx, lvl.lv
virtual_level_eltype(lvl::VirtualShardLevel) = virtual_level_eltype(lvl.lvl)
virtual_level_fill_value(lvl::VirtualShardLevel) = virtual_level_fill_value(lvl.lvl)

function virtual_bcast_level(ctx, lvl::VirtualShardLevel, arch)
function bcast_send_level(ctx, lvl::VirtualShardLevel, arch)
val_2 = freshen(ctx, lvl.val)
push_preamble!(
ctx,
Expand All @@ -227,7 +227,7 @@ function virtual_bcast_level(ctx, lvl::VirtualShardLevel, arch)
$(lvl.val) = $val_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

function declare_level!(ctx, lvl::VirtualShardLevel, pos, init)
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/sparse_band_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ end
virtual_level_eltype(lvl::VirtualSparseBandLevel) = virtual_level_eltype(lvl.lvl)
virtual_level_fill_value(lvl::VirtualSparseBandLevel) = virtual_level_fill_value(lvl.lvl)

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseBandLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualSparseBandLevel, arch)
tbl_2 = freshen(ctx, lvl.tbl)
ofs_2 = freshen(ctx, lvl.ofs)
push_preamble!(
Expand All @@ -260,7 +260,7 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseBandLevel,
$(lvl.ofs) = $ofs_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

function declare_level!(ctx::AbstractCompiler, lvl::VirtualSparseBandLevel, pos, init)
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/sparse_bytemap_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function lower(ctx::AbstractCompiler, lvl::VirtualSparseByteMapLevel, ::DefaultS
end
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseByteMapLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualSparseByteMapLevel, arch)
ptr_2 = freshen(ctx, lvl.ptr)
tbl_2 = freshen(ctx, lvl.tbl)
srt_2 = freshen(ctx, lvl.srt)
Expand All @@ -262,7 +262,7 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseByteMapLev
$(lvl.srt) = $srt_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

Base.summary(lvl::VirtualSparseByteMapLevel) = "SparseByteMap($(summary(lvl.lvl)))"
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/sparse_coo_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ function freeze_level!(ctx::AbstractCompiler, lvl::VirtualSparseCOOLevel, pos_st
return lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseCOOLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualSparseCOOLevel, arch)
ptr_2 = freshen(ctx, lvl.ptr)
push_preamble!(
ctx,
Expand Down Expand Up @@ -376,7 +376,7 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseCOOLevel,
)
idx_2
end
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

struct SparseCOOWalkTraversal
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/sparse_dict_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ function thaw_level!(ctx::AbstractCompiler, lvl::VirtualSparseDictLevel, pos_sto
return lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseDictLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualSparseDictLevel, arch)
ptr_2 = freshen(ctx, lvl.ptr)
idx_2 = freshen(ctx, lvl.idx)
tbl_2 = freshen(ctx, lvl.tbl_2)
Expand All @@ -402,7 +402,7 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseDictLevel,
$(lvl.tbl) = $tbl_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

function unfurl(
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/sparse_list_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function thaw_level!(ctx::AbstractCompiler, lvl::VirtualSparseListLevel, pos_sto
return lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseListLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualSparseListLevel, arch)
ptr_2 = freshen(ctx, lvl.ptr)
idx_2 = freshen(ctx, lvl.idx)
push_preamble!(
Expand All @@ -332,7 +332,7 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseListLevel,
$(lvl.idx) = $idx_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

function unfurl(
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/sparse_point_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function thaw_level!(ctx::AbstractCompiler, lvl::VirtualSparsePointLevel, pos_st
return lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparsePointLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualSparsePointLevel, arch)
ptr_2 = freshen(ctx, lvl.ptr)
idx_2 = freshen(ctx, lvl.idx)
push_preamble!(
Expand All @@ -270,7 +270,7 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparsePointLevel
$(lvl.idx) = $idx_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

function unfurl(
Expand Down
6 changes: 3 additions & 3 deletions src/tensors/levels/sparse_rle_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ function virtual_level_resize!(ctx, lvl::VirtualSparseRunListLevel, dims...)
lvl
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseRunListLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualSparseRunListLevel, arch)
ptr_2 = freshen(ctx, lvl.ptr)
left_2 = freshen(ctx, lvl.left)
right_2 = freshen(ctx, lvl.right)
Expand All @@ -326,8 +326,8 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseRunListLev
$(lvl.right) = $right_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
virtual_bcast_level(ctx, lvl.buf, arch)
bcast_send_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.buf, arch)
end

virtual_level_eltype(lvl::VirtualSparseRunListLevel) = virtual_level_eltype(lvl.lvl)
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/levels/sparse_vbl_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function virtual_level_fill_value(lvl::VirtualSparseBlockListLevel)
virtual_level_fill_value(lvl.lvl)
end

function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseBlockListLevel, arch)
function bcast_send_level(ctx::AbstractCompiler, lvl::VirtualSparseBlockListLevel, arch)
ptr_2 = freshen(ctx, lvl.ptr)
tbl_2 = freshen(ctx, lvl.tbl)
ofs_2 = freshen(ctx, lvl.ofs)
Expand All @@ -312,7 +312,7 @@ function virtual_bcast_level(ctx::AbstractCompiler, lvl::VirtualSparseBlockListL
$(lvl.ofs) = $ofs_2
end,
)
virtual_bcast_level(ctx, lvl.lvl, arch)
bcast_send_level(ctx, lvl.lvl, arch)
end

function declare_level!(ctx::AbstractCompiler, lvl::VirtualSparseBlockListLevel, pos, init)
Expand Down
8 changes: 4 additions & 4 deletions src/tensors/scalars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function virtualize(ctx, ex, ::Type{Scalar{Vf,Tv}}, tag) where {Vf,Tv}
VirtualScalar(sym, Tv, Vf, tag, val)
end

virtual_bcast(ctx, lvl::VirtualScalar, arch) = lvl
bcast_send(ctx, lvl::VirtualScalar, arch) = lvl

virtual_size(ctx, ::VirtualScalar) = ()

Expand Down Expand Up @@ -147,7 +147,7 @@ virtual_size(ctx, ::VirtualSparseScalar) = ()
virtual_fill_value(ctx, tns::VirtualSparseScalar) = tns.Vf
virtual_eltype(tns::VirtualSparseScalar, ctx) = tns.Tv

virtual_bcast(ctx, lvl::VirtualSparseScalar, arch) = lvl
bcast_send(ctx, lvl::VirtualSparseScalar, arch) = lvl

function declare!(ctx, tns::VirtualSparseScalar, init)
push_preamble!(
Expand Down Expand Up @@ -289,7 +289,7 @@ function lower_assign(ctx, tns::VirtualShortCircuitScalar, mode, op, rhs)
:($(tns.val) = $lhs_2)
end

virtual_bcast(ctx, lvl::VirtualShortCircuitScalar, arch) = lvl
bcast_send(ctx, lvl::VirtualShortCircuitScalar, arch) = lvl

function short_circuit_cases(ctx, tns::VirtualShortCircuitScalar, op)
[
Expand Down Expand Up @@ -359,7 +359,7 @@ virtual_size(ctx, ::VirtualSparseShortCircuitScalar) = ()
virtual_fill_value(ctx, tns::VirtualSparseShortCircuitScalar) = tns.Vf
virtual_eltype(tns::VirtualSparseShortCircuitScalar, ctx) = tns.Tv

virtual_bcast(ctx, lvl::VirtualSparseShortCircuitScalar, arch) = lvl
bcast_send(ctx, lvl::VirtualSparseShortCircuitScalar, arch) = lvl

function declare!(ctx, tns::VirtualSparseShortCircuitScalar, init)
push_preamble!(
Expand Down

0 comments on commit e0133b8

Please sign in to comment.