pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
cpuinfo: finish basic NetBSD support
Module Name: pkgsrc-wip
Committed By: Thomas Klausner <wiz%NetBSD.org@localhost>
Pushed By: wiz
Date: Tue Aug 5 11:02:28 2025 +0200
Changeset: e2b8a00a3794e08307c8f30b4fba3794f552d2e9
Modified Files:
cpuinfo/distinfo
cpuinfo/patches/patch-CMakeLists.txt
cpuinfo/patches/patch-src_freebsd_topology.c
cpuinfo/patches/patch-src_init.c
Log Message:
cpuinfo: finish basic NetBSD support
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e2b8a00a3794e08307c8f30b4fba3794f552d2e9
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
cpuinfo/distinfo | 6 +++---
cpuinfo/patches/patch-CMakeLists.txt | 3 ++-
cpuinfo/patches/patch-src_freebsd_topology.c | 31 ++++++++++++++++++++++++----
cpuinfo/patches/patch-src_init.c | 5 +++--
4 files changed, 35 insertions(+), 10 deletions(-)
diffs:
diff --git a/cpuinfo/distinfo b/cpuinfo/distinfo
index b79c886d5c..ad3ffe4180 100644
--- a/cpuinfo/distinfo
+++ b/cpuinfo/distinfo
@@ -9,6 +9,6 @@ Size (cpuinfo-0.0.20250724-33ed0be77d7767d0e2010e2c3cf972ef36c7c307.tar.gz) = 35
BLAKE2s (googletest-1.11.0.tar.gz) = 0b546cc02c7a8d6e15337b5dde02e2ff1c17bb5232212cba0b665ad47ff51eac
SHA512 (googletest-1.11.0.tar.gz) = 6fcc7827e4c4d95e3ae643dd65e6c4fc0e3d04e1778b84f6e06e390410fe3d18026c131d828d949d2f20dde6327d30ecee24dcd3ef919e21c91e010d149f3a28
Size (googletest-1.11.0.tar.gz) = 886330 bytes
-SHA1 (patch-CMakeLists.txt) = 3cccda742be524e5c04191c0b397695b178a7871
-SHA1 (patch-src_freebsd_topology.c) = 55baf7a15de3e803e09171545c3d6ef1154b7129
-SHA1 (patch-src_init.c) = 064515df6f3108ccca0cc4f691e58edb7b0b967c
+SHA1 (patch-CMakeLists.txt) = ec8a0d584d00540102d50b436f251fbf6521259e
+SHA1 (patch-src_freebsd_topology.c) = 4561cabdbad0765d63c6822d9ee3dfd5235592f2
+SHA1 (patch-src_init.c) = 8a516a15d55b7fb1c9cf505d4dcaf5320775fb4a
diff --git a/cpuinfo/patches/patch-CMakeLists.txt b/cpuinfo/patches/patch-CMakeLists.txt
index 3ae7060c0e..1d5219c3f3 100644
--- a/cpuinfo/patches/patch-CMakeLists.txt
+++ b/cpuinfo/patches/patch-CMakeLists.txt
@@ -1,6 +1,7 @@
$NetBSD$
-Handle NetBSD like FreeBSD (compiles, does not work).
+Add basic NetBSD support.
+https://github.com/pytorch/cpuinfo/pull/315
--- CMakeLists.txt.orig 2025-07-24 17:36:24.000000000 +0000
+++ CMakeLists.txt
diff --git a/cpuinfo/patches/patch-src_freebsd_topology.c b/cpuinfo/patches/patch-src_freebsd_topology.c
index 4a20d8a8f7..475532d9bf 100644
--- a/cpuinfo/patches/patch-src_freebsd_topology.c
+++ b/cpuinfo/patches/patch-src_freebsd_topology.c
@@ -1,18 +1,35 @@
$NetBSD$
-NetBSD support.
+Add basic NetBSD support.
+https://github.com/pytorch/cpuinfo/pull/315
--- src/freebsd/topology.c.orig 2025-07-24 17:36:24.000000000 +0000
+++ src/freebsd/topology.c
-@@ -50,6 +50,7 @@ struct cpuinfo_freebsd_topology cpuinfo_
+@@ -20,6 +20,7 @@ static int sysctl_int(const char* name)
+ return value;
+ }
+
++#if defined(__FreeBSD__)
+ static char* sysctl_str(const char* name) {
+ size_t value_size = 0;
+ if (sysctlbyname(name, NULL, &value_size, NULL, 0) != 0) {
+@@ -42,6 +43,7 @@ static char* sysctl_str(const char* name
+ }
+ return value;
+ }
++#endif
+
+ struct cpuinfo_freebsd_topology cpuinfo_freebsd_detect_topology(void) {
+ struct cpuinfo_freebsd_topology topology = {
+@@ -50,6 +52,7 @@ struct cpuinfo_freebsd_topology cpuinfo_
.threads_per_core = 0,
.threads = 0,
};
-+#if defined(__FreeBSD)
++#if defined (__FreeBSD__)
char* topology_spec = sysctl_str("kern.sched.topology_spec");
if (!topology_spec) {
return topology;
-@@ -94,6 +95,13 @@ struct cpuinfo_freebsd_topology cpuinfo_
+@@ -94,6 +97,19 @@ struct cpuinfo_freebsd_topology cpuinfo_
topology.threads_per_core);
topology.threads = topology.threads_per_core * topology.cores;
return topology;
@@ -21,6 +38,12 @@ NetBSD support.
+ if (topology.cores == 0) {
+ goto fail;
+ }
++ cpuinfo_log_debug("netbsd topology: cores = %d", topology.cores);
++ /* more details need active identification of the CPU, no sysctl available */
++ /* TODO: improve */
++ topology.threads = topology.cores;
++ topology.packages = 1;
++ topology.threads_per_core = 1;
+ return topology;
+#endif
fail:
diff --git a/cpuinfo/patches/patch-src_init.c b/cpuinfo/patches/patch-src_init.c
index 858cb222f6..85e472eba5 100644
--- a/cpuinfo/patches/patch-src_init.c
+++ b/cpuinfo/patches/patch-src_init.c
@@ -1,8 +1,9 @@
$NetBSD$
-Handle NetBSD.
+Add basic NetBSD support.
+https://github.com/pytorch/cpuinfo/pull/315
---- src/init.c.orig 2025-08-04 14:52:02.012913325 +0000
+--- src/init.c.orig 2025-07-24 17:36:24.000000000 +0000
+++ src/init.c
@@ -24,7 +24,7 @@ bool CPUINFO_ABI cpuinfo_initialize(void
#if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
Home |
Main Index |
Thread Index |
Old Index