This patch adds code emission in emitTargetCall to call the OpenMP runtime to launch an kernel, and to call the fallback host implementation if the launch fails.
Details
Diff Detail
Event Timeline
Fixes from review feedback. Rebase.
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | ||
---|---|---|
4357 | Even if it is, it should not be part of this patch. I will remove it. Good catch. | |
4370 | It should be the equivalent of llvm::Value *NumThreads = OMPRuntime->emitNumThreadsForTargetDirective(CGF, D); in clang, which looks a bit involved, but is essentially ThreadLimit from what I can tell. |
This patch adds code emission in emitTargetCall to call the OpenMP runtime to launch an kernel, and to call the fallback host implementation if the launch fails.
This is not visible in the IR generated from MLIR. Could you add a test?
Also could @TIFitis review this patch?
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | ||
---|---|---|
4378 | Expand type here. | |
4383 | This allows debug info to be accurately generated. | |
4419–4422 | No need to explicitly specify OpenMPIRBuilder namespace here. | |
4420 | Same, remove explicit namespace. | |
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp | ||
5076–5077 | Maybe we can replace this with OMPBuilder.getOrCreateDefaultSrcLocStr? Also it is fine to leave the Names empty if not available. | |
5083 | Can you please check if this works with function arguments? AFAIK getTypeAllocSize doesn't work on function arguments, in that case we might want to move this function as a callback to MLIR. |
I have not gone through the patch in detail. If you feel the patch is in good shape and @jdoerfert has not further comments you may go ahead.
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp | ||
---|---|---|
5136–5153 | Nit: leftover debug? |
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp | ||
---|---|---|
5136–5153 |
Yes, thank you for finding that. I will remove this and update the parameter names CreateDefaultMapInfos. |
Is the AllocaIP expected to be used later?