[Openmp-commits] [openmp] r240290 - Re-enable Visual Studio Builds.

Jonathan Peyton jonathan.l.peyton at intel.com
Mon Jun 22 08:53:50 PDT 2015


Author: jlpeyton
Date: Mon Jun 22 10:53:50 2015
New Revision: 240290

URL: http://llvm.org/viewvc/llvm-project?rev=240290&view=rev
Log:
Re-enable Visual Studio Builds.

I tried to compile with Visual Studio using CMake and found these two sections of code 
causing problems for Visual Studio.  The first one removes the use of variable length 
arrays by instead using KMP_ALLOCA().  The second part eliminates a redundant cpuid 
assembly call by using the already existing __kmp_x86_cpuid() call instead.

Modified:
    openmp/trunk/runtime/src/kmp_affinity.cpp
    openmp/trunk/runtime/src/kmp_runtime.c

Modified: openmp/trunk/runtime/src/kmp_affinity.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_affinity.cpp?rev=240290&r1=240289&r2=240290&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_affinity.cpp (original)
+++ openmp/trunk/runtime/src/kmp_affinity.cpp Mon Jun 22 10:53:50 2015
@@ -4504,11 +4504,11 @@ void __kmp_balanced_affinity( int tid, i
         } else { // nthreads > __kmp_ncores
 
             // Array to save the number of processors at each core
-            int nproc_at_core[ ncores ];
+            int* nproc_at_core = (int*)KMP_ALLOCA(sizeof(int)*ncores);
             // Array to save the number of cores with "x" available processors;
-            int ncores_with_x_procs[ nth_per_core + 1 ];
+            int* ncores_with_x_procs = (int*)KMP_ALLOCA(sizeof(int)*(nth_per_core+1));
             // Array to save the number of cores with # procs from x to nth_per_core
-            int ncores_with_x_to_max_procs[ nth_per_core + 1 ];
+            int* ncores_with_x_to_max_procs = (int*)KMP_ALLOCA(sizeof(int)*(nth_per_core+1));
 
             for( int i = 0; i <= nth_per_core; i++ ) {
                 ncores_with_x_procs[ i ] = 0;

Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=240290&r1=240289&r2=240290&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Mon Jun 22 10:53:50 2015
@@ -6287,10 +6287,7 @@ static void __kmp_check_mic_type()
 {
     kmp_cpuid_t cpuid_state = {0};
     kmp_cpuid_t * cs_p = &cpuid_state;
-    cs_p->eax=1;
-    cs_p->ecx=0;
-    __asm__ __volatile__("cpuid"
-			 : "+a" (cs_p->eax), "=b" (cs_p->ebx), "+c" (cs_p->ecx), "=d" (cs_p->edx));
+    __kmp_x86_cpuid(1, 0, cs_p);
     // We don't support mic1 at the moment
     if( (cs_p->eax & 0xff0) == 0xB10 ) {
         __kmp_mic_type = mic2;





More information about the Openmp-commits mailing list