Skip to content

Commit

Permalink
Merge pull request #461 from willow-ahrens/wma/bytemap2
Browse files Browse the repository at this point in the history
more tweaks
  • Loading branch information
willow-ahrens authored Mar 9, 2024
2 parents 73d1f9f + 0569580 commit 426bf50
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 13 deletions.
8 changes: 5 additions & 3 deletions src/tensors/levels/sparsebytemaplevels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,16 @@ function assemble_level!(lvl::VirtualSparseByteMapLevel, ctx, pos_start, pos_sto
q_start = freshen(ctx.code, lvl.ex, :q_start)
q_stop = freshen(ctx.code, lvl.ex, :q_stop)
q = freshen(ctx.code, lvl.ex, :q)
old = freshen(ctx.code, lvl.ex, :old)

quote
$q_start = ($(ctx(pos_start)) - $(Tp(1))) * $(ctx(lvl.shape)) + $(Tp(1))
$q_stop = $(ctx(pos_stop)) * $(ctx(lvl.shape))
Finch.resize_if_smaller!($(lvl.ptr), $pos_stop + 1)
Finch.fill_range!($(lvl.ptr), 0, $pos_start + 1, $pos_stop + 1)
$old = length($(lvl.tbl))
Finch.resize_if_smaller!($(lvl.tbl), $q_stop)
Finch.fill_range!($(lvl.tbl), false, $q_start, $q_stop)
Finch.fill_range!($(lvl.tbl), false, $old + 1, $q_stop)
$(contain(ctx_2->assemble_level!(lvl.lvl, ctx_2, value(q_start, Tp), value(q_stop, Tp)), ctx))
end
end
Expand Down Expand Up @@ -410,13 +412,13 @@ function instantiate(fbr::VirtualSubFiber{VirtualSparseByteMapLevel}, ctx, mode:
tag = lvl.ex
my_q = freshen(ctx.code, tag, :_q)
q = pos

Ti = lvl.Ti

Furlable(
body = (ctx, ext) -> Lookup(
body = (ctx, i) -> Thunk(
preamble = quote
$my_q = $(ctx(q)) * $(ctx(lvl.shape)) + $(ctx(i))
$my_q = ($(ctx(q)) - $(Ti(1))) * $(ctx(lvl.shape)) + $(ctx(i))
end,
body = (ctx) -> Switch([
value(:($(lvl.tbl)[$my_q])) => instantiate(VirtualSubFiber(lvl.lvl, pos), ctx, mode, subprotos),
Expand Down
4 changes: 2 additions & 2 deletions test/reference32/issues/issue288_concordize_double_let.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ begin
for i_9 = 1:A_mode1_stop
val = X[i_9, j_5]
for l_6 = 1:A_mode2_stop
val_2 = A[i_9, l_6, k_6]
phase_stop = min(i_9, l_6 + -1)
if phase_stop >= i_9
for s_5 = i_9:phase_stop
for s_4 = i_9:phase_stop
val_2 = A[i_9, l_6, k_6]
C[i_9, j_5, k_6] = val_2 * val + C[i_9, j_5, k_6]
C[i_9, j_5, k_6] = val * val_2 + C[i_9, j_5, k_6]
end
Expand Down
3 changes: 2 additions & 1 deletion test/reference32/kernels/gustavsons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ begin
w_lvlq_stop = 1 * A_lvl_2.shape
Finch.resize_if_smaller!(w_lvl_ptr, 1 + 1)
Finch.fill_range!(w_lvl_ptr, 0, 1 + 1, 1 + 1)
w_lvlold = length(w_lvl_tbl)
Finch.resize_if_smaller!(w_lvl_tbl, w_lvlq_stop)
Finch.fill_range!(w_lvl_tbl, false, w_lvlq_start, w_lvlq_stop)
Finch.fill_range!(w_lvl_tbl, false, w_lvlold + 1, w_lvlq_stop)
Finch.resize_if_smaller!(w_lvl_val, w_lvlq_stop)
Finch.fill_range!(w_lvl_val, 0.0, w_lvlq_start, w_lvlq_stop)
A_lvl_2_q = A_lvl_ptr[A_lvl_q]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ quote
tmp_lvlq_stop = 1 * ref_lvl.shape
Finch.resize_if_smaller!(tmp_lvl_ptr, 1 + 1)
Finch.fill_range!(tmp_lvl_ptr, 0, 1 + 1, 1 + 1)
tmp_lvlold = length(tmp_lvl_tbl)
Finch.resize_if_smaller!(tmp_lvl_tbl, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_tbl, false, tmp_lvlq_start, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_tbl, false, tmp_lvlold + 1, tmp_lvlq_stop)
Finch.resize_if_smaller!(tmp_lvl_val, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_val, 0.0, tmp_lvlq_start, tmp_lvlq_stop)
ref_lvl_q = ref_lvl_ptr[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ quote
tmp_lvlq_stop = 1 * ref_lvl.shape
Finch.resize_if_smaller!(tmp_lvl_ptr, 1 + 1)
Finch.fill_range!(tmp_lvl_ptr, 0, 1 + 1, 1 + 1)
tmp_lvlold = length(tmp_lvl_tbl)
Finch.resize_if_smaller!(tmp_lvl_tbl, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_tbl, false, tmp_lvlq_start, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_tbl, false, tmp_lvlold + 1, tmp_lvlq_stop)
Finch.resize_if_smaller!(tmp_lvl_val, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_val, false, tmp_lvlq_start, tmp_lvlq_stop)
ref_lvl_q = ref_lvl_ptr[1]
Expand Down
4 changes: 2 additions & 2 deletions test/reference64/issues/issue288_concordize_double_let.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ begin
for i_9 = 1:A_mode1_stop
val = X[i_9, j_5]
for l_6 = 1:A_mode2_stop
val_2 = A[i_9, l_6, k_6]
phase_stop = min(i_9, l_6 + -1)
if phase_stop >= i_9
for s_4 = i_9:phase_stop
val_2 = A[i_9, l_6, k_6]
for s_5 = i_9:phase_stop
C[i_9, j_5, k_6] = val_2 * val + C[i_9, j_5, k_6]
C[i_9, j_5, k_6] = val * val_2 + C[i_9, j_5, k_6]
end
Expand Down
3 changes: 2 additions & 1 deletion test/reference64/kernels/gustavsons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ begin
w_lvlq_stop = 1 * A_lvl_2.shape
Finch.resize_if_smaller!(w_lvl_ptr, 1 + 1)
Finch.fill_range!(w_lvl_ptr, 0, 1 + 1, 1 + 1)
w_lvlold = length(w_lvl_tbl)
Finch.resize_if_smaller!(w_lvl_tbl, w_lvlq_stop)
Finch.fill_range!(w_lvl_tbl, false, w_lvlq_start, w_lvlq_stop)
Finch.fill_range!(w_lvl_tbl, false, w_lvlold + 1, w_lvlq_stop)
Finch.resize_if_smaller!(w_lvl_val, w_lvlq_stop)
Finch.fill_range!(w_lvl_val, 0.0, w_lvlq_start, w_lvlq_stop)
A_lvl_2_q = A_lvl_ptr[A_lvl_q]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ quote
tmp_lvlq_stop = 1 * ref_lvl.shape
Finch.resize_if_smaller!(tmp_lvl_ptr, 1 + 1)
Finch.fill_range!(tmp_lvl_ptr, 0, 1 + 1, 1 + 1)
tmp_lvlold = length(tmp_lvl_tbl)
Finch.resize_if_smaller!(tmp_lvl_tbl, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_tbl, false, tmp_lvlq_start, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_tbl, false, tmp_lvlold + 1, tmp_lvlq_stop)
Finch.resize_if_smaller!(tmp_lvl_val, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_val, 0.0, tmp_lvlq_start, tmp_lvlq_stop)
ref_lvl_q = ref_lvl_ptr[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ quote
tmp_lvlq_stop = 1 * ref_lvl.shape
Finch.resize_if_smaller!(tmp_lvl_ptr, 1 + 1)
Finch.fill_range!(tmp_lvl_ptr, 0, 1 + 1, 1 + 1)
tmp_lvlold = length(tmp_lvl_tbl)
Finch.resize_if_smaller!(tmp_lvl_tbl, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_tbl, false, tmp_lvlq_start, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_tbl, false, tmp_lvlold + 1, tmp_lvlq_stop)
Finch.resize_if_smaller!(tmp_lvl_val, tmp_lvlq_stop)
Finch.fill_range!(tmp_lvl_val, false, tmp_lvlq_start, tmp_lvlq_stop)
ref_lvl_q = ref_lvl_ptr[1]
Expand Down

2 comments on commit 426bf50

@willow-ahrens
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/102580

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.16 -m "<description of version>" 426bf500c23792e70e3029d321ec247d075b93a9
git push origin v0.6.16

Please sign in to comment.