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
- Repository
- rG LLVM Github Monorepo
Event Timeline
Fixes from review feedback. Rebase.
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | ||
---|---|---|
4428 | Even if it is, it should not be part of this patch. I will remove it. Good catch. | |
4440 | 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 | ||
---|---|---|
4448 | Expand type here. | |
4453 | This allows debug info to be accurately generated. | |
4490–4493 | No need to explicitly specify OpenMPIRBuilder namespace here. | |
4491 | Same, remove explicit namespace. | |
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp | ||
5123–5124 | Maybe we can replace this with OMPBuilder.getOrCreateDefaultSrcLocStr? Also it is fine to leave the Names empty if not available. | |
5130 | 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 | ||
---|---|---|
5175–5191 | Nit: leftover debug? |
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp | ||
---|---|---|
5175–5191 |
Yes, thank you for finding that. I will remove this and update the parameter names CreateDefaultMapInfos. |
Is the AllocaIP expected to be used later?