Skip to content

Commit

Permalink
Add @const which does not impact performance
Browse files Browse the repository at this point in the history
  • Loading branch information
roflmaostc committed Feb 11, 2024
1 parent bfa7919 commit 00d8398
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/backproject.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ function _backproject(sinogram::AbstractArray{T, 3}, angles_T::AbstractVector, g
return img
end

@kernel function backproject_kernel2!(img::AbstractArray{T}, sinogram::AbstractArray{T}, weights, in_height,
out_height, angles, mid, radius, absorb_f) where {T}
@kernel function backproject_kernel2!(img::AbstractArray{T}, @Const(sinogram), @Const(weights), @Const(in_height),
@Const(out_height), @Const(angles), mid, radius, absorb_f) where {T}
i, iangle, i_z = @index(Global, NTuple)

@inbounds sinα, cosα = sincos(angles[iangle])
Expand Down
4 changes: 2 additions & 2 deletions src/radon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ end

@inline inside_circ(ii, jj, mid, radius) = (ii - mid)^2 + (jj - mid)^2 radius ^2

@kernel function radon_kernel!(sinogram::AbstractArray{T}, img::AbstractArray{T},
weights, in_height, out_height, angles, mid,
@kernel function radon_kernel!(sinogram::AbstractArray{T}, @Const(img),
@Const(weights), @Const(in_height), @Const(out_height), @Const(angles), mid,
radius, absorb_f) where {T}
i, iangle, i_z = @index(Global, NTuple)

Expand Down

0 comments on commit 00d8398

Please sign in to comment.