From 60e8aa588fb1c335b18300e9eaaae282a4e38dfd Mon Sep 17 00:00:00 2001 From: Xing Xue Date: Mon, 29 Jan 2024 14:58:23 -0500 Subject: [PATCH 1/4] Flip bitfields of "struct flags" for big-endian in test cases to match the runtime definition in kmp.h. --- openmp/runtime/test/tasking/bug_nested_proxy_task.c | 9 +++++++++ openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/openmp/runtime/test/tasking/bug_nested_proxy_task.c b/openmp/runtime/test/tasking/bug_nested_proxy_task.c index 43502bdcd1abd..05259b217cd1a 100644 --- a/openmp/runtime/test/tasking/bug_nested_proxy_task.c +++ b/openmp/runtime/test/tasking/bug_nested_proxy_task.c @@ -50,12 +50,21 @@ typedef struct kmp_depend_info { union { kmp_uint8 flag; // flag as an unsigned char struct { // flag as a set of 8 bits +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned all : 1; + unsigned unused : 3; + unsigned set : 1; + unsigned mtx : 1; + unsigned out : 1; + unsigned in : 1; +#else unsigned in : 1; unsigned out : 1; unsigned mtx : 1; unsigned set : 1; unsigned unused : 3; unsigned all : 1; +#endif } flags; }; } kmp_depend_info_t; diff --git a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c index ff75df51aff07..8a98df32ce6d5 100644 --- a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c +++ b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c @@ -47,12 +47,21 @@ typedef struct kmp_depend_info { union { kmp_uint8 flag; // flag as an unsigned char struct { // flag as a set of 8 bits +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned all : 1; + unsigned unused : 3; + unsigned set : 1; + unsigned mtx : 1; + unsigned out : 1; + unsigned in : 1; +#else unsigned in : 1; unsigned out : 1; unsigned mtx : 1; unsigned set : 1; unsigned unused : 3; unsigned all : 1; +#endif } flags; }; } kmp_depend_info_t; From 1053a58793f18deea7e5e66b33a8794a50826668 Mon Sep 17 00:00:00 2001 From: Xing Xue Date: Mon, 29 Jan 2024 15:52:04 -0500 Subject: [PATCH 2/4] git-clang-format changes. --- .../test/tasking/bug_nested_proxy_task.c | 24 +++++++++---------- .../test/tasking/bug_proxy_task_dep_waiting.c | 24 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/openmp/runtime/test/tasking/bug_nested_proxy_task.c b/openmp/runtime/test/tasking/bug_nested_proxy_task.c index 05259b217cd1a..24fe1f3fe7607 100644 --- a/openmp/runtime/test/tasking/bug_nested_proxy_task.c +++ b/openmp/runtime/test/tasking/bug_nested_proxy_task.c @@ -51,19 +51,19 @@ typedef struct kmp_depend_info { kmp_uint8 flag; // flag as an unsigned char struct { // flag as a set of 8 bits #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - unsigned all : 1; - unsigned unused : 3; - unsigned set : 1; - unsigned mtx : 1; - unsigned out : 1; - unsigned in : 1; + unsigned all : 1; + unsigned unused : 3; + unsigned set : 1; + unsigned mtx : 1; + unsigned out : 1; + unsigned in : 1; #else - unsigned in : 1; - unsigned out : 1; - unsigned mtx : 1; - unsigned set : 1; - unsigned unused : 3; - unsigned all : 1; + unsigned in : 1; + unsigned out : 1; + unsigned mtx : 1; + unsigned set : 1; + unsigned unused : 3; + unsigned all : 1; #endif } flags; }; diff --git a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c index 8a98df32ce6d5..688860c035728 100644 --- a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c +++ b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c @@ -48,19 +48,19 @@ typedef struct kmp_depend_info { kmp_uint8 flag; // flag as an unsigned char struct { // flag as a set of 8 bits #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - unsigned all : 1; - unsigned unused : 3; - unsigned set : 1; - unsigned mtx : 1; - unsigned out : 1; - unsigned in : 1; + unsigned all : 1; + unsigned unused : 3; + unsigned set : 1; + unsigned mtx : 1; + unsigned out : 1; + unsigned in : 1; #else - unsigned in : 1; - unsigned out : 1; - unsigned mtx : 1; - unsigned set : 1; - unsigned unused : 3; - unsigned all : 1; + unsigned in : 1; + unsigned out : 1; + unsigned mtx : 1; + unsigned set : 1; + unsigned unused : 3; + unsigned all : 1; #endif } flags; }; From c26507f31f3327a8644bc48d24cb5d15a3bcdec5 Mon Sep 17 00:00:00 2001 From: Xing Xue Date: Tue, 30 Jan 2024 10:22:24 -0500 Subject: [PATCH 3/4] Flip bit-fields in 'struct kmp_depend_info' for big-endian in test include file common.h. --- .../test/tasking/hidden_helper_task/common.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/openmp/runtime/test/tasking/hidden_helper_task/common.h b/openmp/runtime/test/tasking/hidden_helper_task/common.h index 402ecf3ed553c..ba57656cbac41 100644 --- a/openmp/runtime/test/tasking/hidden_helper_task/common.h +++ b/openmp/runtime/test/tasking/hidden_helper_task/common.h @@ -17,9 +17,21 @@ typedef struct kmp_depend_info { union { unsigned char flag; struct { - bool in : 1; - bool out : 1; - bool mtx : 1; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned all : 1; + unsigned unused : 3; + unsigned set : 1; + unsigned mtx : 1; + unsigned out : 1; + unsigned in : 1; +#else + unsigned in : 1; + unsigned out : 1; + unsigned mtx : 1; + unsigned set : 1; + unsigned unused : 3; + unsigned all : 1; +#endif } flags; }; } kmp_depend_info_t; From 27e78264802e5f10d57003512864e11eb93a2dcd Mon Sep 17 00:00:00 2001 From: Xing Xue Date: Tue, 6 Feb 2024 17:05:40 -0500 Subject: [PATCH 4/4] Addressed comments. * Add a comment in kmp.h to mention that some test cases contain an explicit copy of struct kmp_depend_info. --- openmp/runtime/src/kmp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h index c287a31e0b1b5..b147063d22826 100644 --- a/openmp/runtime/src/kmp.h +++ b/openmp/runtime/src/kmp.h @@ -2494,7 +2494,8 @@ typedef struct kmp_dephash_entry kmp_dephash_entry_t; #define KMP_DEP_MTX 0x4 #define KMP_DEP_SET 0x8 #define KMP_DEP_ALL 0x80 -// Compiler sends us this info: +// Compiler sends us this info. Note: some test cases contain an explicit copy +// of this struct and should be in sync with any changes here. typedef struct kmp_depend_info { kmp_intptr_t base_addr; size_t len;