stfc / RegentParticleDSL

A particle-method DSL based on Regent programming language
MIT License
1 stars 0 forks source link

[BUG] Accesses to arrays inside field spaces does not compute privileges correctly #88

Closed LonelyCat124 closed 3 years ago

LonelyCat124 commented 3 years ago

With a field space containing an array, e.g.

fspace{
   myArray : int64[32]
}

kernels making use of the array do not correctly compute privileges for these array accesses, so compilation will fail.

LonelyCat124 commented 3 years ago

An implementation of this exists in the DL_MESO_IO branch oftwo_region_privilege_map for Assignments only:

    if(node.lhs[1]:is(ast.specialized.expr.FieldAccess)) then
        local name, symbol = traverse_fieldaccess_postorder_two_region(node.lhs[1],sym1, sym2)
      if(symbol == 1) then
        write_sym1:insert(name)
      elseif(symbol == 2) then
        write_sym2:insert(name)
      end
    else
        --For array accesses, we recurse until we find a non-array access and then check if its a FieldAccess                                                                      if node.lhs[1]:is(ast.specialized.expr.IndexAccess) then
            local z = node.lhs[1]
            while z.value:is(ast.specialized.expr.IndexAccess) do
                z = z.value
            end
            if z.value:is(ast.specialized.expr.FieldAccess) then
                local name, symbol = traverse_fieldaccess_postorder_two_region(z.value,sym1, sym2)
                if(symbol == 1) then
                    write_sym1:insert(name)
                elseif(symbol == 2) then
                    write_sym2:insert(name)
                end
            end
        end
    end

This needs to be extended (into a function probably) to apply to other parts of the compute_privilege code

LonelyCat124 commented 3 years ago

This is now fully implemented in the dl_meso branch.