-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Willow Ahrens
committed
Oct 8, 2023
1 parent
c11b475
commit c95091f
Showing
10 changed files
with
696 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
test/reference64/increment_to_0×0 Fiber!(SparseHash{2}(Element(0.0))).jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
begin | ||
fmt_lvl = ex.body.body.lhs.tns.bind.lvl | ||
fmt_lvl_qos_fill = length(fmt_lvl.tbl) | ||
fmt_lvl_qos_stop = fmt_lvl_qos_fill | ||
fmt_lvl_ptr = ex.body.body.lhs.tns.bind.lvl.ptr | ||
fmt_lvl_tbl = ex.body.body.lhs.tns.bind.lvl.tbl | ||
fmt_lvl_srt = ex.body.body.lhs.tns.bind.lvl.srt | ||
fmt_lvl_2 = fmt_lvl.lvl | ||
fmt_lvl_val = fmt_lvl.lvl.val | ||
arr_2_lvl = ex.body.body.rhs.tns.bind.lvl | ||
arr_2_lvl_ptr = ex.body.body.rhs.tns.bind.lvl.ptr | ||
arr_2_lvl_tbl1 = ex.body.body.rhs.tns.bind.lvl.tbl[1] | ||
arr_2_lvl_tbl2 = ex.body.body.rhs.tns.bind.lvl.tbl[2] | ||
arr_2_lvl_val = arr_2_lvl.lvl.val | ||
arr_2_lvl.shape[1] == fmt_lvl.shape[1] || throw(DimensionMismatch("mismatched dimension limits ($(arr_2_lvl.shape[1]) != $(fmt_lvl.shape[1]))")) | ||
arr_2_lvl.shape[2] == fmt_lvl.shape[2] || throw(DimensionMismatch("mismatched dimension limits ($(arr_2_lvl.shape[2]) != $(fmt_lvl.shape[2]))")) | ||
for fmt_lvl_p = 1:1 | ||
fmt_lvl_ptr[fmt_lvl_p] = fmt_lvl_ptr[fmt_lvl_p] - fmt_lvl_ptr[fmt_lvl_p + 1] | ||
end | ||
fmt_lvl_ptr[1] = 1 | ||
fmt_lvl_qos_fill = length(fmt_lvl_tbl) | ||
arr_2_lvl_q = arr_2_lvl_ptr[1] | ||
arr_2_lvl_q_stop = arr_2_lvl_ptr[1 + 1] | ||
if arr_2_lvl_q < arr_2_lvl_q_stop | ||
arr_2_lvl_i_stop = arr_2_lvl_tbl2[arr_2_lvl_q_stop - 1] | ||
else | ||
arr_2_lvl_i_stop = 0 | ||
end | ||
phase_stop = min(arr_2_lvl.shape[2], arr_2_lvl_i_stop) | ||
if phase_stop >= 1 | ||
j = 1 | ||
if arr_2_lvl_tbl2[arr_2_lvl_q] < 1 | ||
arr_2_lvl_q = Finch.scansearch(arr_2_lvl_tbl2, 1, arr_2_lvl_q, arr_2_lvl_q_stop - 1) | ||
end | ||
while j <= phase_stop | ||
arr_2_lvl_i = arr_2_lvl_tbl2[arr_2_lvl_q] | ||
arr_2_lvl_q_step = arr_2_lvl_q | ||
if arr_2_lvl_tbl2[arr_2_lvl_q] == arr_2_lvl_i | ||
arr_2_lvl_q_step = Finch.scansearch(arr_2_lvl_tbl2, arr_2_lvl_i + 1, arr_2_lvl_q, arr_2_lvl_q_stop - 1) | ||
end | ||
phase_stop_2 = min(phase_stop, arr_2_lvl_i) | ||
if arr_2_lvl_i == phase_stop_2 | ||
arr_2_lvl_q_2 = arr_2_lvl_q | ||
if arr_2_lvl_q < arr_2_lvl_q_step | ||
arr_2_lvl_i_stop_2 = arr_2_lvl_tbl1[arr_2_lvl_q_step - 1] | ||
else | ||
arr_2_lvl_i_stop_2 = 0 | ||
end | ||
phase_stop_3 = min(arr_2_lvl.shape[1], arr_2_lvl_i_stop_2) | ||
if phase_stop_3 >= 1 | ||
i = 1 | ||
if arr_2_lvl_tbl1[arr_2_lvl_q] < 1 | ||
arr_2_lvl_q_2 = Finch.scansearch(arr_2_lvl_tbl1, 1, arr_2_lvl_q, arr_2_lvl_q_step - 1) | ||
end | ||
while i <= phase_stop_3 | ||
arr_2_lvl_i_2 = arr_2_lvl_tbl1[arr_2_lvl_q_2] | ||
phase_stop_4 = min(phase_stop_3, arr_2_lvl_i_2) | ||
if arr_2_lvl_i_2 == phase_stop_4 | ||
arr_2_lvl_2_val = arr_2_lvl_val[arr_2_lvl_q_2] | ||
fmt_lvl_key_2 = (1, (phase_stop_4, phase_stop_2)) | ||
fmt_lvl_q_2 = get(fmt_lvl_tbl, fmt_lvl_key_2, fmt_lvl_qos_fill + 1) | ||
if fmt_lvl_q_2 > fmt_lvl_qos_stop | ||
fmt_lvl_qos_stop = max(fmt_lvl_qos_stop << 1, 1) | ||
Finch.resize_if_smaller!(fmt_lvl_val, fmt_lvl_qos_stop) | ||
Finch.fill_range!(fmt_lvl_val, 0.0, fmt_lvl_q_2, fmt_lvl_qos_stop) | ||
end | ||
fmt_lvl_val[fmt_lvl_q_2] = arr_2_lvl_2_val + fmt_lvl_val[fmt_lvl_q_2] | ||
if fmt_lvl_q_2 > fmt_lvl_qos_fill | ||
fmt_lvl_qos_fill = fmt_lvl_q_2 | ||
fmt_lvl_tbl[fmt_lvl_key_2] = fmt_lvl_q_2 | ||
fmt_lvl_ptr[1 + 1] += 1 | ||
end | ||
arr_2_lvl_q_2 += 1 | ||
end | ||
i = phase_stop_4 + 1 | ||
end | ||
end | ||
arr_2_lvl_q = arr_2_lvl_q_step | ||
end | ||
j = phase_stop_2 + 1 | ||
end | ||
end | ||
resize!(fmt_lvl_srt, length(fmt_lvl_tbl)) | ||
copyto!(fmt_lvl_srt, pairs(fmt_lvl_tbl)) | ||
sort!(fmt_lvl_srt, by = hashkeycmp) | ||
for p = 2:1 + 1 | ||
fmt_lvl_ptr[p] += fmt_lvl_ptr[p - 1] | ||
end | ||
resize!(fmt_lvl_ptr, 1 + 1) | ||
qos = fmt_lvl_ptr[end] - 1 | ||
resize!(fmt_lvl_srt, qos) | ||
resize!(fmt_lvl_val, qos) | ||
(fmt = Fiber((SparseHashLevel){2, Tuple{Int64, Int64}}(fmt_lvl_2, (fmt_lvl.shape[1], fmt_lvl.shape[2]), fmt_lvl_ptr, fmt_lvl_tbl, fmt_lvl_srt)),) | ||
end |
94 changes: 94 additions & 0 deletions
94
test/reference64/increment_to_10×10 Fiber!(Dense(SparseByteMap(Element(0.0)))).jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
begin | ||
fmt_lvl = ex.body.body.lhs.tns.bind.lvl | ||
fmt_lvl_2 = fmt_lvl.lvl | ||
fmt_lvl_ptr = fmt_lvl.lvl.ptr | ||
fmt_lvl_tbl = fmt_lvl.lvl.tbl | ||
fmt_lvl_srt = fmt_lvl.lvl.srt | ||
fmt_lvl_2_qos_stop = (fmt_lvl_2_qos_fill = length(fmt_lvl_2.srt)) | ||
fmt_lvl_3 = fmt_lvl_2.lvl | ||
fmt_lvl_2_val = fmt_lvl_2.lvl.val | ||
arr_2_lvl = ex.body.body.rhs.tns.bind.lvl | ||
arr_2_lvl_ptr = ex.body.body.rhs.tns.bind.lvl.ptr | ||
arr_2_lvl_tbl1 = ex.body.body.rhs.tns.bind.lvl.tbl[1] | ||
arr_2_lvl_tbl2 = ex.body.body.rhs.tns.bind.lvl.tbl[2] | ||
arr_2_lvl_val = arr_2_lvl.lvl.val | ||
arr_2_lvl.shape[1] == fmt_lvl_2.shape || throw(DimensionMismatch("mismatched dimension limits ($(arr_2_lvl.shape[1]) != $(fmt_lvl_2.shape))")) | ||
arr_2_lvl.shape[2] == fmt_lvl.shape || throw(DimensionMismatch("mismatched dimension limits ($(arr_2_lvl.shape[2]) != $(fmt_lvl.shape))")) | ||
arr_2_lvl_q = arr_2_lvl_ptr[1] | ||
arr_2_lvl_q_stop = arr_2_lvl_ptr[1 + 1] | ||
if arr_2_lvl_q < arr_2_lvl_q_stop | ||
arr_2_lvl_i_stop = arr_2_lvl_tbl2[arr_2_lvl_q_stop - 1] | ||
else | ||
arr_2_lvl_i_stop = 0 | ||
end | ||
phase_stop = min(arr_2_lvl.shape[2], arr_2_lvl_i_stop) | ||
if phase_stop >= 1 | ||
j = 1 | ||
if arr_2_lvl_tbl2[arr_2_lvl_q] < 1 | ||
arr_2_lvl_q = Finch.scansearch(arr_2_lvl_tbl2, 1, arr_2_lvl_q, arr_2_lvl_q_stop - 1) | ||
end | ||
while j <= phase_stop | ||
arr_2_lvl_i = arr_2_lvl_tbl2[arr_2_lvl_q] | ||
arr_2_lvl_q_step = arr_2_lvl_q | ||
if arr_2_lvl_tbl2[arr_2_lvl_q] == arr_2_lvl_i | ||
arr_2_lvl_q_step = Finch.scansearch(arr_2_lvl_tbl2, arr_2_lvl_i + 1, arr_2_lvl_q, arr_2_lvl_q_stop - 1) | ||
end | ||
phase_stop_2 = min(phase_stop, arr_2_lvl_i) | ||
if arr_2_lvl_i == phase_stop_2 | ||
fmt_lvl_q = (1 - 1) * fmt_lvl.shape + phase_stop_2 | ||
arr_2_lvl_q_2 = arr_2_lvl_q | ||
if arr_2_lvl_q < arr_2_lvl_q_step | ||
arr_2_lvl_i_stop_2 = arr_2_lvl_tbl1[arr_2_lvl_q_step - 1] | ||
else | ||
arr_2_lvl_i_stop_2 = 0 | ||
end | ||
phase_stop_3 = min(arr_2_lvl.shape[1], arr_2_lvl_i_stop_2) | ||
if phase_stop_3 >= 1 | ||
i = 1 | ||
if arr_2_lvl_tbl1[arr_2_lvl_q] < 1 | ||
arr_2_lvl_q_2 = Finch.scansearch(arr_2_lvl_tbl1, 1, arr_2_lvl_q, arr_2_lvl_q_step - 1) | ||
end | ||
while i <= phase_stop_3 | ||
arr_2_lvl_i_2 = arr_2_lvl_tbl1[arr_2_lvl_q_2] | ||
phase_stop_4 = min(phase_stop_3, arr_2_lvl_i_2) | ||
if arr_2_lvl_i_2 == phase_stop_4 | ||
arr_2_lvl_2_val = arr_2_lvl_val[arr_2_lvl_q_2] | ||
fmt_lvl_2_q = (fmt_lvl_q - 1) * fmt_lvl_2.shape + phase_stop_4 | ||
fmt_lvl_2_val[fmt_lvl_2_q] = arr_2_lvl_2_val + fmt_lvl_2_val[fmt_lvl_2_q] | ||
if !(fmt_lvl_tbl[fmt_lvl_2_q]) | ||
fmt_lvl_tbl[fmt_lvl_2_q] = true | ||
fmt_lvl_2_qos_fill += 1 | ||
if fmt_lvl_2_qos_fill > fmt_lvl_2_qos_stop | ||
fmt_lvl_2_qos_stop = max(fmt_lvl_2_qos_stop << 1, 1) | ||
Finch.resize_if_smaller!(fmt_lvl_srt, fmt_lvl_2_qos_stop) | ||
end | ||
fmt_lvl_srt[fmt_lvl_2_qos_fill] = (fmt_lvl_q, phase_stop_4) | ||
end | ||
arr_2_lvl_q_2 += 1 | ||
end | ||
i = phase_stop_4 + 1 | ||
end | ||
end | ||
arr_2_lvl_q = arr_2_lvl_q_step | ||
end | ||
j = phase_stop_2 + 1 | ||
end | ||
end | ||
sort!(view(fmt_lvl_srt, 1:fmt_lvl_2_qos_fill)) | ||
fmt_lvl_2_p_prev = 0 | ||
for fmt_lvl_2_r = 1:fmt_lvl_2_qos_fill | ||
fmt_lvl_2_p_2 = first(fmt_lvl_srt[fmt_lvl_2_r]) | ||
if fmt_lvl_2_p_2 != fmt_lvl_2_p_prev | ||
fmt_lvl_ptr[fmt_lvl_2_p_prev + 1] = fmt_lvl_2_r | ||
fmt_lvl_ptr[fmt_lvl_2_p_2] = fmt_lvl_2_r | ||
end | ||
fmt_lvl_2_p_prev = fmt_lvl_2_p_2 | ||
end | ||
fmt_lvl_ptr[fmt_lvl_2_p_2 + 1] = fmt_lvl_2_qos_fill + 1 | ||
qos = 1 * fmt_lvl.shape | ||
resize!(fmt_lvl_ptr, qos + 1) | ||
resize!(fmt_lvl_tbl, qos * fmt_lvl_2.shape) | ||
resize!(fmt_lvl_srt, fmt_lvl_2_qos_fill) | ||
resize!(fmt_lvl_2_val, qos * fmt_lvl_2.shape) | ||
(fmt = Fiber((DenseLevel){Int64}((SparseByteMapLevel){Int64}(fmt_lvl_3, fmt_lvl_2.shape, fmt_lvl_ptr, fmt_lvl_tbl, fmt_lvl_srt), fmt_lvl.shape)),) | ||
end |
97 changes: 97 additions & 0 deletions
97
test/reference64/increment_to_10×10 Fiber!(Dense(SparseHash{1}(Element(0.0)))).jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
begin | ||
fmt_lvl = ex.body.body.lhs.tns.bind.lvl | ||
fmt_lvl_2 = fmt_lvl.lvl | ||
fmt_lvl_2_qos_fill = length(fmt_lvl_2.tbl) | ||
fmt_lvl_2_qos_stop = fmt_lvl_2_qos_fill | ||
fmt_lvl_ptr = fmt_lvl.lvl.ptr | ||
fmt_lvl_tbl = fmt_lvl.lvl.tbl | ||
fmt_lvl_srt = fmt_lvl.lvl.srt | ||
fmt_lvl_3 = fmt_lvl_2.lvl | ||
fmt_lvl_2_val = fmt_lvl_2.lvl.val | ||
arr_2_lvl = ex.body.body.rhs.tns.bind.lvl | ||
arr_2_lvl_ptr = ex.body.body.rhs.tns.bind.lvl.ptr | ||
arr_2_lvl_tbl1 = ex.body.body.rhs.tns.bind.lvl.tbl[1] | ||
arr_2_lvl_tbl2 = ex.body.body.rhs.tns.bind.lvl.tbl[2] | ||
arr_2_lvl_val = arr_2_lvl.lvl.val | ||
arr_2_lvl.shape[1] == fmt_lvl_2.shape[1] || throw(DimensionMismatch("mismatched dimension limits ($(arr_2_lvl.shape[1]) != $(fmt_lvl_2.shape[1]))")) | ||
arr_2_lvl.shape[2] == fmt_lvl.shape || throw(DimensionMismatch("mismatched dimension limits ($(arr_2_lvl.shape[2]) != $(fmt_lvl.shape))")) | ||
for fmt_lvl_2_p = 1 * fmt_lvl.shape:-1:1 | ||
fmt_lvl_ptr[fmt_lvl_2_p + 1] = fmt_lvl_ptr[fmt_lvl_2_p + 1] - fmt_lvl_ptr[fmt_lvl_2_p] | ||
end | ||
fmt_lvl_ptr[1] = 1 | ||
fmt_lvl_2_qos_fill = length(fmt_lvl_tbl) | ||
arr_2_lvl_q = arr_2_lvl_ptr[1] | ||
arr_2_lvl_q_stop = arr_2_lvl_ptr[1 + 1] | ||
if arr_2_lvl_q < arr_2_lvl_q_stop | ||
arr_2_lvl_i_stop = arr_2_lvl_tbl2[arr_2_lvl_q_stop - 1] | ||
else | ||
arr_2_lvl_i_stop = 0 | ||
end | ||
phase_stop = min(arr_2_lvl.shape[2], arr_2_lvl_i_stop) | ||
if phase_stop >= 1 | ||
j = 1 | ||
if arr_2_lvl_tbl2[arr_2_lvl_q] < 1 | ||
arr_2_lvl_q = Finch.scansearch(arr_2_lvl_tbl2, 1, arr_2_lvl_q, arr_2_lvl_q_stop - 1) | ||
end | ||
while j <= phase_stop | ||
arr_2_lvl_i = arr_2_lvl_tbl2[arr_2_lvl_q] | ||
arr_2_lvl_q_step = arr_2_lvl_q | ||
if arr_2_lvl_tbl2[arr_2_lvl_q] == arr_2_lvl_i | ||
arr_2_lvl_q_step = Finch.scansearch(arr_2_lvl_tbl2, arr_2_lvl_i + 1, arr_2_lvl_q, arr_2_lvl_q_stop - 1) | ||
end | ||
phase_stop_2 = min(phase_stop, arr_2_lvl_i) | ||
if arr_2_lvl_i == phase_stop_2 | ||
fmt_lvl_q = (1 - 1) * fmt_lvl.shape + phase_stop_2 | ||
arr_2_lvl_q_2 = arr_2_lvl_q | ||
if arr_2_lvl_q < arr_2_lvl_q_step | ||
arr_2_lvl_i_stop_2 = arr_2_lvl_tbl1[arr_2_lvl_q_step - 1] | ||
else | ||
arr_2_lvl_i_stop_2 = 0 | ||
end | ||
phase_stop_3 = min(arr_2_lvl.shape[1], arr_2_lvl_i_stop_2) | ||
if phase_stop_3 >= 1 | ||
i = 1 | ||
if arr_2_lvl_tbl1[arr_2_lvl_q] < 1 | ||
arr_2_lvl_q_2 = Finch.scansearch(arr_2_lvl_tbl1, 1, arr_2_lvl_q, arr_2_lvl_q_step - 1) | ||
end | ||
while i <= phase_stop_3 | ||
arr_2_lvl_i_2 = arr_2_lvl_tbl1[arr_2_lvl_q_2] | ||
phase_stop_4 = min(phase_stop_3, arr_2_lvl_i_2) | ||
if arr_2_lvl_i_2 == phase_stop_4 | ||
arr_2_lvl_2_val = arr_2_lvl_val[arr_2_lvl_q_2] | ||
fmt_lvl_2_key = (fmt_lvl_q, (phase_stop_4,)) | ||
fmt_lvl_2_q = get(fmt_lvl_tbl, fmt_lvl_2_key, fmt_lvl_2_qos_fill + 1) | ||
if fmt_lvl_2_q > fmt_lvl_2_qos_stop | ||
fmt_lvl_2_qos_stop = max(fmt_lvl_2_qos_stop << 1, 1) | ||
Finch.resize_if_smaller!(fmt_lvl_2_val, fmt_lvl_2_qos_stop) | ||
Finch.fill_range!(fmt_lvl_2_val, 0.0, fmt_lvl_2_q, fmt_lvl_2_qos_stop) | ||
end | ||
fmt_lvl_2_val[fmt_lvl_2_q] = arr_2_lvl_2_val + fmt_lvl_2_val[fmt_lvl_2_q] | ||
if fmt_lvl_2_q > fmt_lvl_2_qos_fill | ||
fmt_lvl_2_qos_fill = fmt_lvl_2_q | ||
fmt_lvl_tbl[fmt_lvl_2_key] = fmt_lvl_2_q | ||
fmt_lvl_ptr[fmt_lvl_q + 1] += 1 | ||
end | ||
arr_2_lvl_q_2 += 1 | ||
end | ||
i = phase_stop_4 + 1 | ||
end | ||
end | ||
arr_2_lvl_q = arr_2_lvl_q_step | ||
end | ||
j = phase_stop_2 + 1 | ||
end | ||
end | ||
resize!(fmt_lvl_srt, length(fmt_lvl_tbl)) | ||
copyto!(fmt_lvl_srt, pairs(fmt_lvl_tbl)) | ||
sort!(fmt_lvl_srt, by = hashkeycmp) | ||
for p = 2:fmt_lvl.shape + 1 | ||
fmt_lvl_ptr[p] += fmt_lvl_ptr[p - 1] | ||
end | ||
qos = 1 * fmt_lvl.shape | ||
resize!(fmt_lvl_ptr, qos + 1) | ||
qos_2 = fmt_lvl_ptr[end] - 1 | ||
resize!(fmt_lvl_srt, qos_2) | ||
resize!(fmt_lvl_2_val, qos_2) | ||
(fmt = Fiber((DenseLevel){Int64}((SparseHashLevel){1, Tuple{Int64}}(fmt_lvl_3, (fmt_lvl_2.shape[1],), fmt_lvl_ptr, fmt_lvl_tbl, fmt_lvl_srt), fmt_lvl.shape)),) | ||
end |
Oops, something went wrong.