[Openmp-commits] [PATCH] D140248: [OpenMP] Enable profiling on multiple threads

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Dec 22 08:43:10 PST 2022

jdoerfert added a comment.

This is only needed if you link OpenMP as static library, or always?

Comment at: openmp/libomptarget/src/rtl.cpp:47
+// List of TimeTraceProfiler instances on other threads
+std::vector<llvm::TimeTraceProfiler *> *profileInstancesOtherThreads = nullptr;
+std::mutex profLock;
markdewing wrote:
> jdoerfert wrote:
> > Why is this a pointer? And why a std::vector not llvm::SmallVector 
> If it is not a pointer, the following error happens
> ```
> a.out: /home/mdewing/nvme/software/llvm/git/llvm-project/llvm/lib/Support/TimeProfiler.cpp:154: void llvm::TimeTraceProfiler::write(llvm::raw_pwrite_stream&): Assertion `llvm::all_of(Instances.List, [](const auto &TTP) { return TTP->Stack.empty(); }) && "All profiler sections should be ended when calling write"' failed.
> ```
> This seems to be happening because the first entry in the vector is missing.  I did not track down the root cause, but my guess is something to do with constructor ordering.
That doesn't make sense to me. What has an indirection here to do with the interaction with TimeProfiler.cpp. 

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list