From f53e10f4b39eb7c29fed4550117da2faebfb2bbb Mon Sep 17 00:00:00 2001 From: ouankou Date: Fri, 27 Feb 2026 07:59:41 +0000 Subject: [PATCH] Fix OpenMP 6.0 taskgraph and target clause handling --- src/OpenMPIR.cpp | 11 ++++++++++- src/ompparser.yy | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/OpenMPIR.cpp b/src/OpenMPIR.cpp index 3dbe4ee7..c75fb8c5 100644 --- a/src/OpenMPIR.cpp +++ b/src/OpenMPIR.cpp @@ -1348,11 +1348,15 @@ OpenMPClause *OpenMPDirective::addOpenMPClause(int k, ...) { case OMPC_no_openmp_constructs: case OMPC_no_openmp_routines: case OMPC_no_parallelism: + case OMPC_graph_id: + case OMPC_graph_reset: + case OMPC_replayable: case OMPC_indirect: case OMPC_transparent: case OMPC_threadset: case OMPC_safesync: case OMPC_device_safesync: + case OMPC_memscope: case OMPC_local: case OMPC_init: case OMPC_init_complete: @@ -3014,7 +3018,12 @@ std::string OpenMPGraphIdClause::toString() { return "graph_id(" + expressionToString() + ") "; } -std::string OpenMPGraphResetClause::toString() { return "graph_reset "; } +std::string OpenMPGraphResetClause::toString() { + std::string str = expressionToString(); + if (str.empty()) + return "graph_reset "; + return "graph_reset(" + str + ") "; +} std::string OpenMPTransparentClause::toString() { std::string str = expressionToString(); diff --git a/src/ompparser.yy b/src/ompparser.yy index 7551275e..1f1a9505 100644 --- a/src/ompparser.yy +++ b/src/ompparser.yy @@ -1659,8 +1659,13 @@ otherwise_clause : OTHERWISE { // OpenMP 6.0 clause implementations graph_id_clause : GRAPH_ID { current_clause = addClauseAt(current_directive, @1.first_line, @1.first_column, OMPC_graph_id); } '(' expression ')' ; -graph_reset_clause : GRAPH_RESET { current_clause = addClauseAt(current_directive, @1.first_line, @1.first_column, OMPC_graph_reset); } +graph_reset_clause : GRAPH_RESET { + current_clause = addClauseAt(current_directive, @1.first_line, @1.first_column, OMPC_graph_reset); + } opt_graph_reset_parens ; +opt_graph_reset_parens : /* empty */ + | '(' expression ')' + ; transparent_clause : TRANSPARENT { current_clause = addClauseAt(current_directive, @1.first_line, @1.first_column, OMPC_transparent); } opt_transparent_parens ; @@ -2391,6 +2396,7 @@ taskgraph_clause : graph_id_clause | replayable_clause | threadset_clause | if_taskgraph_clause + | nogroup_clause ; task_iteration_clause_seq : task_iteration_clause | task_iteration_clause_seq task_iteration_clause @@ -2590,6 +2596,7 @@ target_clause: if_target_clause | thread_limit_clause | private_clause | firstprivate_clause + | shared_clause | in_reduction_clause | map_clause | is_device_ptr_clause