Replace the 5-argument OMPT dispatch builtins and libgomp implementations
(niter, start, incr, chunk_size, istart) with a 2-argument form (start,
iterations) describing the chunk actually being dispatched, which is all the
information OMPT needs.
gcc/ChangeLog:
* builtin-types.def (BT_FN_VOID_ULONGLONG_ULONGLONG): New.
(BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG):
Remove.
* omp-builtins.def (BUILT_IN_GOMP_LOOP_STATIC_WORKSHARING_DISPATCH):
(BUILT_IN_GOMP_DISTRIBUTE_STATIC_WORKSHARING_DISPATCH): Update
signature.
* omp-expand.cc (expand_omp_for_static_nochunk): Pass chunk start
and iteration count instead of loop bounds.
(expand_omp_for_static_chunk): Likewise.
gcc/fortran/ChangeLog:
* types.def (BT_FN_VOID_ULONGLONG_ULONGLONG): New.
(BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG):
Remove.
libgomp/ChangeLog:
* config/gcn/teams.c (GOMP_distribute_static_worksharing_dispatch):
Update signature and comment.
* config/nvptx/teams.c (GOMP_distribute_static_worksharing_dispatch):
Likewise.
* libgomp_g.h (GOMP_loop_static_worksharing_dispatch,
GOMP_distribute_static_worksharing_dispatch): Update prototypes.
* loop.c (GOMP_loop_static_worksharing_dispatch): Update signature
and comment.
* teams.c (GOMP_distribute_static_worksharing_dispatch): Likewise.
* testsuite/libgomp.c-c++-common/for-static-3.c: Update scan-dump
pattern.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/for-static-3.c: Update scan-dump pattern.
---
gcc/builtin-types.def | 4 ++--
gcc/fortran/types.def | 4 ++--
gcc/omp-builtins.def | 4 ++--
gcc/omp-expand.cc | 22 ++++++-------------
.../c-c++-common/gomp/for-static-3.c | 6 ++---
libgomp/config/gcn/teams.c | 18 ++++++---------
libgomp/config/nvptx/teams.c | 18 ++++++---------
libgomp/libgomp_g.h | 6 -----
libgomp/loop.c | 18 ++++++---------
libgomp/teams.c | 18 ++++++---------
.../libgomp.c-c++-common/for-static-3.c | 3 +--
11 files changed, 44 insertions(+), 77 deletions(-)
diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index 4725668643d..23bfa76eaa4 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -692,6 +692,8 @@ DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_FEXCEPT_T_PTR_INT,
BT_INT,
BT_CONST_FEXCEPT_T_PTR, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_UINT8, BT_PTR, BT_CONST_PTR, BT_UINT8)
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_INT, BT_PTR, BT_CONST_PTR, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_VOID_ULONGLONG_ULONGLONG,
+ BT_VOID, BT_ULONGLONG, BT_ULONGLONG)
DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR)
@@ -945,8 +947,6 @@ DEF_FUNCTION_TYPE_5
(BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR,
DEF_FUNCTION_TYPE_5 (BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR,
BT_BOOL, BT_UINT, BT_PTR_ULONGLONG, BT_ULONGLONG,
BT_PTR_ULONGLONG, BT_PTR_ULONGLONG)
-DEF_FUNCTION_TYPE_5
(BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG,
- BT_VOID, BT_ULONGLONG, BT_ULONGLONG, BT_ULONGLONG,
BT_ULONGLONG, BT_ULONGLONG)
DEF_FUNCTION_TYPE_6 (BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG,
BT_INT, BT_STRING, BT_SIZE, BT_INT, BT_SIZE,
diff --git a/gcc/fortran/types.def b/gcc/fortran/types.def
index 30c1050d87d..eb253d8970e 100644
--- a/gcc/fortran/types.def
+++ b/gcc/fortran/types.def
@@ -123,6 +123,8 @@ DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTRMODE,
BT_VOID, BT_PTR, BT_PTRMODE)
DEF_FUNCTION_TYPE_2 (BT_FN_VOID_CONST_PTR_SIZE, BT_VOID, BT_CONST_PTR, BT_SIZE)
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_CONST_PTR_INT, BT_PTR, BT_CONST_PTR, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_VOID_ULONGLONG_ULONGLONG,
+ BT_VOID, BT_ULONGLONG, BT_ULONGLONG)
DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR)
@@ -198,8 +200,6 @@ DEF_FUNCTION_TYPE_5
(BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR,
DEF_FUNCTION_TYPE_5 (BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR,
BT_BOOL, BT_UINT, BT_PTR_ULONGLONG, BT_ULONGLONG,
BT_PTR_ULONGLONG, BT_PTR_ULONGLONG)
-DEF_FUNCTION_TYPE_5
(BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG,
- BT_VOID, BT_ULONGLONG, BT_ULONGLONG, BT_ULONGLONG,
BT_ULONGLONG, BT_ULONGLONG)
DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
BT_BOOL, BT_LONG, BT_LONG, BT_LONG, BT_LONG,
diff --git a/gcc/omp-builtins.def b/gcc/omp-builtins.def
index 29b3b72c2cd..e870aa71628 100644
--- a/gcc/omp-builtins.def
+++ b/gcc/omp-builtins.def
@@ -527,7 +527,7 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_STATIC_WORKSHARING_END,
ATTR_NOTHROW_LEAF_LIST)
DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_STATIC_WORKSHARING_DISPATCH,
"GOMP_loop_static_worksharing_dispatch",
- BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG,
+ BT_FN_VOID_ULONGLONG_ULONGLONG,
ATTR_NOTHROW_LEAF_LIST)
DEF_GOMP_BUILTIN (BUILT_IN_GOMP_DISTRIBUTE_STATIC_WORKSHARING,
"GOMP_distribute_static_worksharing",
@@ -542,5 +542,5 @@ DEF_GOMP_BUILTIN
(BUILT_IN_GOMP_DISTRIBUTE_STATIC_WORKSHARING_END,
ATTR_NOTHROW_LEAF_LIST)
DEF_GOMP_BUILTIN (BUILT_IN_GOMP_DISTRIBUTE_STATIC_WORKSHARING_DISPATCH,
"GOMP_distribute_static_worksharing_dispatch",
- BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG,
+ BT_FN_VOID_ULONGLONG_ULONGLONG,
ATTR_NOTHROW_LEAF_LIST)
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index 61b051f990d..022632f5ad0 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -5602,13 +5602,9 @@ expand_omp_for_static_nochunk (struct omp_region *region,
default:
gcc_unreachable ();
}
- tree n_ull = fold_convert (long_long_unsigned_type_node, n);
- tree n1_ull = fold_convert (long_long_unsigned_type_node, n1);
- tree step_ull = fold_convert (long_long_unsigned_type_node, step);
- tree chunk_size_ull = build_int_cst (long_long_unsigned_type_node, 0);
- tree v_ull = fold_convert (long_long_unsigned_type_node, fd->loop.v);
- tree call = build_call_expr (decl, 5, n_ull, n1_ull, step_ull,
- chunk_size_ull, v_ull);
+ tree s0_ull = fold_convert (long_long_unsigned_type_node, s0);
+ tree q_ull = fold_convert (long_long_unsigned_type_node, q);
+ tree call = build_call_expr (decl, 2, s0_ull, q_ull);
force_gimple_operand_gsi (&gsi, call, true, NULL_TREE, true,
GSI_SAME_STMT);
}
@@ -6448,14 +6444,10 @@ expand_omp_for_static_chunk (struct omp_region *region,
default:
gcc_unreachable ();
}
- tree n_ull = fold_convert (long_long_unsigned_type_node, n);
- tree n1_ull = fold_convert (long_long_unsigned_type_node, n1);
- tree step_ull = fold_convert (long_long_unsigned_type_node, step);
- tree chunk_size_ull
- = fold_convert (long_long_unsigned_type_node, chunk_size);
- tree v_ull = fold_convert (long_long_unsigned_type_node, fd->loop.v);
- tree call = build_call_expr (decl, 5, n_ull, n1_ull, step_ull,
- chunk_size_ull, v_ull);
+ tree s0_ull = fold_convert (long_long_unsigned_type_node, s0);
+ tree iterations = fold_build2 (MINUS_EXPR, itype, e0, s0);
+ iterations = fold_convert (long_long_unsigned_type_node, iterations);
+ tree call = build_call_expr (decl, 2, s0_ull, iterations);
force_gimple_operand_gsi (&gsi, call, true, NULL_TREE, true,
GSI_SAME_STMT);
}
diff --git a/gcc/testsuite/c-c++-common/gomp/for-static-3.c
b/gcc/testsuite/c-c++-common/gomp/for-static-3.c
index 950edab0779..a5cf680a946 100644
--- a/gcc/testsuite/c-c++-common/gomp/for-static-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/for-static-3.c
@@ -8,13 +8,11 @@
/* { dg-final { scan-tree-dump-not "GOMP_loop_static_worksharing \\(" "ompexp"
} } */
/* { dg-final { scan-tree-dump-times "GOMP_loop_static_worksharing_start
\\(\[^\\)\]" 2 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times "GOMP_loop_static_worksharing_dispatch
\\(\[^,\]+, \[^,\]+, \[^,\]+, 0, \[^)\]+\\)" 1 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times "GOMP_loop_static_worksharing_dispatch
\\(\[^,\]+, \[^,\]+, \[^,\]+, 4, \[^)\]+\\)" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_static_worksharing_dispatch
\\(\[^,\]+, \[^)\]+\\)" 2 "ompexp" } } */
/* { dg-final { scan-tree-dump-times "GOMP_loop_static_worksharing_end \\(\\)"
2 "ompexp" } } */
/* { dg-final { scan-tree-dump-not "GOMP_distribute_static_worksharing \\("
"ompexp" } } */
/* { dg-final { scan-tree-dump-times "GOMP_distribute_static_worksharing_start
\\(\[^\\)\]" 2 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times
"GOMP_distribute_static_worksharing_dispatch \\(\[^,\]+, \[^,\]+, \[^,\]+, 0,
\[^)\]+\\)" 1 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times
"GOMP_distribute_static_worksharing_dispatch \\(\[^,\]+, \[^,\]+, \[^,\]+, 4,
\[^)\]+\\)" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times
"GOMP_distribute_static_worksharing_dispatch \\(\[^,\]+, \[^)\]+\\)" 2 "ompexp"
} } */
/* { dg-final { scan-tree-dump-times "GOMP_distribute_static_worksharing_end
\\(\\)" 2 "ompexp" } } */
/* { dg-final { scan-tree-dump-not "omp_get_num_threads" "ompexp" } } */
/* { dg-final { scan-tree-dump-not "omp_get_thread_num" "ompexp" } } */
diff --git a/libgomp/config/gcn/teams.c b/libgomp/config/gcn/teams.c
index 7000e99fb32..f748d0db1a4 100644
--- a/libgomp/config/gcn/teams.c
+++ b/libgomp/config/gcn/teams.c
@@ -64,19 +64,15 @@ GOMP_distribute_static_worksharing_start (unsigned long
long niter
return nteams + tid * 1I;
}
-/* Stub for OMPT callback enabled by -fopenmp-ompt-detailed. NITER is the total
- number of iterations. START is the starting iteration index. INCR is the
- increment of the loop (or step). CHUNK_SIZE is the specific chunk size
- requested in the schedule clause, or 0 if not specified. ISTART is the
- iteration index of the logical chunk start. */
+/* Stub for OMPT callback enabled by -fopenmp-ompt-detailed. START is the
+ starting index of the chunk in the logical iteration space. ITERATIONS is
the
+ number of iterations in the chunk. */
void
-GOMP_distribute_static_worksharing_dispatch (
- unsigned long long niter __attribute__ ((unused)),
- unsigned long long start __attribute__ ((unused)),
- unsigned long long incr __attribute__ ((unused)),
- unsigned long long chunk_size __attribute__ ((unused)),
- unsigned long long istart __attribute__ ((unused)))
+GOMP_distribute_static_worksharing_dispatch (unsigned long long start
+ __attribute__ ((unused)),
+ unsigned long long iterations
+ __attribute__ ((unused)))
{}
/* Stub for OMPT callback enabled by -fopenmp-ompt. */
diff --git a/libgomp/config/nvptx/teams.c b/libgomp/config/nvptx/teams.c
index 7793a745bb1..15a3fe5c317 100644
--- a/libgomp/config/nvptx/teams.c
+++ b/libgomp/config/nvptx/teams.c
@@ -65,19 +65,15 @@ GOMP_distribute_static_worksharing_start (unsigned long
long niter
return nteams + tid * 1I;
}
-/* Stub for OMPT callback enabled by -fopenmp-ompt-detailed. NITER is the total
- number of iterations. START is the starting iteration index. INCR is the
- increment of the loop (or step). CHUNK_SIZE is the specific chunk size
- requested in the schedule clause, or 0 if not specified. ISTART is the
- iteration index of the logical chunk start. */
+/* Stub for OMPT callback enabled by -fopenmp-ompt-detailed. START is the
+ starting index of the chunk in the logical iteration space. ITERATIONS is
the
+ number of iterations in the chunk. */
void
-GOMP_distribute_static_worksharing_dispatch (
- unsigned long long niter __attribute__ ((unused)),
- unsigned long long start __attribute__ ((unused)),
- unsigned long long incr __attribute__ ((unused)),
- unsigned long long chunk_size __attribute__ ((unused)),
- unsigned long long istart __attribute__ ((unused)))
+GOMP_distribute_static_worksharing_dispatch (unsigned long long start
+ __attribute__ ((unused)),
+ unsigned long long iterations
+ __attribute__ ((unused)))
{}
/* Stub for OMPT callback enabled by -fopenmp-ompt. */
diff --git a/libgomp/libgomp_g.h b/libgomp/libgomp_g.h
index be3e349a417..269cdcb7d57 100644
--- a/libgomp/libgomp_g.h
+++ b/libgomp/libgomp_g.h
@@ -147,9 +147,6 @@ extern bool GOMP_loop_end_cancel (void);
extern _Complex int GOMP_loop_static_worksharing (unsigned long long);
extern _Complex int GOMP_loop_static_worksharing_start (unsigned long long);
extern void GOMP_loop_static_worksharing_dispatch (unsigned long long,
- unsigned long long,
- unsigned long long,
- unsigned long long,
unsigned long long);
extern void GOMP_loop_static_worksharing_end (void);
@@ -394,9 +391,6 @@ extern void GOMP_teams_reg (void (*) (void *), void *,
unsigned, unsigned,
extern _Complex int GOMP_distribute_static_worksharing (unsigned long long);
extern _Complex int GOMP_distribute_static_worksharing_start (unsigned long
long);
extern void GOMP_distribute_static_worksharing_dispatch (unsigned long long,
- unsigned long long,
- unsigned long long,
- unsigned long long,
unsigned long long);
extern void GOMP_distribute_static_worksharing_end (void);
diff --git a/libgomp/loop.c b/libgomp/loop.c
index 01ba0a3c900..0692663215f 100644
--- a/libgomp/loop.c
+++ b/libgomp/loop.c
@@ -1213,19 +1213,15 @@ GOMP_loop_static_worksharing_start (unsigned long long
niter
return nthreads + tid * 1I;
}
-/* Stub for OMPT callback enabled by -fopenmp-ompt-detailed. NITER is the total
- number of iterations. START is the starting iteration index. INCR is the
- increment of the loop (or step). CHUNK_SIZE is the specific chunk size
- requested in the schedule clause, or 0 if not specified. ISTART is the
- iteration index of the logical chunk start. */
+/* Stub for OMPT callback enabled by -fopenmp-ompt-detailed. START is the
+ starting index of the chunk in the logical iteration space. ITERATIONS is
the
+ number of iterations in the chunk. */
void
-GOMP_loop_static_worksharing_dispatch (
- unsigned long long niter __attribute__ ((unused)),
- unsigned long long start __attribute__ ((unused)),
- unsigned long long incr __attribute__ ((unused)),
- unsigned long long chunk_size __attribute__ ((unused)),
- unsigned long long istart __attribute__ ((unused)))
+GOMP_loop_static_worksharing_dispatch (unsigned long long start
+ __attribute__ ((unused)),
+ unsigned long long iterations
+ __attribute__ ((unused)))
{}
/* Stub for OMPT callback enabled by -fopenmp-ompt. */
diff --git a/libgomp/teams.c b/libgomp/teams.c
index e95f52056c7..817d2402910 100644
--- a/libgomp/teams.c
+++ b/libgomp/teams.c
@@ -84,19 +84,15 @@ GOMP_distribute_static_worksharing_start (unsigned long long
return nteams + tid * 1I;
}
-/* Stub for OMPT callback enabled by -fopenmp-ompt-detailed. NITER is the total
- number of iterations. START is the starting iteration index. INCR is the
- increment of the loop (or step). CHUNK_SIZE is the specific chunk size
- requested in the schedule clause, or 0 if not specified. ISTART is the
- iteration index of the logical chunk start. */
+/* Stub for OMPT callback enabled by -fopenmp-ompt-detailed. START is the
+ starting index of the chunk in the logical iteration space. ITERATIONS is
the
+ number of iterations in the chunk. */
void
-GOMP_distribute_static_worksharing_dispatch (
- unsigned long long niter __attribute__ ((unused)),
- unsigned long long start __attribute__ ((unused)),
- unsigned long long incr __attribute__ ((unused)),
- unsigned long long chunk_size __attribute__ ((unused)),
- unsigned long long istart __attribute__ ((unused)))
+GOMP_distribute_static_worksharing_dispatch (unsigned long long start
+ __attribute__ ((unused)),
+ unsigned long long iterations
+ __attribute__ ((unused)))
{}
/* Stub for OMPT callback enabled by -fopenmp-ompt. */
diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-static-3.c
b/libgomp/testsuite/libgomp.c-c++-common/for-static-3.c
index 77954743843..1f6922fd225 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/for-static-3.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/for-static-3.c
@@ -7,6 +7,5 @@
#include "for-static.h"
/* { dg-final { scan-offload-tree-dump-times
"GOMP_distribute_static_worksharing_start \\(\[^\\)\]" 2 "optimized" } } */
-/* { dg-final { scan-offload-tree-dump-times
"GOMP_distribute_static_worksharing_dispatch \\(\[^,\]+, \[^,\]+, \[^,\]+, 0,
\[^)\]+\\)" 1 "optimized" } } */
-/* { dg-final { scan-offload-tree-dump-times
"GOMP_distribute_static_worksharing_dispatch \\(\[^,\]+, \[^,\]+, \[^,\]+, 4,
\[^)\]+\\)" 1 "optimized" } } */
+/* { dg-final { scan-offload-tree-dump-times
"GOMP_distribute_static_worksharing_dispatch \\(\[^,\]+, \[^)\]+\\)" 2
"optimized" } } */
/* { dg-final { scan-offload-tree-dump-times
"GOMP_distribute_static_worksharing_end \\(\\)" 2 "optimized" } } */
--
2.53.0