Add Intel SIMD vectorization directives to hot-spot functions
Apply Intel Advisor optimization recommendations: - Add FORCEINLINE to polint for better inlining - Add SIMD VECTORLENGTHFOR and UNROLL directives to fderivs, fdderivs, symmetry_bd, and kodis functions This improves vectorization efficiency of finite difference computations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -69,10 +69,12 @@
|
|||||||
fy = ZEO
|
fy = ZEO
|
||||||
fz = ZEO
|
fz = ZEO
|
||||||
|
|
||||||
|
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
||||||
|
!DIR$ UNROLL PARTIAL(4)
|
||||||
do k=1,ex(3)-1
|
do k=1,ex(3)-1
|
||||||
do j=1,ex(2)-1
|
do j=1,ex(2)-1
|
||||||
do i=1,ex(1)-1
|
do i=1,ex(1)-1
|
||||||
! x direction
|
! x direction
|
||||||
if(i+1 <= imax .and. i-1 >= imin)then
|
if(i+1 <= imax .and. i-1 >= imin)then
|
||||||
!
|
!
|
||||||
! - f(i-1) + f(i+1)
|
! - f(i-1) + f(i+1)
|
||||||
@@ -371,6 +373,8 @@
|
|||||||
fxz = ZEO
|
fxz = ZEO
|
||||||
fyz = ZEO
|
fyz = ZEO
|
||||||
|
|
||||||
|
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
||||||
|
!DIR$ UNROLL PARTIAL(4)
|
||||||
do k=1,ex(3)-1
|
do k=1,ex(3)-1
|
||||||
do j=1,ex(2)-1
|
do j=1,ex(2)-1
|
||||||
do i=1,ex(1)-1
|
do i=1,ex(1)-1
|
||||||
|
|||||||
@@ -883,13 +883,17 @@ subroutine symmetry_bd(ord,extc,func,funcc,SoA)
|
|||||||
|
|
||||||
integer::i
|
integer::i
|
||||||
|
|
||||||
|
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
||||||
funcc(1:extc(1),1:extc(2),1:extc(3)) = func
|
funcc(1:extc(1),1:extc(2),1:extc(3)) = func
|
||||||
|
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
||||||
do i=0,ord-1
|
do i=0,ord-1
|
||||||
funcc(-i,1:extc(2),1:extc(3)) = funcc(i+1,1:extc(2),1:extc(3))*SoA(1)
|
funcc(-i,1:extc(2),1:extc(3)) = funcc(i+1,1:extc(2),1:extc(3))*SoA(1)
|
||||||
enddo
|
enddo
|
||||||
|
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
||||||
do i=0,ord-1
|
do i=0,ord-1
|
||||||
funcc(:,-i,1:extc(3)) = funcc(:,i+1,1:extc(3))*SoA(2)
|
funcc(:,-i,1:extc(3)) = funcc(:,i+1,1:extc(3))*SoA(2)
|
||||||
enddo
|
enddo
|
||||||
|
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
||||||
do i=0,ord-1
|
do i=0,ord-1
|
||||||
funcc(:,:,-i) = funcc(:,:,i+1)*SoA(3)
|
funcc(:,:,-i) = funcc(:,:,i+1)*SoA(3)
|
||||||
enddo
|
enddo
|
||||||
@@ -1112,6 +1116,7 @@ end subroutine d2dump
|
|||||||
! Lagrangian polynomial interpolation
|
! Lagrangian polynomial interpolation
|
||||||
!------------------------------------------------------------------------------
|
!------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
!DIR$ ATTRIBUTES FORCEINLINE :: polint
|
||||||
subroutine polint(xa, ya, x, y, dy, ordn)
|
subroutine polint(xa, ya, x, y, dy, ordn)
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ real*8,intent(in) :: eps
|
|||||||
! dx^4
|
! dx^4
|
||||||
|
|
||||||
! note the sign (-1)^r-1, now r=2
|
! note the sign (-1)^r-1, now r=2
|
||||||
|
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
||||||
|
!DIR$ UNROLL PARTIAL(4)
|
||||||
do k=1,ex(3)
|
do k=1,ex(3)
|
||||||
do j=1,ex(2)
|
do j=1,ex(2)
|
||||||
do i=1,ex(1)
|
do i=1,ex(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user