kiranchandramohan wrote:

> @kiranchandramohan I discussed the current approach with @skatrak today. When 
> trying to implement the mapper lowering for the map clause, it became 
> apparent that we need to add the `declMapperOp` name to the `SymbolTable`. As 
> such, we would also need to hoist the `declareMapperOp` to the `ModuleOp`.
> 
> I am however struggling with name mangling the `declMapperOp` such that 
> scoping information is preserved, and we don't have clashing `declMapperOps` 
> from different nested scopes with the same name.
> 
> Take the following example:
> 
> ```
> program my_prog
>    type my_type
>       integer               :: num
>    end type
>    !$omp declare mapper (my_mapper : my_type :: my_var) map (my_var)
> contains
>    subroutine test
>       type(my_type)            :: xyz
>       !$omp target enter data map(mapper(my_mapper), to: xyz)
>    end subroutine test
> end program my_prog
> ```
> 
> Here after mangling the, `declMapperOp` symbol name becomes `_QQFmy_mapper`. 
> But when trying to mangle the name that occurs in the mapClause before lookup 
> results in `_QQFFtestmy_mapper`.
> 
> Do you know any mechanism in Fortran lowering that could help resolve this 
> issue?

The frontend symbols also are implementing a symbol table. For the example you 
showed, I am assuming the symbol for `my_mapper` in `target enter data map` is 
same as the symbol for my_mapper in `declare mapper`. So, naturally they should 
be mangling to the same name. This is also similar to a variable defined in the 
 program being used in the contained  subroutine. The mangling will follow the 
program's mangling and not the subroutine's mangling. 

Are the symbols not being resolved properly? Or did I miss a point?

https://github.com/llvm/llvm-project/pull/117046
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to