Skip to content

Commit 4fef470

Browse files
committed
use @ batch for StepRange for-loops
1 parent e7e8b79 commit 4fef470

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/codegen/broutine.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ function diagonal_loop(f_kernel, ctx::BitContext)
323323
expanded = expand_loop(kernel, 0, :($(space_length(ctx)) - 1), ctx.expand_sz, ctx.threading)
324324
if ctx.threading
325325
src = :(
326-
Threads.@threads for $m = 0:($(space_length(ctx)) - 1)
326+
@batch for $m = 0:($(space_length(ctx)) - 1)
327327
$(kernel(m))
328328
end
329329
)
@@ -491,7 +491,7 @@ function threaded_subspace_loop(f_kernel, ctx::BitContext, brt::BitRoutine)
491491
subspace_locs = Expr(:tuple, :(1:$m...), [:(plain_locs[$(n-k+1)]) for k in 1:t]...)
492492
subspace_head = :($base = $bsubspace($nqubits, $subspace_locs))
493493
# Expr(:for, subspace_head, x)
494-
:(@batch $(Expr(:for, subspace_head, x)))
494+
:(Threads.@threads $(Expr(:for, subspace_head, x)))
495495
end
496496

497497
push!(ret.args, :(
@@ -568,7 +568,7 @@ function expand_loop(f_kernel, lb, ub, max::Int=3, threading=false)
568568
threading && return quote
569569
$upperbound = $ub
570570
$Mmax = $ub - $lb
571-
Threads.@threads $lbody
571+
@batch $lbody
572572
end
573573

574574
return quote

0 commit comments

Comments
 (0)