You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Flang][mlir] - Translation of delayed privatization for deferred target-tasks
This patch adds support for translation of the private clause on deferred
target tasks - that is `omp.target` operations with the `nowait` clause.
An offloading call for a deferred target-task is not blocking - the offloading
host task continues it execution after issuing the offloading call. Therefore,
the key problem we need to solve is to ensure that the data needed for private
variables to be initialized in the target task persists even after the host
task has completed.
We do this in a new pass called PrepareForOMPOffloadPrivatizationPass. For a privatized
variable that needs its host counterpart for initialization (such as the shape
of the data from the descriptor when an allocatable is privatized or the value of
the data when an allocatable is firstprivatized),
- the pass allocates memory on the heap.
- it then initializes this memory by copying the contents of host variable to
the newly allocated location on the heap.
- Then, the pass updates all the `omp.map.info` operations that pointed to the
host variable to now point to the one located in the heap.
The pass uses a rewrite pattern applied using the greedy pattern matcher, which
in turn does some constant folding and DCE. Due to this a number of lit tests
had to be updated. In GEPs constant get folded into indices and truncated to
i32 types. In some tests sequence of insertvalue and extractvalue instructions
get cancelled out. So, these needed to be updated too.
0 commit comments