Skip to content

NPU: share the /proc/meminfo reporting helper - #556

Merged
Syllo merged 1 commit into
masterfrom
npu-shared-meminfo
Nov 15, 2026
Merged

Syllo merged 1 commit into
masterfrom
npu-shared-meminfo

Conversation

@Syllo

@Syllo Syllo commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Follow-up to #526.

The QCOM, Rockchip and Intel NPU backends each had their own copy of the /proc/meminfo parser. Move it into a shared gpuinfo_refresh_system_memory() helper.

Besides removing the duplication, this fixes a 32-bit overflow in QCOM and Rockchip: MemTotal and MemAvailable are in kB and were stored in an unsigned long before being multiplied by 1024, which overflows above 4 GB on 32-bit systems. The shared helper parses them as unsigned long long and clamps MemAvailable to MemTotal.

Tested:

  • Built the Intel and Rockchip backends on current master.
  • Exercised the helper through the Intel backend against a fake /sys/class/accel tree; values match /proc/meminfo.
  • Syntax-checked extract_npuinfo_qualcomm.c against the current libqcnpuperf headers (libqcnpuperf is not installed here).

Not tested on NPU hardware.

Move the QCOM, Rockchip and Intel system memory parsing into a common
gpuinfo_refresh_system_memory() helper.

Besides removing three copies, this fixes a 32-bit overflow in QCOM and
Rockchip: MemTotal and MemAvailable are in kB and were stored in an
unsigned long before being multiplied by 1024, which overflows above
4 GB. The shared helper parses them as unsigned long long and clamps
MemAvailable to MemTotal.
@Syllo
Syllo merged commit 1a0d6a8 into master Nov 15, 2026
8 checks passed
@Syllo
Syllo deleted the npu-shared-meminfo branch November 15, 2026 00:20
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.

1 participant