This patch fixes the problem that user-defined mapper array is not correctly privatized inside a task. This problem causes openmp/libomptarget/test/offloading/target_depend_nowait.cpp fails.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I tried the patch and indeed it fixes the problem with target_depend_nowait.cpp. I'll let someone else do the review though.
I'm not enough invested in the compiler implementation to judge this patch.
I can confirm that this patch fixes the segmentation fault I have seen.
Are these tests supposed to work for offloading to nvidia GPU as well?
I tried and added:
// RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda
which gives me:
ptxas /tmp/target_depend_nowait-37c5c4.s, line 355; error : Call has wrong number of parameters ptxas /tmp/target_depend_nowait-37c5c4.s, line 628; error : Call has wrong number of parameters ptxas /tmp/target_depend_nowait-37c5c4.s, line 2331; warning : Instruction 'vote' without '.sync' may produce unpredictable results on sm_70 and later architectures ptxas /tmp/target_depend_nowait-37c5c4.s, line 2331; warning : Instruction 'vote' without '.sync' is deprecated since PTX ISA version 6.0 and will be discontinued in a future PTX ISA version ptxas fatal : Ptx assembly aborted due to errors
I guess this error is not directly related to your patch?
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
10524 | Does this mean, that a task is only created if depend clauses are provided? |
The problem you had is probably not related to this patch. A lot of libomptarget tests are not working for nvptx now. I suppose someone is going to fix them.
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
10524 | The case you describe, which is to have a task wrapped around target, is solved with modification on line 9592 |
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
8915 | Do you really need this IsTask flag? The array is created always when Info.NumberOfPtrs > 0. Maybe, just do not check for HasMapper here? | |
10524 | Better to add a flag RequiresOuterTask = D.hasClausesOfKind<OMPDependClause>() and use it here and where the task is generated (line 10455) |
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
8915 | This is an optimization. The mapper array can be optimized out when there is no actual mappers, so supposed to have less memory accesses in this common case. Not checking HasMapper will disable this optimization. | |
10524 | Sure, please accept this patch after that. |
What is the current status of this patch?
@lildmh could you update this patch? I'd like to test it against
https://bugs.llvm.org/show_bug.cgi?id=47122
@ABataev did you ask for a codegen test, or is the runtime test openmp/libomptarget/test/offloading/target_depend_nowait.cpp enough?
The test fails without this patch and succeeds with this patch.
Yes, I know that it fails, but each functional change in the frontend must have the corresponding test in clang itself.
i applied this patch to our downstream build for amdgcn. it resolves the problem i was seeing with traps on tests with task wait depend tests from sollve.
perhaps rebase it to latest llvm.
[AMD Official Use Only - Internal Distribution Only]
Hi Alexey
Any ETA on this one ?
Get Outlook for iOShttps://aka.ms/o0ukef
From: Alexey Bataev via Phabricator <reviews@reviews.llvm.org>
Sent: Tuesday, September 8, 2020 1:39:06 PM
To: lildmh@gmail.com <lildmh@gmail.com>; protze.joachim@gmail.com <protze.joachim@gmail.com>; jdoerfert@anl.gov <jdoerfert@anl.gov>; a.bataev@hotmail.com <a.bataev@hotmail.com>
Cc: Lieberman, Ron <Ron.Lieberman@amd.com>; xw111luoye@gmail.com <xw111luoye@gmail.com>; georgios.rokos@intel.com <georgios.rokos@intel.com>; Liu, Yaxun (Sam) <Yaxun.Liu@amd.com>; zhang.guansong@gmail.com <zhang.guansong@gmail.com>; stefomeister@gmail.com <stefomeister@gmail.com>
Subject: [PATCH] D84470: [OpenMP 5.0] Fix user-defined mapper privatization in tasks
[CAUTION: External Email]
ABataev added a comment.
I can update this patch in a week when I'm back from vacation.
CHANGES SINCE LAST ACTION
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.llvm.org%2FD84470%2Fnew%2F&data=02%7C01%7Cron.lieberman%40amd.com%7C6582a2f2d31d4bbf9b4a08d8541e16cb%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637351835496784231&sdata=8%2BJbFULmzVN%2FdafC0QYX%2B9LwN7d1HFZ9Qxt6k4y85%2FA%3D&reserved=0
Hi Ron, hope to prepare it by the end of this week, maybe earlier, if everything goes well. I have some technical issues, but anyway will update the patch and the tests.
The latest patch applied cleanly to our downstream port.
builds fine, tests very nicely as well. All the failing SOLLVE task wait depend tests now pass.
Do you really need this IsTask flag? The array is created always when Info.NumberOfPtrs > 0. Maybe, just do not check for HasMapper here?