Skip to content

[flang][hlfir] Polyhedron/nf 23% performance regression #65426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vzakhari opened this issue Sep 6, 2023 · 3 comments
Closed

[flang][hlfir] Polyhedron/nf 23% performance regression #65426

vzakhari opened this issue Sep 6, 2023 · 3 comments
Assignees
Labels

Comments

@vzakhari
Copy link
Contributor

vzakhari commented Sep 6, 2023

Code with HLFIR lowering runs for 7.4 seconds vs 6 seconds with FIR lowering.

There is some overhead due to extra temporaries at line 261:

256	subroutine NF2DPrecon(x,i1,i2)       ! 2D NF Preconditioning matrix				
257	integer :: i1 , i2				
258	real(dpkind),dimension(i2)::x,t				
259	integer :: i				
260	do i = i1 , i2 , nx				
261	   if ( i>i1 ) x(i:i+nx-1) = x(i:i+nx-1) - au2(i-nx:i-1)*x(i-nx:i-1)
262	   call trisolve(x,i,i+nx-1)				
263	enddo 				
264	do i = i2-2*nx+1 , i1 , -nx				
265	   t(i:i+nx-1) = au2(i:i+nx-1)*x(i+nx:i+2*nx-1)				
266	   call trisolve(t,i,i+nx-1)				
267	   x(i:i+nx-1) = x(i:i+nx-1) - t(i:i+nx-1)				
268	enddo				
269	end subroutine NF2DPrecon            !=========================================				

ArrayValueCopy has special handling for array slices of the form (i:j) and (j+1:k), which allows disambiguating x(i:i+nx-1) with x(i-nx:i-1). We can probably do the same in the optimized bufferization pass or implement something more generic. For example, we can try to use the affine dialect utilities to detect store-load conflicts based on the iteration space constraints derived from the slices configurations and the mapping of the iteration indices to the memory locations (based on the designator indexing).

@github-actions github-actions bot added flang Flang issues not falling into any other category new issue labels Sep 6, 2023
@EugeneZelenko EugeneZelenko added flang:ir and removed new issue flang Flang issues not falling into any other category labels Sep 6, 2023
@vzakhari vzakhari self-assigned this Sep 6, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 6, 2023

@llvm/issue-subscribers-flang-ir

@vzakhari
Copy link
Contributor Author

vzakhari commented Sep 9, 2023

The array sections no-overlap detection merged in #65707

More changes are needed in the alias analysis to disambiguate dummy and host-associated accesses.

@vzakhari
Copy link
Contributor Author

Fixed by #65919

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants