[Openmp-commits] [openmp] 9a0831a - [OpenMP] Skip extra blank line when parsing /proc/cpuinfo on LoongArch64
via Openmp-commits
openmp-commits at lists.llvm.org
Tue Dec 13 04:17:06 PST 2022
Author: gonglingqin
Date: 2022-12-13T20:13:10+08:00
New Revision: 9a0831afa03a8e3181dccb3338fb804db80a96a3
URL: https://github.com/llvm/llvm-project/commit/9a0831afa03a8e3181dccb3338fb804db80a96a3
DIFF: https://github.com/llvm/llvm-project/commit/9a0831afa03a8e3181dccb3338fb804db80a96a3.diff
LOG: [OpenMP] Skip extra blank line when parsing /proc/cpuinfo on LoongArch64
This fixes the following test cases:
* affinity/kmp-affinity.c
* affinity/kmp-hw-subset.c
* affinity/omp-places.c
Differential Revision: https://reviews.llvm.org/D139802
Added:
Modified:
openmp/runtime/src/kmp_affinity.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 43bf79403f44a..fb3f0ed2584a0 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -2943,6 +2943,17 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line,
}
(*line)++;
+#if KMP_ARCH_LOONGARCH64
+ // The parsing logic of /proc/cpuinfo in this function highly depends on
+ // the blank lines between each processor info block. But on LoongArch a
+ // blank line exists before the first processor info block (i.e. after the
+ // "system type" line). This blank line was added because the "system
+ // type" line is unrelated to any of the CPUs. We must skip this line so
+ // that the original logic works on LoongArch.
+ if (*buf == '\n' && *line == 2)
+ continue;
+#endif
+
char s1[] = "processor";
if (strncmp(buf, s1, sizeof(s1) - 1) == 0) {
CHECK_LINE;
More information about the Openmp-commits
mailing list