@@ -881,9 +881,9 @@ function create_lib(tokenLib::TokenLib, features::Vector{Int8},
881881 end
882882
883883 lib_array = collect (lib)
884- Threads. @threads for i in eachindex (lib_array)
884+ Threads. @threads :static for i in eachindex (lib_array)
885885 entry = lib_array[i]
886- local_entries = new_entries_local[Threads. threadid ()]
886+ local_entries = new_entries_local[mod1 ( Threads. threadid (), Threads . nthreads () )]
887887 for item in search_space
888888 new_entry = copy (entry)
889889 append! (new_entry, item)
@@ -917,11 +917,11 @@ function reorganize_lib(old_lib::Set{LibEntry})
917917 local_libs = [OrderedDict {Tuple{Vector{Float16},Int},Vector{Vector{Int8}}} () for _ in 1 : Threads. nthreads ()]
918918
919919 old_lib_array = collect (old_lib) # Convert Set to Array
920- Threads. @threads for i in eachindex (old_lib_array)
920+ Threads. @threads :static for i in eachindex (old_lib_array)
921921 entry = old_lib_array[i]
922922 clean! (entry)
923923 key = (entry. physical_dimension, length (entry. elements))
924- local_lib = local_libs[Threads. threadid ()]
924+ local_lib = local_libs[mod1 ( Threads. threadid (), Threads . nthreads () )]
925925
926926 if haskey (local_lib, key)
927927 push! (local_lib[key], entry. elements)
@@ -1174,7 +1174,7 @@ function calculate_contribution(tree::TempComputeTree, expected_dim::Vector{Floa
11741174end
11751175
11761176function check_crit_up! (len_rest:: Int , expected_dim:: Vector{Float16} , tree:: TempComputeTree )
1177- @inbounds for elem in len_rest: - 1 : SMALLEST_TREE_SEGMENT
1177+ @inbounds for elem in len_rest: - 1 : max ( SMALLEST_TREE_SEGMENT,len_rest - SMALLEST_TREE_SEGMENT * 2 )
11781178 if haskey (tree. tokenDto. lib[], (expected_dim, elem))
11791179 tree. exchange_len = elem
11801180 return true
@@ -1448,7 +1448,7 @@ function propagate_necessary_changes!(
14481448 return true
14491449 end
14501450
1451- if check_crit_up! (tree. depend_on_total_number + 1 , expected_dim, tree) && distance_to_change <= 0 && rand () > 0.01
1451+ if check_crit_up! (tree. depend_on_total_number + 1 , expected_dim, tree) && distance_to_change <= 0 && rand () > 0.05
14521452 return enforce_changes! (tree, expected_dim)
14531453 end
14541454
0 commit comments