Skip to content

Commit

Permalink
comment on 63 byte additions.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Sep 1, 2022
1 parent 254afc2 commit 8421c1b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/memory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ end
end

function required_bytes(::Val{T}, layers, sx, additional = static(0)) where {T}
# we add 63 extra bytes to make sure we can bring the pointer to 64 byte alignment.
output_size(Val(T), layers, sx) + additional + static(63)
end
function required_bytes(
Expand All @@ -59,9 +60,11 @@ function required_bytes(
nthread,
) where {T}
base_mem_per_thread = output_size(Val(T), layers, sx) + additional_per_thread
# we add 63 extra bytes to make sure we can bring the pointer to 64 byte alignment.
base_mem_per_thread, additional + base_mem_per_thread * nthread + static(63)
end
function required_forward_bytes(::Val{T}, layers, sx, additional = static(0)) where {T}
# we add 63 extra bytes to make sure we can bring the pointer to 64 byte alignment.
forward_output_size(Val(T), layers, sx) + additional + static(63)
end

Expand Down

0 comments on commit 8421c1b

Please sign in to comment.