[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
Mon Dec 12 00:42:03 PST 2022


gonglingqin updated this revision to Diff 482013.
gonglingqin added a comment.

Address @xen0n's comments.


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.482013.patch
Type: text/x-patch
Size: 895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221212/f9a4498c/attachment.bin>


More information about the Openmp-commits mailing list