[Openmp-commits] [PATCH] D139802: [OpenMP] Skip extra blank line when parsing /proc/cpuinfo on LoongArch64

Gong LingQin via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 13 04:17:11 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9a0831afa03a: [OpenMP] Skip extra blank line when parsing /proc/cpuinfo on LoongArch64 (authored by gonglingqin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139802/new/

https://reviews.llvm.org/D139802

Files:
  openmp/runtime/src/kmp_affinity.cpp


Index: openmp/runtime/src/kmp_affinity.cpp
===================================================================
--- openmp/runtime/src/kmp_affinity.cpp
+++ openmp/runtime/src/kmp_affinity.cpp
@@ -2943,6 +2943,17 @@
       }
       (*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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139802.482426.patch
Type: text/x-patch
Size: 895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221213/0f93134c/attachment.bin>


More information about the Openmp-commits mailing list