[Openmp-commits] [PATCH] D139802: [OpenMP] Add LoongArch64 support in kmp_affinity.cpp

Gong LingQin via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Dec 11 18:29:54 PST 2022


gonglingqin created this revision.
gonglingqin added reviewers: xen0n, xry111, SixWeining, wangleiat, MaskRay, XiaodongLoong.
Herald added subscribers: StephenFan, guansong, yaxunl.
Herald added a project: All.
gonglingqin requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

This patch fixes test cases affinity/kmp-affinity.c,
affinity/kmp-hw-subset.c, and affinity/omp-places.c.


Repository:
  rG LLVM Github Monorepo

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,16 @@
       }
       (*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 there is a
+      // disrupter on LoongArch that a blank line exists before the first
+      // processor info block (i.e. after the "system type" line). 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.481967.patch
Type: text/x-patch
Size: 821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221212/fb6bbab7/attachment.bin>


More information about the Openmp-commits mailing list