[PATCH] OpenACC reference count overhaul

Chung-Lin Tang chunglin_tang@mentor.com
Wed Dec 11 07:37:00 GMT 2019


On 2019/12/10 12:04 AM, Julian Brown wrote:
>> I'm citing below the changes introducing 'gomp_remove_var_async',
>> modelled similar to the existing 'gomp_unmap_vars_async'.
>>
>>
>> Also for both these, do I understand correctly, that it's actually not
>> the 'gomp_unref_tgt' that needs to be "delayed" via
>> 'goacc_asyncqueue', but rather really only the
>> 'gomp_free_device_memory', called via 'gomp_unmap_tgt', called via
>> 'gomp_unref_tgt'?  In other words: why do we need to keep the 'struct
>> target_mem_desc' alive?  Per my understanding, that one is one
>> component of the mapping table, and not relevant anymore (thus can be
>> 'free'd) as soon as it has been determined that 'tgt->refcount ==
>> 0'?  Am I missing something there?
> IIRC, that was Chung-Lin's choice. I'll CC him in. I think delaying
> freeing of the target_mem_desc isn't really a huge problem, in practice.

I don't clearly remember all the details. It could be possible that not
asyncqueue-ifying gomp_remove_var was simply an overlook.

The 'target_mem_desc' is supposed to represent the piece of device memory
inside libgomp, so unref/freeing it only after all dev-to-host copying is
done seems logical.

Chung-Lin



More information about the Gcc-patches mailing list