Skip to content

Freebsd meminfo - #2790

Merged
JustVugg merged 2 commits into
JustVugg:devfrom
risner:freebsd-meminfo
Nov 14, 2026
Merged

JustVugg merged 2 commits into
JustVugg:devfrom
risner:freebsd-meminfo

Conversation

@risner

@risner risner commented Nov 12, 2026 •

Copy link
Copy Markdown

Summary

FreeBSD failed to detect memory, so every engine fell back to its smallest expert cache, and tests/test_compat_mem failed.

Validation

  • make -C c check
  • CUDA changes were tested with make -C c cuda-test (if applicable)
  • Performance claims include hardware, commands, and repeatable measurements
  • Performance claims include a validated experiment manifest with raw evidence

Compatibility

  • The default CPU build remains dependency-free
  • No model files, generated binaries, or benchmark artifacts are included

The non-FreeBSD tests pass make -C c check, but there are other FreeBSD issues with the full test. However this allows make -C c test-c to pass on FreeBSD.

@risner
risner changed the base branch from main to dev November 12, 2026 20:19
@risner

risner commented Nov 12, 2026

Copy link
Copy Markdown
Author

Testing before and after this fix on main.

# git restore c/compat.h c/telemetry.h
# gmake -C c tests/test_compat_mem > ../main-before.log 2>&1
# c/tests/test_compat_mem
available RAM: 0.00 GB
compat_mem_available_gb() returned 0.000 on this platform
# git apply /tmp/colibri-freebsd-meminfo.diff
# gmake -C c tests/test_compat_mem
gmake: Entering directory '/usr/local/src/colibri/c'
gcc -O3 -march=native -fopenmp -pthread -Wall -Wextra -Wno-unused-parameter -Wno-misleading-indentation -Wno-unused-function  -MMD -MP tests/test_compat_mem.c -o tests/test_compat_mem -lm -fopenmp -pthread
gmake: Leaving directory '/usr/local/src/colibri/c'
# c/tests/test_compat_mem
available RAM: 511.17 GB
compat mem probe: ok

`compat_meminfo_gb` checks for macOS and Windows; everything else read
`/proc/meminfo`, which FreeBSD does not have unless `linprocfs` is
mounted. On FreeBSD both numbers came back 0, so every engine fell back
to its smallest expert cache, and `tests/test_compat_mem` failed.

Compiling on FreeBSD now reads `hw.physmem` for the total and free +
inactive pages (`vm.stats.vm.*`) for available, the counterpart of
Linux's MemAvailable and of the macOS branch. The laundry queue and
ZFS's ARC are left out, as MemAvailable leaves out memory that cannot
be reclaimed quickly. `hw_probe` in `telemetry.h` had the same gap and
now uses the same function.  Linux, macOS and Windows are otherwise
unchanged.
`resource_plan.memory_available` and `setup_hw.detect_memory` read
`/proc/meminfo`, which FreeBSD does not have unless `linprocfs` is mounted,
so on FreeBSD the planner had no memory figure (None) and setup knew
neither the total nor what is available. Both now read the kernel's
counters with sysctl: `hw.physmem` for the total, and free + inactive
pages for available, the definition `compat_meminfo_gb` uses in C.
`setup_hw` reuses resource_plan's parser. Other platforms are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants