-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OpenMP] Fix issue of indirect function call in __kmpc_fork_call_if
#65436
Conversation
The outlined function is typically invoked by using `__kmp_invoke_microtask`, which is written in asm. D138495 introduces a new interface function for parallel region for OpenMPIRBuilder, where the outlined function is called via the function pointer. For some reason, it works perfectly well on x86 and x86-64 system, but doesn't work on aarch64. The 3rd argument in the callee is always `nullptr`, even if it is not in caller. It appears `x2` always contains `0x0`. This patch adopts the typical method to invoke the function pointer. It works on my M2 Ultra Mac. Fix llvm#63194.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It might be worth clarifying in the commit message that this fix is for macOS AArch64 rather than AArch64 in genral, as this does work already on Linux.
Seeing the following compilation errors with this change:
Can be fixed by replacing the added #ifdef OMPT_SUPPORT with #if OMPT_SUPPORT:
|
Yeah, thanks for that. Fixed. |
…llvm#65436) The outlined function is typically invoked by using `__kmp_invoke_microtask`, which is written in asm. D138495 introduces a new interface function for parallel region for OpenMPIRBuilder, where the outlined function is called via the function pointer. For some reason, it works perfectly well on x86 and x86-64 system, but doesn't work on Apple Silicon. The 3rd argument in the callee is always `nullptr`, even if it is not in caller. It appears `x2` always contains `0x0`. This patch adopts the typical method to invoke the function pointer. It works on my M2 Ultra Mac. Fix llvm#63194.
__kmp_invoke_microtask(VOLATILE_CAST(microtask_t) microtask, gtid, | ||
/*npr=*/0, | ||
/*argc=*/0, | ||
/*args=*/nullptr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shiltian This null pointer is causing segmentation fault in one of the flang test. I am new to Openmp runtimes, Could you please share what was the intention behind using nullptr here and can it be replaced with &args ?
The outlined function is typically invoked by using
__kmp_invoke_microtask
,which is written in asm. D138495 introduces a new interface function for parallel
region for OpenMPIRBuilder, where the outlined function is called via the function
pointer. For some reason, it works perfectly well on x86 and x86-64 system, but
doesn't work on Apple Silicon. The 3rd argument in the callee is always
nullptr
, evenif it is not in caller. It appears
x2
always contains0x0
. This patch adoptsthe typical method to invoke the function pointer. It works on my M2 Ultra Mac.
Fix #63194.