Skip to content

Commit 926d794

Browse files
committed
Stop calling CUDA.@sync inside of chacha_blocks!
1 parent 1d3c43d commit 926d794

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/ChaCha.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ function chacha_blocks!(
194194
@cuda blocks=chunk_blocks _cuda_chacha_add_initial_state!(state, key, nonce, counter)
195195
end
196196

197-
counter += nblocks
198-
counter
197+
counter + nblocks
199198
end
200199

201200
function _cuda_chacha_rounds!(state, doublerounds)
@@ -231,7 +230,7 @@ function _cuda_chacha_rounds!(state, doublerounds)
231230
nothing
232231
end
233232

234-
export CHACHA_BLOCK_SIZE
233+
export CHACHA_BLOCK_SIZE, CHACHA_BLOCK_SIZE_U32
235234
export chacha_blocks!
236235

237236
end # module

test/test_chacha.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ end
203203
counter = UInt64(0)
204204

205205
ctr = chacha_blocks!(state, key, nonce, counter, 1024 ÷ 16)
206-
ctr_gpu = chacha_blocks!(state_gpu, key_gpu, nonce, counter, 1024 ÷ 16)
206+
CUDA.@sync ctr_gpu = chacha_blocks!(state_gpu, key_gpu, nonce, counter, 1024 ÷ 16)
207207

208208
@test ctr == ctr_gpu
209209
@test state_gpu == CuArray(state)

0 commit comments

Comments
 (0)