[all-commits] [llvm/llvm-project] 2acfbb: [OpenMP] Mostly remove experimental taskgraph supp...
Julian Brown via All-commits
all-commits at lists.llvm.org
Wed Sep 23 04:19:36 PDT 2026
Branch: refs/heads/users/jtb20/omp6.0-taskgraph-support-9
Home: https://github.com/llvm/llvm-project
Commit: 2acfbbceea58cdadd3f5403e26508a468411d2a5
https://github.com/llvm/llvm-project/commit/2acfbbceea58cdadd3f5403e26508a468411d2a5
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-22 (Tue, 22 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_global.cpp
M openmp/runtime/src/kmp_settings.cpp
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_taskdeps.h
M openmp/runtime/src/kmp_tasking.cpp
R openmp/runtime/test/tasking/omp_record_replay.cpp
R openmp/runtime/test/tasking/omp_record_replay_deps.cpp
R openmp/runtime/test/tasking/omp_record_replay_deps_multi_succ.cpp
R openmp/runtime/test/tasking/omp_record_replay_multiTDGs.cpp
R openmp/runtime/test/tasking/omp_record_replay_print_dot.cpp
R openmp/runtime/test/tasking/omp_record_replay_taskloop.cpp
Log Message:
-----------
[OpenMP] Mostly remove experimental taskgraph support from runtime
Because the changes to runtime support for taskgraph record/replay
are quite extensive, they will likely be more comprehensible if the
existing parts are removed before the new parts are added. This is the
removal part.
Pull Request: https://github.com/llvm/llvm-project/pull/194046
Commit: 3c1ef216b24263e07e9198496bf18de7f3077bce
https://github.com/llvm/llvm-project/commit/3c1ef216b24263e07e9198496bf18de7f3077bce
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_taskdeps.h
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/tasking/omp_taskgraph_irreducible.cpp
Log Message:
-----------
[OpenMP] New taskgraph runtime implementation
This patch contains the bulk of the new runtime support for taskgraph
record/replay. Relative to previously-posted versions, this version
substantially reworks irreducible graph handling, and also reimplements
exec descriptor-based host replay.
Key points are as follows.
The task/taskdata structures and the dependencies between them are
duplicated whilst recording a taskgraph, keeping the existing runtime
dependency handling unaffected by the taskgraph implementation --
e.g. during runtime execution, it is valid for output dependencies to
be dropped as soon as the producing task completes. This separation
is intended to eliminate race conditions when tasks which complete
unpredictably might or might not be marked as having a subsequent task
depend on them.
The dependencies between tasks in a taskgraph are processed by static
analysis: the high-level process is akin to turning data dependencies
between tasks into control-flow dependencies. This is done by building
a set of successors and predecessors for each recorded task, then
decomposing the resulting DAG into parallel and sequential regions.
In the (presumed relatively unlikely, in real-world code) case that the
graph is irreducible, an algorithm is used to find the subgraph that
cannot be reduced, and make it an irreducible region (with children that
may be nodes, parallel or sequential regions, or even other irreducible
regions).
For irreducible regions in the output graph, the immediate children
*retain* their "intra" predecessor and successor lists. Deps pointing
in or out of the irreducible region, or those for other region types
(parallel, sequential, etc.) are dropped.
The algorithm to find and collapse irreducible regions works as follows.
Firstly, the graph is decomposed into single-entry, single-exit (SESE)
regions, using calculated dominator and postdominator edges. SESE regions
may be nested -- the top-level graph forms a SESE region itself, from the
entry point to the exit point, and there may also be subgraphs which form
SESE regions. SESE regions thus form a tree, rooted at the outermost
level of the graph. The leaves of that tree are taken and collapsed
into irreducible regions in our output graph. We already know such
leaf regions cannot be reduced by parallel-sequential decomposition,
because the SESE-region finding code runs after the point where that
previous phase can do no further work.
The output of this process is a set of nested kmp_taskgraph_region
structures -- parallel, sequential or irreducible (each with some number
of children), or nodes representing a single task. The two phases --
parallel/sequential decomposition and irreducible-region handling --
alternate until we obtain a single, top-level region.
This nested structure is then used for both host-based taskgraph replay
and (TBD) offload-based taskgraph replay. It is hoped that the high-level
semantics will be useful when mapping to e.g. other graph APIs. Already
for host-based execution, reductions only work with parallel regions: much
of the complexity here is to allow that to work reliably, particularly
where reduction results obtained at some point in the replay of a
taskgraph might be used within that *same* taskgraph replay instance.
Replaying a taskgraph processed into this nested region tree
on the CPU involves another set of linked structures, of type
kmp_taskgraph_exec_descr. These form a kind of trace of a traversal
over the kmp_taskgraph_region structure, so that a pointer to a
kmp_taskgraph_exec_descr is somewhat equivalent to a "program counter".
The bulk of the processing here is done by __kmp_build_exec_descrs_1: we
create descr structures for task nodes, for wait nodes, and for
parallel regions. Each descr has a pointer to the originating region,
an in-degree, and a successor list. Host-based replay is then quite
straightforward: __kmp_taskgraph_exec_descr_start looks for reduction
metadata on parallel regions, or invokes recorded tasks for task-node
regions.
Recorded taskgraphs are located directly by using a handle passed
in from the user's compiled program, rather than using a linked list
or hashtable to find taskgraph records to replay keyed by an index:
the compiler generates a static pointer per-lexical taskgraph construct
(instantiation in the case of templated code), and the address of that is
passed to the runtimeto be written back with the address of the processed
taskgraph data.
Assisted-By: Claude Opus (mostly for irreducible region handling)
Pull Request: https://github.com/llvm/llvm-project/pull/216324
Commit: 58af0e1b653753d0146055ad00e0d796dfb0539a
https://github.com/llvm/llvm-project/commit/58af0e1b653753d0146055ad00e0d796dfb0539a
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/include/clang/AST/OpenMPClause.h
M clang/include/clang/AST/RecursiveASTVisitor.h
M clang/include/clang/Sema/SemaOpenMP.h
M clang/lib/AST/OpenMPClause.cpp
M clang/lib/AST/StmtProfile.cpp
M clang/lib/Basic/OpenMPKinds.cpp
M clang/lib/Parse/ParseOpenMP.cpp
M clang/lib/Sema/SemaOpenMP.cpp
M clang/lib/Sema/TreeTransform.h
M clang/lib/Serialization/ASTReader.cpp
M clang/lib/Serialization/ASTWriter.cpp
M clang/tools/libclang/CIndex.cpp
M llvm/include/llvm/Frontend/OpenMP/OMP.td
Log Message:
-----------
[OpenMP] Add graph_id and graph_reset clause support (for taskgraph directive)
This patch adds support for the graph_id and graph_reset clauses for the
OpenMP 6.0 "taskgraph" directive. Relative to previously-posted versions,
this one does not have the clauses inherit from "OMPClauseWithPreInit",
since AFAICT it shouldn't be necessary to do that. It also avoids
casting the graph_id argument to a boolean, and allows the expression
to be omitted for the graph_reset clause (which seems of limited use,
but is allowed by the spec).
Co-Authored-By: Josep Pinot <jpinot at bsc.es>
Pull Request: https://github.com/llvm/llvm-project/pull/194048
Commit: 35470e59907ff3d1fc0482b18fe0950335e54779
https://github.com/llvm/llvm-project/commit/35470e59907ff3d1fc0482b18fe0950335e54779
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/bindings/python/clang/cindex.py
M clang/include/clang-c/Index.h
M clang/include/clang/AST/RecursiveASTVisitor.h
M clang/include/clang/AST/StmtOpenMP.h
M clang/include/clang/Basic/StmtNodes.td
M clang/include/clang/Sema/SemaOpenMP.h
M clang/include/clang/Serialization/ASTBitCodes.h
M clang/lib/AST/StmtOpenMP.cpp
M clang/lib/AST/StmtPrinter.cpp
M clang/lib/AST/StmtProfile.cpp
M clang/lib/Basic/OpenMPKinds.cpp
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/lib/CodeGen/CGOpenMPRuntime.h
M clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
M clang/lib/CodeGen/CGStmt.cpp
M clang/lib/CodeGen/CGStmtOpenMP.cpp
M clang/lib/CodeGen/CodeGenFunction.h
M clang/lib/Sema/SemaExceptionSpec.cpp
M clang/lib/Sema/SemaOpenMP.cpp
M clang/lib/Sema/TreeTransform.h
M clang/lib/Serialization/ASTReaderStmt.cpp
M clang/lib/Serialization/ASTWriterStmt.cpp
M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
A clang/test/OpenMP/taskgraph_bad_clauses.cpp
M clang/test/OpenMP/unimplemented_clause_messages.cpp
M clang/tools/libclang/CIndex.cpp
M clang/tools/libclang/CXCursor.cpp
Log Message:
-----------
[OpenMP] Add OpenMP 6.0 taskgraph parsing/trivial semantics
This patch adds OpenMP 6.0 'taskgraph' support, as a no-op: i.e. the
contents of the taskgraph region are just executed as if the directive
was omitted.
Co-Authored-By: Adrian Munera <adrian.munera at bsc.es>
Co-Authored-By: Jose M Monsalve Diaz <JoseM.MonsalveDiaz at amd.com>
Pull Request: https://github.com/llvm/llvm-project/pull/194050
Commit: 7259f5de80b9fc45e730ec67e7ffd68c7d569c46
https://github.com/llvm/llvm-project/commit/7259f5de80b9fc45e730ec67e7ffd68c7d569c46
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A clang/test/OpenMP/taskgraph_clauses_ast_print.cpp
A clang/test/OpenMP/taskgraph_clauses_messages.cpp
Log Message:
-----------
[OpenMP] Add graph_id/graph_reset tests
Assisted-By: Codex with gpt-5.3
Pull Request: https://github.com/llvm/llvm-project/pull/194049
Commit: f9c93558d0d30be0c00a07c4b350b054025b777f
https://github.com/llvm/llvm-project/commit/f9c93558d0d30be0c00a07c4b350b054025b777f
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/lib/CodeGen/CGOpenMPRuntime.h
M clang/lib/CodeGen/CodeGenFunction.h
M clang/lib/Sema/SemaOpenMP.cpp
A clang/test/OpenMP/taskgraph_taskwait_nodeps.cpp
M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
Log Message:
-----------
[OpenMP] Support 'taskgraph' semantics via new libomp API entry points
This patch supports the OpenMP 6.0 'taskgraph' directive via several
new API entry points for libomp.
New entry points are used for several reasons. The first reason
is to pass extra information from the compiler relevant to the
taskgraph-recording case -- e.g. the __kmpc_taskgraph_task entry point
has extra arguments relating to shared data. The second reason is to
reduce the potential overhead of the taskgraph implementation on the
rest of the runtime. A third intention is to capture OpenMP semantics
at a slightly higher level: in particular when we come to add offload
target tasks to this implementation, those will also use new API entry
points to hopefully allow dependencies to be handled entirely on the GPU,
rather than by being wrapped in a host task.
Pull Request: https://github.com/llvm/llvm-project/pull/194051
Commit: 2a229bf53ded66923bdb7c914eadec6001c67105
https://github.com/llvm/llvm-project/commit/2a229bf53ded66923bdb7c914eadec6001c67105
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A clang/test/OpenMP/taskgraph_ast_print.cpp
A clang/test/OpenMP/taskgraph_codegen.cpp
Log Message:
-----------
[OpenMP] New Clang tests for 'taskgraph' directive
This patch adds two simple tests for parsing/serialization/deserialization
and codegen for the OpenMP 'taskgraph' directive.
Pull Request: https://github.com/llvm/llvm-project/pull/194052
Commit: 52c249793e3c80f1b507f5592e6a2ffcc65821f5
https://github.com/llvm/llvm-project/commit/52c249793e3c80f1b507f5592e6a2ffcc65821f5
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/include/clang/AST/OpenMPClause.h
M clang/include/clang/AST/RecursiveASTVisitor.h
M clang/include/clang/Sema/SemaOpenMP.h
M clang/lib/AST/OpenMPClause.cpp
M clang/lib/AST/StmtProfile.cpp
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/lib/CodeGen/CGOpenMPRuntime.h
M clang/lib/CodeGen/CGStmtOpenMP.cpp
M clang/lib/Parse/ParseOpenMP.cpp
M clang/lib/Sema/SemaOpenMP.cpp
M clang/lib/Sema/TreeTransform.h
M clang/lib/Serialization/ASTReader.cpp
M clang/lib/Serialization/ASTWriter.cpp
M clang/tools/libclang/CIndex.cpp
M llvm/include/llvm/Frontend/OpenMP/OMP.td
Log Message:
-----------
[OpenMP] Add 'replayable' clause (for 'taskgraph' support)
This patch adds support for the 'replayable' clause to Clang. This is
used to mark that the directive the clause is used on participates in
taskgraph recording and replay: thus, when the clause is present, the
new API routines introduced in a previous patch are emitted, even when
the directive is not lexically nested within a taskgraph construct.
Pull Request: https://github.com/llvm/llvm-project/pull/194053
Commit: 895161b4d94b3c99a3d652d7f2a8d227ec316b75
https://github.com/llvm/llvm-project/commit/895161b4d94b3c99a3d652d7f2a8d227ec316b75
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A clang/test/OpenMP/replayable_ast_print.cpp
A clang/test/OpenMP/replayable_messages.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_nonlexical_recursive_reduction.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_nonlexical_reduction_minimal_taskloop.cpp
Log Message:
-----------
[OpenMP] Add tests for 'replayable' clause
Parsing and diagnostics tests for the replayable clause added by
the previous patch, plus two libomp runtime tests
(taskgraph_replayable_nonlexical_reduction_minimal_taskloop.cpp
and taskgraph_replayable_nonlexical_recursive_reduction.cpp) for
reductions on non-lexically-nested replayable taskloops, which
exercise the Clang dispatch through __kmpc_taskgraph_taskred_init
that stashes the reduction input for later replay.
Assisted-By: Codex with gpt-5.3
Assisted-By: Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/194054
Commit: b8c7eb5621679f73eda5101c34ed722617db3f1d
https://github.com/llvm/llvm-project/commit/b8c7eb5621679f73eda5101c34ed722617db3f1d
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A openmp/runtime/test/tasking/omp_taskgraph.cpp
A openmp/runtime/test/tasking/omp_taskgraph_deps.cpp
A openmp/runtime/test/tasking/omp_taskgraph_multiTDGs.cpp
A openmp/runtime/test/tasking/omp_taskgraph_taskloop.cpp
Log Message:
-----------
[OpenMP] OpenMP 6.0 "taskgraph" support, additional tests from previous implementation
This patch contains new tests from previous iterations of taskgraph
support, with some changes to adjust to the new implementation.
Co-Authored-By: Josep Pinot <josep at bsc.es>
Pull Request: https://github.com/llvm/llvm-project/pull/194055
Commit: d4608799d1161b3edde803385a97c8f23f820dfe
https://github.com/llvm/llvm-project/commit/d4608799d1161b3edde803385a97c8f23f820dfe
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A openmp/runtime/test/taskgraph/taskgraph_deps_1.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_10.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_11.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_12.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_13.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_14.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_15.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_16.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_17.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_18.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_19.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_2.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_20.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_21.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_22.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_23.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_24.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_25.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_26.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_27.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_3.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_4.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_5.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_6.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_7.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_8.cpp
A openmp/runtime/test/taskgraph/taskgraph_deps_9.cpp
Log Message:
-----------
[OpenMP] OpenMP 6.0 "taskgraph" support, add new tests
These are new tests intended to cover the functionality present in the
new taskgraph implementation.
Pull Request: https://github.com/llvm/llvm-project/pull/194057
Commit: 8a1666bf5504998073c234ea5c4c47201e5f78c9
https://github.com/llvm/llvm-project/commit/8a1666bf5504998073c234ea5c4c47201e5f78c9
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_irreducible_nested_parallel.cpp
A openmp/runtime/test/taskgraph/taskgraph_irreducible_nested_sequential.cpp
Log Message:
-----------
[OpenMP] Fixes for compound members of irreducible regions
In processed taskgraphs, we permit irreducible regions to contain any
other region type, so it's legal to have a parallel or sequential region
(or even another irreducible region) as a child of that region.
This patch fixes some bugs concerning such cases, and adds two new tests.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225689
Commit: 588ab78cbf07a47b886ab3713b10f8420f4a4d09
https://github.com/llvm/llvm-project/commit/588ab78cbf07a47b886ab3713b10f8420f4a4d09
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Runtime support for graph_id and graph_reset clauses
This patch adds the runtime support for graph_id and graph_reset
functionality, including freeing of old taskgraph records.
Lazy expiration of taskgraphs is partially implemented here, but won't be
wired up fully until concurrent/nowait taskgraph execution is implemented.
Pull Request: https://github.com/llvm/llvm-project/pull/216325
Commit: 636f1b06ebffc1910d8adfa8fd4381031cbe8f8e
https://github.com/llvm/llvm-project/commit/636f1b06ebffc1910d8adfa8fd4381031cbe8f8e
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A openmp/runtime/test/taskgraph/taskgraph_deps_irreducible_graph_reset.cpp
A openmp/runtime/test/taskgraph/taskgraph_graph_id.cpp
A openmp/runtime/test/taskgraph/taskgraph_graph_id_and_reset.cpp
A openmp/runtime/test/taskgraph/taskgraph_graph_reset.cpp
Log Message:
-----------
[OpenMP] New runtime tests for graph_id/graph_reset clauses (taskgraph)
This patch contains several new tests for graph_id/graph_reset functionality.
Assisted-By: Codex/gpt-5.3 and Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/195075
Commit: f8cbc4fb23dc0f45de70b3703ed0dbc0b1fefa14
https://github.com/llvm/llvm-project/commit/f8cbc4fb23dc0f45de70b3703ed0dbc0b1fefa14
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/i18n/en_US.txt
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_graph_id_concurrent_rerecord.cpp
Log Message:
-----------
[OpenMP] Add sanity check for concurrent taskgraph reset
This patch adds a sanity check for concurrent taskgraph re-recording: the
case where two threads might simultaneously hit a taskgraph region with
the same graph_id and a non-zero graph_reset clause. If the situation
is encountered, a fatal runtime error is raised.
Pull Request: https://github.com/llvm/llvm-project/pull/195076
Commit: 230d4ec81c0a8ddbdfc1d6cd2bc98501b0df08c6
https://github.com/llvm/llvm-project/commit/230d4ec81c0a8ddbdfc1d6cd2bc98501b0df08c6
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/test/OpenMP/taskgraph_codegen.cpp
M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Widen taskgraph graph_id to uintptr_t
The 'graph_id' clause introduced in OpenMP 6.0 lets the user attach an
identifying value to a taskgraph instance, and a potentially-useful
idiom is to pass a pointer expression so that each instance can be
specialized for the pointed-to data. The corresponding runtime entry
point __kmpc_taskgraph and the kmp_taskgraph_record_t::graph_id field
were declared as 32-bit types, which silently truncates such pointer
values on LP64 targets.
Widen the field and the runtime ABI to uintptr_t, lower 'graph_id'
to CGM.IntPtrTy in emitTaskgraphCall, and mark the OMPRTL
descriptor as SizeTy so the call is typed consistently on 32- and
64-bit hosts. Refresh the auto-generated CHECK line in
taskgraph_codegen.cpp accordingly.
Assisted-By: Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/200403
Commit: 9bd3ff855a3de13e60a7af354e33e171d0c9a9c7
https://github.com/llvm/llvm-project/commit/9bd3ff855a3de13e60a7af354e33e171d0c9a9c7
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
M openmp/runtime/src/i18n/en_US.txt
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_firstprivate_stack_depth.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_mixed_capture.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_nontrivial_type.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_nontrivial_type_recursive.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_pointer.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_pointer_recursive_frameid.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_recursive.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_works.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_nonlexical_shared_fails_1.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_nonlexical_shared_fails_2.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_saved_stack_depth.cpp
A openmp/runtime/test/taskgraph/taskgraph_shared_stack_depth.cpp
Log Message:
-----------
[OpenMP] Relocate task shared-by-ref captures across taskgraph replay
OpenMP 6.0 lets a taskgraph region be recorded once and replayed many
times. Each replay creates a fresh instance of the 'args' pointer
block passed to __kmpc_taskgraph (and may execute at a different stack
location, or even on a different stack), so by-reference captures inside a
recorded task must be re-pointed at the live host objects of the current
invocation; otherwise the recorded tasks would dereference stale memory
from the stack frame of the initial call to __kmpc_taskgraph.
This patch introduces the small infrastructure to do that and wires
it up for the explicit 'task' construct. A subsequent patch
extends the same scheme to 'taskloop'.
On the compiler side (CGOpenMPRuntime.cpp), a new helper
emitTaskRelocationFunction emits a per-task thunk:
void __omp_taskgraph_relocate.NN(kmp_task_t *task,
void *outer_captures);
The thunk walks the task's captures and overwrites each entry of
task->shareds with the address of the corresponding field projected from
the freshly reconstructed outer pointer block. Two classes of capture do
not need updating and are treated as no-ops by the thunk: captures that
correspond to a firstprivate list item (the body reads from the per-task
'.kmp_privates.t' snapshot, populated when the task is allocated and
-- for non-trivial types -- reset on each replay by the clone helper
introduced later), and captures of variables with static storage duration
(their address is link-time fixed). Reductions of a local-stack variable
are intentionally not in this set: the taskred state is keyed on the
recording-time taskgroup hierarchy and is not yet usable on replay,
so we prefer to preserve today's relocate-returns-null / runtime-aborts
behaviour for that case so the limitation surfaces as a diagnostic.
emitTaskCall now emits such a thunk for each taskgraph-recorded task
and passes it as the new trailing argument of __kmpc_taskgraph_task.
The redundant 'shareds' parameter is dropped, since relocation now
provides the supported mechanism for refreshing that pointer.
On the runtime side (kmp.h, kmp_tasking.cpp, OMPKinds.def),
introduce a new typedef kmp_task_relocate_t and store the callback
on each recorded task in kmp_taskgraph_node_t::relocate, together
with the outer-record pointer captured at __kmpc_taskgraph entry in
kmp_taskgraph_record_t::taskgraph_args. __kmp_omp_tg_task invokes
the callback on replay, and aborts with a new fatal diagnostic
(OmpTaskgraphBadCapture, i18n/en_US.txt) when a recorded task has a
non-null shareds payload but no relocation callback. There is also a
fix for a pre-existing bug in __kmp_taskgraph_clone_task -- the cloned
task's shareds pointer was left referring to the original's payload --
which becomes observable as soon as the relocation thunk writes through
that pointer.
New libomp tests cover lexical and non-lexical shared captures,
pointer captures, non-trivial types, recursive recordings,
stack-depth differences across replays, and the saved/expired-
graph cases.
Assisted-By: Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/200404
Commit: 3aa6742902c07116c12342bfc197eb1ebbaaab0d
https://github.com/llvm/llvm-project/commit/3aa6742902c07116c12342bfc197eb1ebbaaab0d
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_mixed_capture_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_nontrivial_type_recursive_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_nontrivial_type_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_pointer_recursive_frameid_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_pointer_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_recursive_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_lexical_shared_works_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_nonlexical_shared_fails_1_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_nonlexical_shared_fails_2_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_saved_stack_depth_taskloop.cpp
Log Message:
-----------
[OpenMP] Extend taskgraph shared-data relocation to taskloop
Build on the per-task relocation infrastructure introduced for
'omp task' in the previous patch and apply the same scheme to
taskloop tasks recorded inside a taskgraph. Without this,
by-reference captures inside a recorded taskloop iteration still
point at the original recording's stack on each replay.
On the compiler side (CGOpenMPRuntime.cpp), emit a relocation
thunk for the taskloop's captured statement via the shared
emitTaskRelocationFunction helper and pass it as the new trailing
argument of __kmpc_taskgraph_taskloop. The now-unused 'shareds'
and 'sizeof_shareds' parameters are dropped from the call and from
TGTaskLoopArgs.
On the runtime side, update __kmpc_taskgraph_taskloop to match
the new ABI (drop the dead 'shareds' / 'sizeof_shareds'
parameters, add the trailing kmp_task_relocate_t parameter) and
plumb the callback through the taskgraph variant of
__kmp_taskloop and __kmp_taskloop_linear so every recorded
subtask gets node->relocate = reloc, mirroring the explicit-task
path. Non-taskgraph callers pass a default nullptr and are
unaffected.
Add taskloop counterparts of the omp-task runtime tests added in
the previous patch.
Assisted-By: Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/200405
Commit: 6dcdcf53cdf2dcfe7e56d9b6a32f6ef4a89c7a36
https://github.com/llvm/llvm-project/commit/6dcdcf53cdf2dcfe7e56d9b6a32f6ef4a89c7a36
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/include/clang/AST/OpenMPClause.h
M clang/include/clang/Basic/OpenMPKinds.def
M clang/include/clang/Basic/OpenMPKinds.h
M clang/include/clang/Sema/SemaOpenMP.h
M clang/lib/AST/OpenMPClause.cpp
M clang/lib/Basic/OpenMPKinds.cpp
M clang/lib/Parse/ParseOpenMP.cpp
M clang/lib/Sema/SemaOpenMP.cpp
M clang/lib/Sema/TreeTransform.h
M clang/lib/Serialization/ASTReader.cpp
M clang/lib/Serialization/ASTWriter.cpp
A clang/test/OpenMP/taskgraph_firstprivate_saved_ast_print.cpp
Log Message:
-----------
[Clang][OpenMP] Parsing, serialisation and deserialisation for the 'saved' firstprivate modifier
OpenMP 6.0 adds a 'saved' modifier to the data-environment
attribute clauses. On a 'firstprivate' clause it specifies that
the list item's value is captured when the surrounding construct
is recorded into a taskgraph, and that captured value is reused
(rather than re-evaluating the initialiser from the live original)
on every replay. See OpenMP 6.0 [7.5.4], [6.4.7] and [14.3].
This patch implements the front-end plumbing for the modifier:
parsing, AST representation and AST printing, profile, template
instantiation and PCH serialisation, modelled directly on the
existing 'lastprivate(conditional: ...)' machinery. No new
semantic restriction is added here (e.g. requiring a
taskgraph-nested or replayable task context), and codegen and the
runtime continue to treat 'saved' as a no-op for now -- those are
follow-up patches.
Specifically:
- OPENMP_FIRSTPRIVATE_KIND(saved) is added in OpenMPKinds.def,
with a matching OpenMPFirstprivateModifier enum and the
appropriate parse/print helpers in OpenMPKinds.cpp.
- OMPFirstprivateClause gains FPKind / FPKindLoc / ColonLoc
fields and an updated Create() signature; OMPClausePrinter
emits 'firstprivate(saved: ...)' when the modifier is set.
- ParseOpenMP recognises '[modifier:]' inside a firstprivate
clause when OpenMP >= 6.0.
- SemaOpenMP::ActOnOpenMPFirstprivateClause now takes the
modifier triple and diagnoses an unrecognised modifier via
the existing err_omp_unexpected_clause_value path; the
dispatcher in ActOnOpenMPVarListClause and the
implicit-firstprivate emitter in ActOnOpenMPRegionEnd are
updated accordingly.
- TreeTransform forwards the modifier through template
instantiation; ASTReader / ASTWriter round-trip the new
fields.
A new lit test taskgraph_firstprivate_saved_ast_print.cpp covers
ast-print and a PCH emit -> include -> ast-print round-trip on
'omp task' and 'omp taskloop' uses of firstprivate(saved: ...).
Assisted-By: Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/200406
Commit: c805261ddbb16c0c51d5051cf1e04e8a988397d0
https://github.com/llvm/llvm-project/commit/c805261ddbb16c0c51d5051cf1e04e8a988397d0
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaOpenMP.cpp
M clang/test/OpenMP/taskgraph_firstprivate_saved_ast_print.cpp
A clang/test/OpenMP/taskgraph_firstprivate_saved_messages.cpp
Log Message:
-----------
[Clang][OpenMP] Restrict 'saved' firstprivate modifier to admissible directives
Per OpenMP 6.0 [7.2], the 'saved' modifier on a data-environment
attribute clause has effect only when that clause appears on a
replayable construct. Per [14.3] and [14.6], the only directives
that admit the 'replayable' clause are: 'target',
'target enter data', 'target exit data', 'target update', 'task',
'taskloop' and 'taskwait'. Of those seven, only 'target', 'task'
and 'taskloop' also admit a 'firstprivate' clause; the remaining
four cannot syntactically carry 'firstprivate' and need no extra
sema work. A directive outside the admitted set can never make
'firstprivate(saved: ...)' meaningful.
We do not try to flag every dead-modifier case statically:
'saved' on a directive in the admitted set but without
'replayable' (and without lexical nesting in a taskgraph) is
well-formed per [7.2] and silently has no effect. Detecting that
would require inspecting the full clause list, and is invalidated
as soon as the user adds the clause or moves the construct inside
a taskgraph.
What we can and do diagnose is the case where the host directive
itself cannot ever be a replayable construct: 'saved' on a
'parallel', 'for', 'sections', 'single', 'distribute', 'teams',
etc. firstprivate clause has no path to replay semantics at all.
Reject that in ActOnOpenMPFirstprivateClause when CurDir is
neither an OpenMP tasking directive
(isOpenMPTaskingDirective, which covers OMPD_task and every
OMPD_*taskloop* variant) nor an OpenMP target execution directive
(isOpenMPTargetExecutionDirective, which covers OMPD_target and
every combined directive that has OMPD_target as a leaf
construct), with a new dedicated diagnostic
err_omp_firstprivate_saved_wrong_directive that points at the
modifier location and lists the three admissible directives.
The existing ast-print test is extended to cover these cases, and other
new tests have been added.
Assisted-By: Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/200407
Commit: 2e8272d57ff332c626c0fc5ef21f0adf884b9ae3
https://github.com/llvm/llvm-project/commit/2e8272d57ff332c626c0fc5ef21f0adf884b9ae3
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/lib/CodeGen/CGOpenMPRuntime.h
M clang/test/OpenMP/taskgraph_firstprivate_saved_ast_print.cpp
A clang/test/OpenMP/taskgraph_task_clone_codegen.cpp
M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_firstprivate_saved_nontrivial.cpp
A openmp/runtime/test/taskgraph/taskgraph_firstprivate_saved_nontrivial_selfref.cpp
A openmp/runtime/test/taskgraph/taskgraph_firstprivate_saved_static.cpp
M openmp/runtime/test/taskgraph/taskgraph_replayable_saved_stack_depth.cpp
M openmp/runtime/test/taskgraph/taskgraph_shared_stack_depth.cpp
Log Message:
-----------
[OpenMP] Constructor and destructor fixes for tasks cloned for recorded taskgraphs
The OpenMP 6.0 'saved' firstprivate modifier (see [7.2] together
with [14.3]) requires each list item to be snapshotted once at
recording time and observable on every replay of the recorded
task. libomp reuses the same task descriptor across every replay
of a taskgraph-owned task, so the '.kmp_privates.t' tail struct
that holds the firstprivate values is also the natural home for
the saved data environment. Getting that right needs two
changes, which this patch lands together: the destructor of each
list item must fire exactly once at end-of-taskgraph (not after
every replay), and non-trivially-copyable list items must be
re-constructed per replay so that copy constructors and inner
self-references are respected.
On the runtime side, move the per-task destructor-thunk
invocation from __kmp_task_finish (which previously fired it at
the end of every replay, leaving the saved snapshot in a
destructed state for the next replay) to __kmp_taskgraph_free,
so it fires exactly once per task at end-of-taskgraph. Skip
taskwait nodes (record_map entries with task == nullptr) in that
loop while we are there, to avoid a latent nullptr dereference
that the existing tests do not exercise.
On the compiler side, the runtime previously cloned each replay's
task descriptor with a bitwise memcpy in __kmp_taskgraph_clone_task,
and a FIXME noted that this silently corrupts firstprivate list items
whose type is not trivially copyable (self-referential structs, types
with user-defined copy constructors / destructors, types holding inner
pointers into themselves). Emit a per-task clone helper
void __omp_task_clone.NN(kmp_task_t *dst, kmp_task_t *src,
int lastpriv);
modelled on emitTaskDupFunction and reusing emitPrivatesInit (now
extended with a tri-state PrivatesInitMode of Normal / ForDup /
ForClone), which re-runs the copy constructor of each
firstprivate list item into the freshly allocated descriptor's
'.kmp_privates.t'. Tasks whose firstprivates are all trivially
copyable still rely on the runtime's memcpy fast-path and emit no
clone helper. emitTaskCall passes the helper to the runtime as
the new trailing argument of __kmpc_taskgraph_task (null when no
helper is needed).
Two previously-XFAIL'd taskgraph runtime tests
(taskgraph_replayable_saved_stack_depth.cpp and
taskgraph_shared_stack_depth.cpp) now pass and are un-XFAIL'd, and other
tests have been added to cover new functionality.
Assisted-By: Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/200408
Commit: 220a6e3dc27b9d90ec1b25b51b3670a792be12c5
https://github.com/llvm/llvm-project/commit/220a6e3dc27b9d90ec1b25b51b3670a792be12c5
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A clang/test/OpenMP/taskgraph_template_handle_codegen.cpp
A clang/test/OpenMP/taskgraph_templates_codegen.cpp
Log Message:
-----------
[OpenMP] Add taskgraph template interaction codegen tests
Add two Clang codegen tests for the OpenMP 6.0 taskgraph
directive exercising its interaction with templates -- in
particular checking that different instantiations of the same
template get distinct taskgraph handles.
Assisted-By: Claude Opus 4.7
Pull Request: https://github.com/llvm/llvm-project/pull/200409
Commit: 9c8fce520c7d9bd53be35b3111b3502507eb7b3c
https://github.com/llvm/llvm-project/commit/9c8fce520c7d9bd53be35b3111b3502507eb7b3c
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp_taskdeps.cpp
Log Message:
-----------
[OpenMP] Fix hang and crash on empty taskgraphs
Empty taskgraphs caused crashes (certain code relied on entry and exit
regions being distinct, for instance). This patch contains a trivial fix.
Pull Request: https://github.com/llvm/llvm-project/pull/216327
Commit: 4aa76108e3be9583037cbe2f3dce7b598469fc66
https://github.com/llvm/llvm-project/commit/4aa76108e3be9583037cbe2f3dce7b598469fc66
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A openmp/runtime/test/taskgraph/taskgraph_deadlock_1.cpp
Log Message:
-----------
[OpenMP] Add taskgraph regression test for out-of-line task replay deadlock
Adds a regression test for a taskgraph deadlock that occurred when
non-replayable tasks were encountered during taskgraph recording --
not lexically nested within the taskgraph construct.
Assisted-By: Claude Opus 4.8
Pull Request: https://github.com/llvm/llvm-project/pull/216328
Commit: 4079a4d739ca58d42f42bb21eb3fd232c7b6d120
https://github.com/llvm/llvm-project/commit/4079a4d739ca58d42f42bb21eb3fd232c7b6d120
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/Sema/SemaOpenMP.cpp
A clang/test/OpenMP/taskloop_reduction_default_firstprivate_codegen.cpp
Log Message:
-----------
[Clang][OpenMP] Fix capture of reduction variables under nested default(firstprivate)
isOpenMPCapturedByRef() decided whether a scalar is captured by copy for a
given capture Level, but consulted the default data-sharing attribute of the
innermost directive (getDefaultDSA()) instead of the one at that Level
(getDefaultDSA(Level)).
When a construct with default(firstprivate) (or default(private)) is nested in
an enclosing captured region within the same function -- e.g. a taskloop with a
reduction inside a 'parallel' region -- this made the enclosing region capture
the reduction variable by copy. The reduction then combined into that copy and
its result never propagated back to the original variable (it read as 0).
Query the default attribute at the capture Level being considered, matching the
Level already used by the neighbouring hasExplicitDSA()/isLoopControlVariable()
checks. For top-level captures Level is the top of stack, so behaviour is
unchanged there.
This bug is independent of the 'taskgraph' directive; add a CodeGen regression
test (taskloop_reduction_default_firstprivate_codegen.cpp) exercising it with a
taskloop reduction under default(firstprivate) nested in a plain parallel/single
region.
Assisted-By: Claude Opus 4.8
Pull Request: https://github.com/llvm/llvm-project/pull/216329
Commit: bf21aad56c13519c6651268ac9e798f9046023b4
https://github.com/llvm/llvm-project/commit/bf21aad56c13519c6651268ac9e798f9046023b4
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A openmp/runtime/test/taskgraph/taskgraph_default_firstprivate.cpp
A openmp/runtime/test/taskgraph/taskgraph_default_firstprivate_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_default_none_1.cpp
A openmp/runtime/test/taskgraph/taskgraph_default_none_taskloop.cpp
A openmp/runtime/test/taskgraph/taskgraph_default_shared.cpp
A openmp/runtime/test/taskgraph/taskgraph_default_shared_taskloop.cpp
Log Message:
-----------
[OpenMP] Add taskgraph tests for the 'default' clause on replayable constructs
Adds tests covering default(none), default(shared) and default(firstprivate) on
replayable tasks and taskloops inside a taskgraph. default(none) on a
replayable construct previously crashed Clang's Sema because the implicit-DSA
check had no case for the 'replayable' clause.
Beyond compiling, the tests verify the runtime record/replay semantics under
each default value: shared list items are relocated to (and re-read from) the
current call on every replay, while plain firstprivate items and
firstprivate(saved) items are snapshotted at recording and persist across
replays even after the underlying static is mutated. The firstprivate(saved)
and plain-firstprivate list items are aggregates / known-size arrays so the
aggregate save path (rather than the always-inlined intptr-sized scalar path)
is exercised. The default(firstprivate) taskloop additionally uses a reduction
as a regression guard for the enclosing-region reduction-variable capture fix.
Each encounter enters the taskgraph at a different call-stack depth, with the
abandoned frames clobbered in between, so a replay that used the recorded
shareds pointer cannot land on the live objects by accident.
Assisted-By: Claude Opus 4.8
Pull Request: https://github.com/llvm/llvm-project/pull/216330
Commit: 17d4ccd6b6bbf8f40dffa82d25f812a34d3e59b0
https://github.com/llvm/llvm-project/commit/17d4ccd6b6bbf8f40dffa82d25f812a34d3e59b0
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A clang/test/OpenMP/taskgraph_default_firstprivate_reduction_codegen.cpp
Log Message:
-----------
[Clang][OpenMP] Add codegen test for reduction capture under nested default(firstprivate)
Add a CodeGen regression test covering a taskloop with default(firstprivate)
and a reduction nested inside a 'taskgraph' region. It asserts the reduction
variable is captured by reference by the enclosing taskgraph (its address is
stored into the captured record) and that the caller reads the reduced value
back out of that same storage. This guards the Sema fix that consults the
capture level's default DSA rather than the innermost directive's.
Assisted-By: Claude Opus 4.8
Pull Request: https://github.com/llvm/llvm-project/pull/216331
Commit: efd95ea2cb71d67d6990746cb16bd7d6cf310ef9
https://github.com/llvm/llvm-project/commit/efd95ea2cb71d67d6990746cb16bd7d6cf310ef9
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
Log Message:
-----------
[OpenMP][IRBuilder] Split kernel-args struct emission out of emitTargetKernel
This patch outlines a function to populate the __tgt_kernel_arguments
struct out of emitTargetKernel so that it can be reused by the taskgraph
target recording API (to be added later).
No functional change.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225691
Commit: 34add8a5bcc39893f3fb8c4251a3564ab200eccb
https://github.com/llvm/llvm-project/commit/34add8a5bcc39893f3fb8c4251a3564ab200eccb
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M offload/include/omptarget.h
Log Message:
-----------
[Offload] Add named accessors for the map-type bitfield
When lowering a taskgraph into some device-specific form, a libomptarget
plugin will want to inspect mapping data coming from the compiler in
order to abstractly interpret what data transfers, etc. need to be done
during graph replay. Instead of spreading bit-level operations down
to the plugin level, this patch adds header-only abstract accessors
in libomptarget. This means plugins don't need to concern themselves
with the specifics of the encoding format for mappings.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225692
Commit: e221d83d7abbbaa8c8633e80133b3a772e8d2f33
https://github.com/llvm/llvm-project/commit/e221d83d7abbbaa8c8633e80133b3a772e8d2f33
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp_taskdeps.cpp
Log Message:
-----------
[OpenMP] Fix hash memory leak on empty graph
This patch moves initialisation of the hash after the empty taskgraph
check & early return, to avoid a memory leak.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225693
Commit: 3e1804d2593413f2f3667debca856d1ab7f39fd4
https://github.com/llvm/llvm-project/commit/3e1804d2593413f2f3667debca856d1ab7f39fd4
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Tolerate empty taskgraph records in more places
This patch avoids crashes on empty taskgraphs in a couple of places
previously missed.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225694
Commit: 58c0881a7df5447ffb59d2604a4ccc4cad8df71d
https://github.com/llvm/llvm-project/commit/58c0881a7df5447ffb59d2604a4ccc4cad8df71d
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Fix freeing of wrong record on taskgraph expiry
The taskgraph expiry path (written with eventual support of concurrent
taskgraph replay in mind) has a bug where it frees the wrong record,
which this patch fixes.
We're only replaying a taskgraph synchronously at the moment, so this
is a latent bug.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225696
Commit: 046fb6c9ef5303c28ef1d2046213edb544997649
https://github.com/llvm/llvm-project/commit/046fb6c9ef5303c28ef1d2046213edb544997649
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_concurrent_replay_relocation.cpp
Log Message:
-----------
[OpenMP] Capture correct frame address during (attempted) concurrent taskgraph replay
If two threads try to replay a taskgraph at the same time (e.g. under "omp
parallel" without "omp serial"), capturing incoming args in
__kmpc_taskgraph is racy because it happens outside the map_lock.
This patch corrects that oversight.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225697
Commit: c88f76ac9a6dd77e86f1a266b967ec0cfbcf3012
https://github.com/llvm/llvm-project/commit/c88f76ac9a6dd77e86f1a266b967ec0cfbcf3012
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
A clang/test/OpenMP/taskgraph_clauses_codegen.cpp
A openmp/runtime/test/taskgraph/taskgraph_empty_graph_reset.cpp
A openmp/runtime/test/taskgraph/taskgraph_graph_reset_no_argument.cpp
Log Message:
-----------
[Clang][OpenMP] Fix codegen crash on 'graph_reset' with no argument
OpenMP permits the clause argument to be omitted from the 'graph_reset'
clause of '#pragma omp taskgraph' -- meaning the graph is reset
unconditionally. The omitted-argument case unfortunately crashed the
Clang front-end, but this patch fixes that.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225698
Commit: 472c0cc4261354a539f2ce9ee63c0fce5d82c2d3
https://github.com/llvm/llvm-project/commit/472c0cc4261354a539f2ce9ee63c0fce5d82c2d3
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_reset_no_leak.cpp
Log Message:
-----------
[OpenMP] Fix taskgraph record/replay leaks
This patch fixes a number of memory leaks found across the taskgraph
record/replay implementation.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225699
Commit: eaa899185d0a039d512a5d7febc5750c0bbbb719
https://github.com/llvm/llvm-project/commit/eaa899185d0a039d512a5d7febc5750c0bbbb719
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_reset_during_replay.cpp
Log Message:
-----------
[OpenMP] Stop graph_reset freeing a taskgraph record that is being replayed
A 'graph_reset' operation on some thread could cause an in-progress replay
on another thread/threads to have its taskgraph data freed from under it.
This patch adds a usage count and an 'expired' flag to the taskgraph
record: so far this isn't sufficient to allow concurrent replay, but is
enough to prevent the above issue.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225700
Commit: 91cdf4077cf0033e92e677fe6ca4ce01ea7745ae
https://github.com/llvm/llvm-project/commit/91cdf4077cf0033e92e677fe6ca4ce01ea7745ae
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Taskgraph record lifetime check
This patch adds optional runtime checking for taskgraph lifetime tracking.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225701
Commit: 997aa97a9012b090164d0afbe15fee7de5a9fc81
https://github.com/llvm/llvm-project/commit/997aa97a9012b090164d0afbe15fee7de5a9fc81
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
Log Message:
-----------
[OpenMP] Remove the dead taskgraph replay_lock
NFC.
Pull Request: https://github.com/llvm/llvm-project/pull/225702
Commit: 5a7f60ce5919600929107fc32ca132a4a7586bba
https://github.com/llvm/llvm-project/commit/5a7f60ce5919600929107fc32ca132a4a7586bba
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A openmp/runtime/test/taskgraph/taskgraph_untied_taskyield.cpp
Log Message:
-----------
[OpenMP] Add a taskgraph test for untied tasks and taskyield
This patch just adds a test, which appears to work at present but may
need further work to pin down the semantics and ensure the implementation
is actually correct in the taskgraph context.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225703
Commit: 9268a86cb0034fd690b7ea2465a1af198c6fcf1d
https://github.com/llvm/llvm-project/commit/9268a86cb0034fd690b7ea2465a1af198c6fcf1d
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/test/OpenMP/taskgraph_clauses_codegen.cpp
A openmp/runtime/test/taskgraph/taskgraph_if_implicit_taskgroup.cpp
Log Message:
-----------
[Clang][OpenMP] Keep the implicit taskgroup when 'taskgraph' has if(false)
A taskgraph region is a taskgroup region by default, and 'nogroup' is
the only way to drop the implicit taskgroup, so the 'if' clause selects
whether the region is recorded and nothing else.
This patch corrects an oversight where the taskgroup was omitted on the
if(false) path. For now, 'nogroup' remains ignored on both paths, so
taskgraphs execute their tasks synchronously (whether enabled with if()
or not).
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225704
Commit: 1817634fb58f352082b9518419feee0fc1b1d46d
https://github.com/llvm/llvm-project/commit/1817634fb58f352082b9518419feee0fc1b1d46d
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaOpenMP.cpp
A clang/test/OpenMP/taskgraph_nesting_messages.cpp
M clang/test/OpenMP/taskgraph_templates_codegen.cpp
Log Message:
-----------
[clang][OpenMP] Diagnose non-task-generating constructs in a taskgraph region
A taskgraph construct is only permitted to contain task-generating
constructs. This patch adds some validation for that restriction.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225705
Commit: d63fdb554e09b840e49286c610d29c271645186b
https://github.com/llvm/llvm-project/commit/d63fdb554e09b840e49286c610d29c271645186b
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp_taskdeps.cpp
Log Message:
-----------
[OpenMP] Use hashing to speed up "twin merge" for irreducible graphs
This is the first of two patches addressing a FIXME for a code path that
turned out to be unexpectedly expensive.
The 'twin merge' part of the irreducible taskgraph processing phase
looks for regions sharing all predecessors and successors by comparing
every pair of regions' predecessor and successor bitsets. This can
get expensive on large graphs (such that the '__kmp_bitset_equal' calls
from the function in question dominate the profile). This patch adds
hashing for the bitsets, which speeds up large graph processing quite
significantly (with the caveat that only limited measurement has been
done).
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225706
Commit: eb1dc9f1e167a3681b2a71fad8002381c838134a
https://github.com/llvm/llvm-project/commit/eb1dc9f1e167a3681b2a71fad8002381c838134a
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp_taskdeps.cpp
Log Message:
-----------
[OpenMP] Use hash buckets to further accelerate twin-merge comparison
This is the second of two patches addressing an unexpectedly expensive
loop in the irreducible-region handling code.
The previous patch used hashing to make twin-merge comparison cheap,
but the scan still enumerated every later region to find the few worth
comparing, so it stayed quadratic in the region count. Since twins
necessarily share a signature, bucket the regions by one and walk only
the bucket.
This lets the twin merge algorithm run even faster (reducing the
quadraticness of the algorithm), but again with the caveat of limited
measurement having been done.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225707
Commit: ca43d15f8ab667a8db389c4da7cab9b9bdac913d
https://github.com/llvm/llvm-project/commit/ca43d15f8ab667a8db389c4da7cab9b9bdac913d
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A offload/include/Shared/TaskGraph.h
M offload/include/omptarget.h
M offload/libomptarget/exports
M offload/libomptarget/interface.cpp
Log Message:
-----------
[Offload] Taskgraph representation and transmission protocol in libomptarget
When a taskgraph record contains target regions, we want to be able to
schedule those efficiently to run on offload hardware. At the moment
we have a processed taskgraph representation in libomp, but we need a
way to get that into libomptarget instead, since that is the part of
the runtime which currently handles target offload.
The representation here is somewhat decoupled from the one used within
libomp, partly because of the different coding style adopted by each
library, and partly because different aspects of the representation are
important when recording/host-replaying the graph vs. executing it on an
offload device. Particular care has been taken over avoiding the need
for strict binary compatibility (e.g. structure layout) between libomp
and libomptarget -- the interface between the two is via function calls
with POD argument types.
Some data is shallow copied/cross-linked to the recorded taskgraph data
in libomp: the mutex bits for surviving 'mutexinoutset' deps that aren't
representable by irreducible regions, and the deep-copied kernel args
and mapping arrays. As such, the libomp-side data must outlive the
libomptarget-side data.
We use a two-pass strategy to transmit the graph-shaped data so that we
can use a single allocation block on the libomptarget side.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225708
Commit: 6e7b89395a889ef1dad6c7af90160345349a8487
https://github.com/llvm/llvm-project/commit/6e7b89395a889ef1dad6c7af90160345349a8487
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M offload/include/Shared/TaskGraph.h
M offload/include/omptarget.h
M offload/libomptarget/exports
M offload/libomptarget/interface.cpp
M offload/libomptarget/omptarget.cpp
M offload/libomptarget/private.h
M offload/plugins-nextgen/common/include/PluginInterface.h
M offload/plugins-nextgen/common/src/PluginInterface.cpp
Log Message:
-----------
[Offload] Offer a recorded taskgraph to the device plugin
This patch allows plugins to claim the transmitted taskgraph from
libomp->libomptarget, to process in some device-specific way for
efficient replay on hardware.
Two things a plugin cannot do for itself -- resolving a recorded host
function pointer to a device kernel, and asking whether a host range is
already mapped -- are passed in as TaskGraphServicesTy function pointers,
since the plugin cannot call libomptarget functions directly.
Parts of this interface relating to host-to-target data mappings are
subject to change: in-progress work builds a "data plan" at finalize
time, updated on replay, that plugins can consult instead of querying
mappings directly.
The default implementation falls back to libomp for execution, which
always works but may be non-optimal on some given hardware: target
regions will be run synchronously with respect to the host CPU.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225709
Commit: ab6ffeae4ebc916ea4805e283343ecbb244e678e
https://github.com/llvm/llvm-project/commit/ab6ffeae4ebc916ea4805e283343ecbb244e678e
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/lib/CodeGen/CGStmtOpenMP.cpp
A clang/test/OpenMP/taskgraph_replayable_false_codegen.cpp
A clang/test/OpenMP/taskgraph_target_replayable_codegen.cpp
A offload/test/offloading/taskgraph_replayable_false.c
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_false.cpp
A openmp/runtime/test/taskgraph/taskgraph_replayable_false_reduction.cpp
Log Message:
-----------
[clang][OpenMP] Honour replayable(false) inside a taskgraph region
This patch rearranges "replayable" clause handling to permit
"replayable(false)" on constructs lexically within a taskgroup.
Previously these were wired to be always replayable, contrary to the spec.
Reductions need some special care here, otherwise there's a risk that a
copy of reduction data may be taken and never freed if the associated
constructs end up with replayable(false): the handover mechanism
for that data (taskgroup->task node->region) doesn't trigger in the
non-replayable case.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225711
Commit: a84aa4539c1291b759ce9acbd5a9922c3a0c1919
https://github.com/llvm/llvm-project/commit/a84aa4539c1291b759ce9acbd5a9922c3a0c1919
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M offload/test/lit.cfg
Log Message:
-----------
[Offload] Detect taskgraph runtime support as a lit feature
Add a temporary hack in lit.cfg to detect whether the compiled libomp.so
contains taskgraph support, exposed as the 'taskgraph' lit feature, so that
taskgraph tests are reported unsupported rather than failed against a runtime
built without LIBOMP_TASKGRAPH_EXPERIMENTAL. This can be removed once
LIBOMP_TASKGRAPH_EXPERIMENTAL is gone.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225712
Commit: e9931ce84453a50bdf93f1a4f0b8420d955bf93e
https://github.com/llvm/llvm-project/commit/e9931ce84453a50bdf93f1a4f0b8420d955bf93e
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Taskgraph target directive recording: runtime parts
This patch contains the runtime parts of taskgraph target/target
data directive recording. This is the mechanism that captures target
kernel launches, enter/exit data directives and so on into the recorded
taskgraph. As for plain tasks, separate entry points for taskgraph
recording are used vs. those used for immediate execution. In this case,
furthermore, target constructs are implemented initially via libomp then
redirected to libomptarget, rather than going direct to libomptarget as
the usual runtime APIs do.
The support for relocating recorded taskgraph target regions which are
replayed from different stack addresses is outlined here, but not yet
fully implemented.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225713
Commit: 23049bed7aaf422d8f55e1197d2d6daaad1727d8
https://github.com/llvm/llvm-project/commit/23049bed7aaf422d8f55e1197d2d6daaad1727d8
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/lib/CodeGen/CGOpenMPRuntime.h
M clang/lib/CodeGen/CGStmtOpenMP.cpp
A clang/test/OpenMP/taskgraph_target_codegen.cpp
A clang/test/OpenMP/taskgraph_target_data_codegen.cpp
M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
A offload/test/offloading/taskgraph_target.c
A offload/test/offloading/taskgraph_target_data.c
A offload/test/offloading/taskgraph_target_irreducible.c
A offload/test/offloading/taskgraph_target_record.c
A offload/test/offloading/taskgraph_target_replay.c
A offload/test/offloading/taskgraph_target_replay_mixed.c
A offload/test/offloading/taskgraph_target_replayable.c
Log Message:
-----------
[Clang][OpenMP] Taskgraph-specific entry points for target constructs
This patch implements support in Clang for new entry points to use for
recordable "omp target", "omp target {enter,exit} data", "omp target
update" directives (introduced by the previous patch). These entry
points bypass the hidden helper tasks used for "nowait" target directives:
instead, dependences are passed to the new target-specific libomp entry
points where they can be recorded for later replay (in the same way as
taskgraph support for host tasks).
During taskgraph recording, target regions still need to be executed: this
uses a separate set of runtime-tracked dependences (as for host tasks),
and takes place by calling into libomptarget from libomp. Because there
are no hidden helper tasks, these are always synchronous operations.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225714
Commit: f2da9623cf4077d86a172eba4731942ee3e86806
https://github.com/llvm/llvm-project/commit/f2da9623cf4077d86a172eba4731942ee3e86806
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/test/OpenMP/taskgraph_target_replayable_codegen.cpp
M llvm/include/llvm/Frontend/OpenMP/OMP.td
Log Message:
-----------
[OpenMP] Accept 'replayable' on the target-family compound directives
OpenMP 6.0 allows 'target' to be compounded with other directives
(e.g. "target teams"), and those compound directives should also permit
the 'replayable' clause. This patch adds the clause to the directives
in question.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225715
Commit: 47db85c46efdea512ad111104c50c503d339ce68
https://github.com/llvm/llvm-project/commit/47db85c46efdea512ad111104c50c503d339ce68
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaOpenMP.cpp
A clang/test/OpenMP/taskgraph_replayable_restrictions.cpp
Log Message:
-----------
[clang][OpenMP] Diagnose non-replayable tasks in a taskgraph region
OpenMP 6.0 [14.3] forbids a replayable construct in a taskgraph region from
generating a detachable, transparent or undeferred task. None of the three can
be a graph node: a detachable task's completion event is created when the task
is generated, so a replay, which does not generate the task again, leaves the
program no event to fulfil and the node never completes; a transparent task's
dependences are matched outside the region the graph was recorded for; and an
undeferred task runs in the generating thread rather than as a node at all.
This patch implements those restrictions for Clang. Similar checks are
already present in Flang.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225716
Commit: 8a553641f53d661e3e0bfb008ec11d6eba40a9bf
https://github.com/llvm/llvm-project/commit/8a553641f53d661e3e0bfb008ec11d6eba40a9bf
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/i18n/en_US.txt
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_detach_dynamic_fails.cpp
Log Message:
-----------
[OpenMP] Diagnose detachable task within taskgraph (runtime check)
Clang now rejects a detachable task lexically nested in a taskgraph
region, but it cannot see a replayable(cond) construct in a function
called from one: whether that reaches a recording is only known once
the call has been made.
Luckily this is easy to check at runtime via inspecting the
td_flags.detachable flag. This patch does that, and raises an error if
it is set during recording.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225717
Commit: 38beb5c2e8a20af5b00e8ba41f36d2b31f7508ef
https://github.com/llvm/llvm-project/commit/38beb5c2e8a20af5b00e8ba41f36d2b31f7508ef
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M offload/libomptarget/omptarget.cpp
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Transmit target-containing taskgraphs to libomptarget
The same region tree used as the basis for host execution of recorded
graphs is reused for target offload. This is the libomp part of the
contract, pairing with the earlier patch "Taskgraph representation and
transmission protocol in libomptarget" which implements the libomptarget
parts.
The graph is constructed on the libomptarget side using a set of functions
describing the structure of the graph, which are dlopen'd from libomp.
Once transferred, the libomptarget side then defers interpretation of the
graph to an offload plugin: if the plugin then successfully consumes the
graph, it will be used to handle replay (apart from maximal single-entry,
single-exit host regions, which bounce back to libomp).
The omptarget.cpp:target() function has been modified to undo any changes
it makes to the KernelArgs.NumArgs field -- that allows us to keep a
persistent copy for a taskgraph without cloning it again on each launch.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225718
Commit: 68bedf3f21ec5f0e888c8a3bcb8870ab8b040257
https://github.com/llvm/llvm-project/commit/68bedf3f21ec5f0e888c8a3bcb8870ab8b040257
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
A openmp/runtime/test/taskgraph/taskgraph_irreducible_nested_exclusive.cpp
A openmp/runtime/test/taskgraph/taskgraph_mutex_exclusive_serialized.cpp
A openmp/runtime/test/taskgraph/taskgraph_mutex_irreducible_locks.cpp
A openmp/runtime/test/taskgraph/taskgraph_mutex_runtime_locks.cpp
Log Message:
-----------
[OpenMP] Gather mutex sets and honour them during replay
This patch simplifies __kmp_taskgraph_gather_mutex_sets (which was
doing more work than necessary, then discarding the results of that work
anyway), and also honours mutexes during taskgraph replay.
The taskgraph representation handles mutexes in two ways. For cases which
can be reduced to structured "exclusive" regions, mutexes are implicit:
for such a region, children may execute one-at-a-time but in any order.
Not all mutex relations can be expressed in that way though: for the
remainder, each node retains a mutex set as a bitset. A graph initialises
a number of mutexes which is the cardinality of that set. Then for each
set "mutexset" bit a node has, the corresponding mutex is locked.
For the time being, the implementation here is a little crude. The normal
(non-taskgraph) runtime mechanism for claiming mutexes is non-blocking:
if some task encounters a locked mutex, some other task may be scheduled
instead. This taskgraph implementation will actually block until the
mutex is ready.
Several new tests have been added.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225719
Commit: 3bddca0b289489a8273870833f39379a571e32bc
https://github.com/llvm/llvm-project/commit/3bddca0b289489a8273870833f39379a571e32bc
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A offload/test/offloading/taskgraph_target_encounter_order.c
M offload/test/offloading/taskgraph_target_irreducible.c
A offload/test/offloading/taskgraph_target_nowait_schedule.c
M openmp/runtime/src/kmp.h
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Record target constructs without 'nowait' as included tasks
This patch records the 'has_no_wait' flag on target constructs using
the new 'undeferred' flag on the corresponding task node.
This is a change of behaviour wrt. earlier patches in this series: target
constructs now need 'nowait' in order to execute concurrently (scheduled
only by their data dependencies, not program order) within a taskgraph.
New tests have been added, and another test has been adjusted to include
'nowait' to maintain existing semantics for that test.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225720
Commit: 8601ebff5a5a992d5d06f97c8b8b5cebb12620db
https://github.com/llvm/llvm-project/commit/8601ebff5a5a992d5d06f97c8b8b5cebb12620db
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
M offload/include/omptarget.h
M offload/libomptarget/interface.cpp
A offload/test/offloading/taskgraph_firstprivate_saved_aggregate.c
Log Message:
-----------
[Clang][Offload] Implement 'saved' modifier for firstprivate aggregates
This patch implements front-end and runtime parts for the 'saved'
modifier for firstprivate aggregates. Scalars or pointers (word-size
data) are already handled implicitly because they are passed by value in
mapping tables. For aggregates though, the actual data may be in the
stack frame of the recording task: for that reason, we must snapshot
the data and redirect the appropriate pointers into that snapshot.
This is the "saved data environment" described in the spec (OpenMP
6.0, "14.3 taskgraph Construct"), though it's distributed in this
implementation, rather than all being in one place in some given
taskgraph record.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225721
Commit: 1c2159cfc18662e1645662e7bad082de3d3f9b83
https://github.com/llvm/llvm-project/commit/1c2159cfc18662e1645662e7bad082de3d3f9b83
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/lib/CodeGen/CGOpenMPRuntime.h
M clang/lib/CodeGen/CGStmtOpenMP.cpp
A clang/test/OpenMP/taskgraph_target_data_block_codegen.cpp
M flang/test/Parser/OpenMP/replayable-clause.f90
M llvm/include/llvm/Frontend/OpenMP/OMP.td
A offload/test/offloading/taskgraph_target_data_block.c
Log Message:
-----------
[OpenMP] Record the 'target data' block construct into a taskgraph
This patch implements 'target data' blocks nested within a taskgraph,
or carrying an explicit 'replayable' clause. These are recorded as two
nodes: an enter-data and an exit-data action bracketing the block's body.
Adding this feature reveals a further missing feature in the taskgraph
implementation, which is that we need to support 'use_device_ptr' and
'use_device_addr' clauses. Doing so fully and transparently raises a
number of issues throughout the taskgraph offload-execution pipeline.
Those issues will be addressed in future patches.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225722
Commit: 9477bae57015d78129b79d1dd90583d909559f00
https://github.com/llvm/llvm-project/commit/9477bae57015d78129b79d1dd90583d909559f00
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M clang/lib/Sema/SemaOpenMP.cpp
M clang/test/OpenMP/taskgraph_nesting_messages.cpp
M clang/test/OpenMP/taskgraph_replayable_restrictions.cpp
M flang/lib/Semantics/check-omp-structure.cpp
M flang/test/Semantics/OpenMP/taskgraph.f90
Log Message:
-----------
[Clang][Flang][OpenMP] Look past target data region for taskgraph restrictions
This is a follow-up to the previous patch.
A 'target data' region's structured block is executed by the encountering
task, so directives which cannot be used inside a taskgraph should look
through any enclosing 'target data' encountered to the taskgraph beyond.
The checks asked the immediate parent directive instead, so they saw
'target data' and stopped.
A similar fix has been made for Flang.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225723
Commit: 6472306ef97059789081591d136d21244626dc97
https://github.com/llvm/llvm-project/commit/6472306ef97059789081591d136d21244626dc97
Author: Julian Brown <julian.brown at amd.com>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
A offload/test/offloading/taskgraph_target_mutex_exclusive.c
A offload/test/offloading/taskgraph_target_mutex_irreducible.c
M openmp/runtime/src/kmp_taskdeps.cpp
M openmp/runtime/src/kmp_tasking.cpp
Log Message:
-----------
[OpenMP] Handle mutexinoutset for target constructs in a taskgraph
This patch adds support for mutexes ('mutexinoutset') for target
constructs, which works the same way as mutex support for tasks in the
taskgraph context. Offloaded target regions can be mutually-exclusive
with host tasks.
At present the assumption is that GPU plugins will generally not handle
this case themselves, but rather rely on the host-based executor in libomp
to schedule mutually-exclusive work. That's down to each plugin though,
not something baked into the design.
Assisted-By: Claude Opus 5
Pull Request: https://github.com/llvm/llvm-project/pull/225724
Compare: https://github.com/llvm/llvm-project/compare/c37e0ea39fff...6472306ef970
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list