[Openmp-commits] [openmp] [OpenMP] Add absolute KMP_HW_SUBSET functionality (PR #85326)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 14 15:29:13 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 8bdddcf0bb5a40e6ce6cbf7fc6b7ce576e2b032d f1d808a928a62a1ff3dc1678ba3d97a913cc148e -- openmp/runtime/test/affinity/kmp-abs-hw-subset.c openmp/runtime/src/kmp_affinity.cpp openmp/runtime/src/kmp_affinity.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 83502adad9..9bf1a7cbed 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -1247,14 +1247,14 @@ bool kmp_topology_t::filter_hw_subset() {
   // Helpful to index into core type sub Ids array
   auto get_core_type_index = [](const kmp_hw_thread_t &t) {
     switch (t.attrs.get_core_type()) {
-      case KMP_HW_CORE_TYPE_UNKNOWN:
-      case KMP_HW_MAX_NUM_CORE_TYPES:
-        return 0;
+    case KMP_HW_CORE_TYPE_UNKNOWN:
+    case KMP_HW_MAX_NUM_CORE_TYPES:
+      return 0;
 #if KMP_ARCH_X86 || KMP_ARCH_X86_64
-      case KMP_HW_CORE_TYPE_ATOM:
-        return 1;
-      case KMP_HW_CORE_TYPE_CORE:
-        return 2;
+    case KMP_HW_CORE_TYPE_ATOM:
+      return 1;
+    case KMP_HW_CORE_TYPE_CORE:
+      return 2;
 #endif
     }
     KMP_ASSERT2(false, "Unhandled kmp_hw_thread_t enumeration");
diff --git a/openmp/runtime/test/affinity/kmp-abs-hw-subset.c b/openmp/runtime/test/affinity/kmp-abs-hw-subset.c
index d8fe951294..7b3493f1e5 100644
--- a/openmp/runtime/test/affinity/kmp-abs-hw-subset.c
+++ b/openmp/runtime/test/affinity/kmp-abs-hw-subset.c
@@ -18,7 +18,9 @@ static int compare_abs_hw_subset_places(const place_list_t *openmp_places,
                                         int nthreads, int offset) {
   int i, j, expected_per_place;
   if (openmp_places->num_places != nthreads) {
-    fprintf(stderr, "error: KMP_HW_SUBSET did not restrict the thread resource layer!\n");
+    fprintf(
+        stderr,
+        "error: KMP_HW_SUBSET did not restrict the thread resource layer!\n");
     printf("openmp_places places:\n");
     topology_print_places(openmp_places);
     printf("\n");
@@ -57,8 +59,7 @@ static int check_places(int nthreads, int offset) {
 
   value = getenv("OMP_PLACES");
   if (!value) {
-    fprintf(stderr,
-            "error: OMP_PLACES must be set to threads!\n");
+    fprintf(stderr, "error: OMP_PLACES must be set to threads!\n");
     return EXIT_FAILURE;
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/85326


More information about the Openmp-commits mailing list