PSyclone icon indicating copy to clipboard operation
PSyclone copied to clipboard

DependencyAnalysis misses dependency on non-exhaustive write-write

Open sergisiso opened this issue 4 months ago • 9 comments

@hiker This is a simplified version of an issue we hit on NEMOv5, here my_val sometimes keeps its value for the next iteration, so it is essentially serialising the loop. Could we do something about this?

def test_new(fortran_reader):
    '''Tests can_loop_be_parallelised.'''
    source = '''program test
                integer :: i, my_val
                integer, dimension(10) :: array

                do i = 1, 10
                  if (array(i) > 3) then
                    my_val = array(i)
                    array(i) = my_val
                  else
                    array(i) = my_val
                  endif
                end do

                end program test'''

    psyir = fortran_reader.psyir_from_source(source)
    loop = psyir.children[0].children[0]
    dep_tools = DependencyTools()
    parallel = dep_tools.can_loop_be_parallelised(loop)
    assert parallel is False

sergisiso avatar Oct 01 '24 15:10 sergisiso