I was going through some examples of generated functions in StaticArrays and I came across the following code snippet with the seemingly unearthly syntax of @_inline_meta
and the 2 return statements. I would appreciate an earthly explanation for that and why it is necessary, thank you!
@generated function _A_mul_B(Sa::Size{sa}, Sb::Size{sb}, a::StaticMatrix{<:Any, <:Any, Ta}, b::StaticMatrix{<:Any, <:Any, Tb}) where {sa, sb, Ta, Tb}
# Heuristic choice for amount of codegen
if sa[1]*sa[2]*sb[2] <= 8*8*8
return quote
@_inline_meta
return A_mul_B_unrolled(Sa, Sb, a, b)
end
elseif sa[1] <= 14 && sa[2] <= 14 && sb[2] <= 14
return quote
@_inline_meta
return A_mul_B_unrolled_chunks(Sa, Sb, a, b)
end
else
return quote
@_inline_meta
return A_mul_B_loop(Sa, Sb, a, b)
end
end
end