[Openmp-dev] Avoid using is_device_ptr clause

Johannes Doerfert via Openmp-dev openmp-dev at lists.llvm.org
Thu Aug 26 15:40:16 PDT 2021


The way I understood your problem is that you want to pass
a device accessible pointer that is not mapped into a target
region, right?

When we implement 5.2 semantics you can pass pointers into
a target region and they will not be nulled but instead retain
their value if no mapping was found. That makes use of
managed or device memory possible without declaring a mapping
or adding the is_device_ptr clause.

For now, you might get around is_device_ptr by type punning,
e.g., cast the pointers into intptr_t before the target region
and back inside.

~ Johannes


On 8/26/21 3:55 PM, Itaru Kitayama via Openmp-dev wrote:
> Joachim, all,
> Is the example you pointed to me just an expansion of
> llvm_omp_tarfet_alloc_shared, then?
>
> On Thu, Aug 26, 2021 at 20:59 Joachim Protze <protze.joachim at gmail.com>
> wrote:
>
>> You can use the target pointer association API (see 5.12 in the new
>> OpenMP Examples 5.1 document). This should help you avoid usage of
>> is_device_ptr and actually get proper mapping behavior.
>>
>> - Joachim
>>
>> Am 26.08.21 um 01:41 schrieb Itaru Kitayama via Openmp-dev:
>>> Is there a way to avoid adding many is_device_ptr clauses every time
>>> program enters the target region? I like the llvm_target_alloc_shared API
>>> can handle internally the device pointer and make it accessible from the
>>> target region as well.
>>> _______________________________________________
>>> Openmp-dev mailing list
>>> Openmp-dev at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>>>
>>
>
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


More information about the Openmp-dev mailing list