[Openmp-dev] Status of detached tasks in Clang
Joseph Schuchart via Openmp-dev
openmp-dev at lists.llvm.org
Mon May 11 08:59:20 PDT 2020
Thanks Joachim for looking into this. For the record, the patch you
posted at https://reviews.llvm.org/D79702 seems to fix the race for me.
I was able to run several different configurations and the issues to be
gone.
Cheers
Joseph
On 5/8/20 6:15 PM, Joachim Protze wrote:
> Hi all,
>
> I looked a bit into this issue. As I understand the code, there is a
> race between __kmp_task_finish and __kmp_fulfill_event:
>
> From my perspective, all accesses to taskdata need to happen before
>
> https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_tasking.cpp#L873
>
> taskdata->td_flags.proxy = TASK_PROXY;
>
> taskdata cannot be safely accessed after this line.
>
> __kmp_task_finish () "passes ownership of taskdata" with this line.
>
> At this point, __kmp_fulfill_event might release the task at any time.
>
> Joseph sees a spurious assertion failure in
> https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_tasking.cpp#L710
>
>
> This is, when
> https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_tasking.cpp#L906
>
> is not reached fast enough.
>
> Can the accesses be safely moved up?
>
> Best
> Joachim
>
>
> Am 08.04.20 um 14:02 schrieb Joseph Schuchart via Openmp-dev:
>> Johannes, Alexey,
>>
>> Thanks for the pointers. I will try to call in to the telco tomorrow.
>>
>> In the meantime: I was able to install trunk and run tests with
>> detached tasks. However, every once in a while I end up in an assert
>> inside libomp:
>>
>> OMP: Error #13: Assertion failure at kmp_tasking.cpp(920).
>>
>> The relevant code is in __kmp_task_finish:
>>
>> if (taskdata->td_flags.destructors_thunk) {
>> kmp_routine_entry_t destr_thunk = task->data1.destructors;
>> KMP_ASSERT(destr_thunk); // <- this assert triggers
>> destr_thunk(gtid, task);
>> }
>>
>>
>> My first suspicion is that there is a race condition when one thread
>> fulfills the event while the executing task completes it. I have not
>> been able to spot this issue in the code but maybe someone familiar
>> with it has an idea about what might be going wrong?
>>
>> Thanks,
>> Joseph
>>
>> On 4/4/20 6:20 PM, Johannes Doerfert wrote:
>>> Hi Joseph,
>>>
>>>
>>> I'm not sure who is working on this but we might be able to figure
>>> this out on our bi-weekly call Wednesday.
>>>
>>> Feel free to call but we should figure this out either way.
>>>
>>>
>>> Apologies for the delay,
>>>
>>> Johannes
>>>
>>>
>>>
>>> On 4/3/20 7:18 AM, Joseph Schuchart via Openmp-dev wrote:
>>>> Dear all,
>>>>
>>>> I am eager to play around with detached tasks in OpenMP. It seems
>>>> that support has gone into the runtime about a year ago [1] but even
>>>> with Clang 10 I get a warning that the detach clause is ignored:
>>>>
>>>> $ clang-10 -fopenmp test_detached.c
>>>> test_detached.c:25:47: warning: extra tokens at the end of '#pragma
>>>> omp task' are ignored [-Wextra-tokens]
>>>> #pragma omp task detach(event)
>>>>
>>>> The status website lists detached tasks as work in progress [2]. Is
>>>> there a way to try detached tasks in some experimental version of
>>>> Clang? Or am I just missing a flag to enable them in the Clang release?
>>>>
>>>> Thanks a lot,
>>>> Joseph
>>>>
>>>> [1] https://reviews.llvm.org/D62485
>>>> [2] https://clang.llvm.org/docs/OpenMPSupport.html
>>>> _______________________________________________
>>>> 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