Skip to content

Incorrect entry point obtained by ompd_get_task_function() for the implicit task associated with a serialized parallel region #6

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

Conversation

jinisusan
Copy link
Collaborator

"t_pkfn" of the implicit task associated with a serialized parallel region gets initialized to -1, (due to the code snippet below in kmp_runtime.cpp), and remains unchanged -- causing the entry point address returned by ompd_get_task_function() for the implicit task to be set incorrectly to -1.

3193 #if USE_DEBUGGER
3194 // Non-NULL value should be assigned to make the debugger display the root
3195 // team.
3196 TCW_SYNC_PTR(root_team->t.t_pkfn, (microtask_t)(~0));
3197 #endif

Proposing to correct this by setting "t_pkfn" of the implicit task associated with the serialized parallel region to 'microtask' in __kmp_fork_call.

… a serialized parallel region is -1 -- causing the entry point address in ompd_get_task_function to be set incorrectly to -1.
Copy link

@jprotze jprotze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another call to __kmpc_serialized_parallel in line 1521.
This should have the same issue.
Also, it looks like there is a quite random ompd_bp_parallel_end in line 1558.

…iated with a serialized parallel region inside a teams construct to point to the right microtask
@jinisusan
Copy link
Collaborator Author

Thank you, @jprotze, for the review, and for pointing out the other call to __kmpd_serialized_parallel. I have modified the code to have the t_pkfn after the other call to __kmpc_serialized_parallel to point to the right microtask. The absence of this was causing the implicit task details associated with the serialized parallel region following a teams construct to be set to the those of the enclosing teams construct.

At this point, I am leaving the random ompd_bp_parallel_end() at line 1558 since I plan to address that as a separate issue -- it needs to be moved to the right location. Do let me know if addressing this as a separate issue is not OK with you.

Requesting you to merge this if you find this ok.

@jprotze
Copy link

jprotze commented Jun 10, 2020

Agreed, LGTM

@jprotze jprotze merged commit 3086bf2 into OpenMPToolsInterface:ompd-tests Jun 10, 2020
@jinisusan jinisusan deleted the serialized-parallel-task-func branch September 28, 2020 17:19
jinisusan pushed a commit that referenced this pull request Jan 3, 2021
This reverts commit bfd2c21.
This appears to be causing stage2 msan failures on buildbots:
  FAIL: LLVM :: Transforms/SimplifyCFG/X86/bug-25299.ll (65872 of 71835)
  ******************** TEST 'LLVM :: Transforms/SimplifyCFG/X86/bug-25299.ll' FAILED ********************
  Script:
  --
  : 'RUN: at line 1';   /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll -simplifycfg -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll
  --
  Exit Code: 2
  Command Output (stderr):
  --
  ==87374==WARNING: MemorySanitizer: use-of-uninitialized-value
      #0 0x9de47b6 in getBasicBlockIndex /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/Instructions.h:2749:5
      #1 0x9de47b6 in simplifyCommonResume /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:4112:23
      #2 0x9de47b6 in simplifyResume /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:4039:12
      #3 0x9de47b6 in (anonymous namespace)::SimplifyCFGOpt::simplifyOnce(llvm::BasicBlock*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6330:16
      #4 0x9dcca13 in run /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6358:16
      #5 0x9dcca13 in llvm::simplifyCFG(llvm::BasicBlock*, llvm::TargetTransformInfo const&, llvm::SimplifyCFGOptions const&, llvm::SmallPtrSetImpl<llvm::BasicBlock*>*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6369:8
      #6 0x974643d in iterativelySimplifyCFG(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants