Lines 1-5
Link Here
|
1 |
--- lib/CL/devices/cpuinfo.c.orig 2016-11-20 11:31:19.521203000 +0100 |
1 |
--- lib/CL/devices/cpuinfo.c.orig 2017-02-21 02:36:37 UTC |
2 |
+++ lib/CL/devices/cpuinfo.c 2016-11-20 11:29:24.502817000 +0100 |
2 |
+++ lib/CL/devices/cpuinfo.c |
3 |
@@ -31,9 +31,13 @@ |
3 |
@@ -31,9 +31,13 @@ |
4 |
# include "vccompat.hpp" |
4 |
# include "vccompat.hpp" |
5 |
#endif |
5 |
#endif |
Lines 10-25
Link Here
|
10 |
#include "config.h" |
10 |
#include "config.h" |
11 |
#include "cpuinfo.h" |
11 |
#include "cpuinfo.h" |
12 |
|
12 |
|
13 |
+#if 0 |
13 |
+#ifdef __linux__ |
14 |
const char* cpuinfo = "/proc/cpuinfo"; |
14 |
static const char* cpuinfo = "/proc/cpuinfo"; |
15 |
#define MAX_CPUINFO_SIZE 64*1024 |
15 |
#define MAX_CPUINFO_SIZE 64*1024 |
16 |
//#define DEBUG_POCL_CPUINFO |
16 |
//#define DEBUG_POCL_CPUINFO |
17 |
@@ -152,8 +156,29 @@ pocl_cpuinfo_detect_max_clock_frequency( |
17 |
@@ -153,8 +157,29 @@ pocl_cpuinfo_detect_max_clock_frequency( |
18 |
} |
18 |
} |
19 |
return -1; |
19 |
return -1; |
20 |
} |
20 |
} |
21 |
+#endif |
21 |
+#endif |
22 |
+ |
22 |
|
23 |
+/** |
23 |
+/** |
24 |
+ * Detects the number of parallel hardware threads supported by |
24 |
+ * Detects the number of parallel hardware threads supported by |
25 |
+ * the CPU. |
25 |
+ * the CPU. |
Lines 31-54
Link Here
|
31 |
+{ |
31 |
+{ |
32 |
+ int mib[2], nocpus; |
32 |
+ int mib[2], nocpus; |
33 |
+ size_t len; |
33 |
+ size_t len; |
34 |
|
34 |
+ |
35 |
+ mib[0] = CTL_HW; |
35 |
+ mib[0] = CTL_HW; |
36 |
+ mib[1] = HW_NCPU; |
36 |
+ mib[1] = HW_NCPU; |
37 |
+ len = sizeof(nocpus); |
37 |
+ len = sizeof(nocpus); |
38 |
+ sysctl(mib, 2, &nocpus, &len, NULL, 0); |
38 |
+ sysctl(mib, 2, &nocpus, &len, NULL, 0); |
39 |
|
39 |
+ |
40 |
+ return nocpus; |
40 |
+ return nocpus; |
41 |
+} |
41 |
+} |
42 |
+ |
42 |
|
43 |
+#if 0 |
43 |
+#ifdef __linux__ |
44 |
/** |
44 |
/** |
45 |
* Detects the number of parallel hardware threads supported by |
45 |
* Detects the number of parallel hardware threads supported by |
46 |
* the CPU by parsing the cpuinfo. |
46 |
* the CPU by parsing the cpuinfo. |
47 |
@@ -231,6 +256,27 @@ pocl_cpuinfo_detect_compute_unit_count() |
47 |
@@ -232,6 +257,28 @@ pocl_cpuinfo_detect_compute_unit_count() |
48 |
} |
48 |
} |
49 |
return -1; |
49 |
return -1; |
50 |
} |
50 |
} |
51 |
+#endif |
51 |
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
52 |
+ |
52 |
+ |
53 |
+/** |
53 |
+/** |
54 |
+ * Detects the maximum clock frequency of the CPU. |
54 |
+ * Detects the maximum clock frequency of the CPU. |
Lines 69-86
Link Here
|
69 |
+ |
69 |
+ |
70 |
+ return clockrate; |
70 |
+ return clockrate; |
71 |
+ } |
71 |
+ } |
|
|
72 |
+#endif |
72 |
|
73 |
|
73 |
#ifdef POCL_ANDROID |
74 |
#ifdef POCL_ANDROID |
74 |
|
75 |
|
75 |
@@ -269,6 +315,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ |
76 |
@@ -270,6 +317,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ |
76 |
* short_name is in the .data anyways.*/ |
77 |
* short_name is in the .data anyways.*/ |
77 |
device->long_name = device->short_name; |
78 |
device->long_name = device->short_name; |
78 |
|
79 |
|
79 |
+#if 0 |
80 |
+#ifdef __linux__ |
80 |
/* default vendor and vendor_id, in case it cannot be found by other means */ |
81 |
/* default vendor and vendor_id, in case it cannot be found by other means */ |
81 |
device->vendor = cpuvendor_default; |
82 |
device->vendor = cpuvendor_default; |
82 |
if (device->vendor_id == 0) |
83 |
if (device->vendor_id == 0) |
83 |
@@ -317,6 +364,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ |
84 |
@@ -318,6 +366,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ |
84 |
char *new_name = (char*)malloc (len); |
85 |
char *new_name = (char*)malloc (len); |
85 |
snprintf (new_name, len, "%s-%s", device->short_name, start); |
86 |
snprintf (new_name, len, "%s-%s", device->short_name, start); |
86 |
device->long_name = new_name; |
87 |
device->long_name = new_name; |