Skip to content

Commit d7259dd

Browse files
committed
Added a few array wrap/unwrap functions that could be used to stop allocations when arrays are wrapped in transpose/adjoint/subarray objects and passed to a non-inlined function. Not using them yet.
1 parent a73a101 commit d7259dd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/condense_loopset.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ function add_external_functions!(q::Expr, ls::LoopSet)
178178
end
179179
end
180180

181+
@inline unwrap_array(A) = A
182+
@inline unwrap_array(A::Union{SubArray,Transpose,Adjoint}) = parent(A)
183+
@inline array_wrapper(A) = nothing
184+
@inline array_wrapper(A::Transpose) = Transpose
185+
@inline array_wrapper(A::Adjoint) = Adjoint
186+
@inline array_wrapper(A::SubArray) = A.indices
187+
181188
# Try to condense in type stable manner
182189
function generate_call(ls::LoopSet, IUT)
183190
operation_descriptions = Expr(:curly, :Tuple)

0 commit comments

Comments
 (0)