Concurrency Analysis
This section documents the concurrency analysis subsystem, the shared thread-aware analysis layer used by Lotus concurrency checking and by clients that need May-Happen-in-Parallel (MHP), lock-set, or happens-before reasoning.
Headers: include/Concurrency/
Implementation: lib/Concurrency/
Overview
The concurrency analysis module provides the shared analysis layer used by Lotus concurrency checking. It centers on thread creation, synchronization operations, memory accesses, and communication structure that can be recovered from LLVM IR.
The module supports multiple concurrency models:
POSIX threads (pthreads): standard pthread APIs
Modern C++ concurrency:
std::thread, mutexes, condition variables, futures/promises, atomics, and several C++20 primitives that are recognizedOpenMP: parallel regions, barriers, tasks, and lock operations (see
lib/Concurrency/OpenMP/)MPI: a separate SPMD communication analysis in
Concurrency/MPI/CUDA: thread/block hierarchy and PTX-level reasoning (see
lib/Concurrency/CUDA/, includingPTXAnalyzer)Linux kernel: kernel concurrency primitives (see
lib/Concurrency/LinuxKernel/)Custom APIs: configurable through
config/thread.specandThreadAPI
Key capabilities:
May-Happen-in-Parallel (MHP) analysis for shared-memory overlap reasoning
Lock-set analysis for race and deadlock checking
Happens-before computation from thread-flow and synchronizes-with edges
Escape and thread-sharing analyses for shared-memory filtering
Join-target reasoning for refining
pthread_joineffectsThread flow graph construction and thread API classification utilities
Directory layout
The source tree is grouped by subdirectory under include/Concurrency/ and
lib/Concurrency/:
Utils/:ThreadAPI,ThreadFlowGraph, vector-clock utilities, RAII lock tracking, and language models for C++, OpenMP, MPI, and Linux kernel APIsMHP/:MHPAnalysis,StaticVectorClockMHP, andHappensBeforeAnalysisLockSet/:LockSetAnalysisMemory/:EscapeAnalysisandStaticThreadSharingAnalysisJoinTarget/:JoinTargetAnalysisMPI/:MPIAnalysisand its process, collective, rank, and RMA analysesCUDA/:CUDAAnalysis,CUDAFunctionSummary,CUDASemantics, andPTXAnalyzerOpenMP/:OpenMPModel,OpenMPSemantics, andOpenMPTaskGraphLinuxKernel/:LinuxKernelAnalysis,LinuxKernelLockAnalysis, andLinuxKernelRCUAnalysis
Concurrency/MPI/ models MPI communication in the SPMD setting. It complements
the shared-memory analyses above, but it is not another thread library layered on
top of MHPAnalysis.
Clients
The concurrency analyses feed two main consumers:
The concurrency bug checkers (data races, deadlocks, atomicity violations, OpenMP and MPI bugs) exposed through
lotus-check concur. See Concurrency Bug Checker for the checker side.Any analysis client that needs MHP, lock-set, or happens-before queries via
ConcurrencyFacade.
See Also
Concurrency Bug Checker – Concurrency bug checkers (
lotus-check concur)Analysis Framework – Other analysis utilities