I have been considering for a while when to inline or use declare simd
in a simd loop. I came across this article which the OP has similar question, but the answer is rather not clear to me.
I have two questions:
1) Is it considered a bug to have both declare simd(function_name)
and an inline directive like !DIR$ ATTRIBUTES::FORCEINLINE(function_name)
.
2) How to know which one to use?
A basic example
!DIR$ ATTRIBUTES :: FORCEINLINE(call_insimd)
!$OMP DECLARE SIMD(call_insimd)
function call_insimd(a,b) result(res)
implicit none
real, intent(in) :: a,b
real, intent(out):: res
end function
In main loop
do i = 1,10000
!dir$ forceinline
ar(i) = call_insimd(gf(i),df(i))
enddo