devel/llvm18 building example: building with BE_AMDGPU can greatly increase RAM+SWAP use compared to not

From: Mark Millard <marklmi_at_yahoo.com>
Date: Tue, 26 Mar 2024 19:46:25 UTC
I've been doing some poudriere bulk testing of RAM+SWAP use
by some package build activity recently. The below is based
on using amd64 Hyper-V to run FreeBSD with 2 GiBYTes of RAM
and 4 single-thread cores. But it should give a reasonable
idea for aarch64 and indicate the direction for armv7 for
such core counts. (The amd64 Hyper-V context in use takes
far less time for an experiment, like hours instead of days
for the RPi4B overclocked and for the OrangePi+2ed .)

I started with my normal build context analogous to what I
use on aarch64 and armv7 systems:

A) BE_NATIVE instead of BE_STANDARD
B) No MLIR

The examples here are poudriere bulk single-builders,
effectively with MAKE_JOBS_NUMBER_LIMIT=4.

I use a modified version of top that tracks and reports
various MAXimum OBServed ("MaxObs") figures and a
little more.


For building with BE_AMDGPU enabled:

RAM: 
1402Mi MaxObsActive
807392Ki MaxObsWired
1944Mi MaxObs(Act+Wir+Lndry)

SWAP:
5329Mi MaxObsUsed

RAM+SWAP:
6534Mi MaxObs(Act+Lndry+SwapUsed)
7089Mi MaxObs(A+Wir+L+SU) [Abbreviating more what is not additional]
7254Mi (A+W+L+SU+InAct)   [Abbreviating more what is not additional]

(The 7254Mi (A+W+L+SU+InAct) is from when 7089Mi MaxObs(A+Wir+L+SU) was
live but is not a MaxObs [MAXimum OBServed] figure itself.)

The peak RAM+SWAP is during llvm-tblgen for AMDGPU related
materials.


For building with BE_AMDGPU disabled:

RAM: 
1401Mi MaxObsActive
786872Ki MaxObsWired
1944Mi MaxObs(Act+Wir+Lndry)

SWAP:
1252Mi MaxObsUsed

RAM+SWAP:
2613Mi MaxObs(Act+Lndry+SwapUsed)
3160Mi MaxObs(A+Wir+L+SU) [Abbreviating more what is not additional]
3190Mi (A+W+L+SU+InAct)   [Abbreviating more what is not additional]

(The 3190Mi (A+W+L+SU+InAct) is from when 3160Mi MaxObs(A+Wir+L+SU)
was live but is not a MaxObs [MAXimum OBServed] figure itself.)



The around 7254Mi/3190Mi =approx.= 2.27 suggests that low-end
build-machine activity that does not need to build BE_AMDGPU
possibly should have devel/llvm18 configured to avoid BE_AMDGPU .



Notes:
The 2 GiBytes of RAM forces memory pressure required to observe
reasonable RAM+SWAP usage figures, at least for package builds
needing a sufficient about RAM+SWAP.


===
Mark Millard
marklmi at yahoo.com