Skip to content

perf: larger transfers between final sortbot and master - #940

Open
jodavies wants to merge 1 commit into
form-dev:masterfrom
jodavies:sortbot-perf-2
Open

jodavies wants to merge 1 commit into
form-dev:masterfrom
jodavies:sortbot-perf-2

Conversation

@jodavies

Copy link
Copy Markdown
Collaborator

This commit makes a change to resolve a performance regression reported privately by Adam Kardos, which was not detected by form-bench tests at the time of commit 5f8f71d.

That commit parallelised the term merging in the final sortbot, and the writing out of the data by the master. Usually the master writes out much faster than the terms are merged, which can interact badly with the final sortbot's detection of a "waiting reader". We resolve this by inflating the MINWRITENUMBEROFTERMS value by 16 for that final transfer. This was determined to be a reasonably number "experimentally", but the optimal value is problem and system dependent.

Additionally, reorganise the sortblock book-keeping from SoA to AoS layout. This reduces false cache-line sharing between sortbot threads. This change improves performance on some tests, for which the above change makes no difference.


For Adam's test (tform -w12, AMD Ryzen 7900X), this is a speedup of 1.07 ± 0.01.

And for the form-bench tests on a few systems:

Baseline runtimes and speedups w.r.t tform-master -w12 (AMD Ryzen 7900X)

Benchmark tform-master -w12 runtime (s) tform-sortbot-perf-2 -w12 speedup
chromatic 54.75 ± 0.19 s 1.02 ± 0.01
color 8.16 ± 0.14 s 1.02 ± 0.03
fmft 41.78 ± 0.49 s 1.03 ± 0.01
forcer 38.48 ± 0.23 s 1.01 ± 0.01
forcer-exp 63.77 ± 0.43 s 1.02 ± 0.01
hyperform 32.28 ± 0.28 s 1.03 ± 0.01
ibp-box2l 11.42 ± 0.10 s 1.00 ± 0.01
ibp-mbox1l 4.35 ± 0.14 s 0.99 ± 0.04
ibp-npbox2l 22.06 ± 0.35 s 1.00 ± 0.02
ibp-nptri3l 16.84 ± 0.10 s 1.00 ± 0.01
ibp-pent1l 3.98 ± 0.10 s 0.99 ± 0.04
ibp-tri3l 24.16 ± 0.21 s 1.00 ± 0.01
minceex 34.51 ± 0.14 s 1.01 ± 0.01
mincer 50.79 ± 0.49 s 1.02 ± 0.01
mzv-dm 11.01 ± 0.12 s 1.02 ± 0.01
sort-2-disk 46.79 ± 0.21 s 0.98 ± 0.01
sort-2-large 9.12 ± 0.04 s 0.98 ± 0.01
sort-2-small 2.38 ± 0.03 s 1.00 ± 0.02
sort-disk 7.97 ± 0.05 s 1.00 ± 0.01
sort-large 4.13 ± 0.17 s 1.01 ± 0.04
sort-small 0.99 ± 0.01 s 1.01 ± 0.02
trace 0.90 ± 0.01 s 1.00 ± 0.01

Parallel speedup w.r.t tform-master -w32 (2x AMD EPYC 7302)

Benchmark tform-sbp2 -w32
chromatic 1.06 ± 0.01
color 1.07 ± 0.03
fmft 1.09 ± 0.07
forcer 1.01 ± 0.01
forcer-exp 1.00 ± 0.02
hyperform 1.11 ± 0.06
ibp-box2l 1.00 ± 0.01
ibp-mbox1l 0.99 ± 0.03
ibp-npbox2l 1.00 ± 0.01
ibp-nptri3l 1.00 ± 0.01
ibp-pent1l 0.98 ± 0.03
ibp-tri3l 1.01 ± 0.01
minceex 1.09 ± 0.02
mincer 1.18 ± 0.07
mzv-dm 1.02 ± 0.04
sort-2-disk 1.04 ± 0.05
sort-2-large 1.05 ± 0.10
sort-2-small 1.02 ± 0.07
sort-disk 1.01 ± 0.02
sort-large 1.00 ± 0.04
sort-small 1.03 ± 0.05
trace 1.00 ± 0.04

Parallel speedup w.r.t tform-master -w64 (AMD Ryzen Threadripper PRO 7985WX)

Benchmark tform-sbp2 -w64
chromatic 1.05 ± 0.02
color 1.03 ± 0.03
fmft 1.07 ± 0.07
forcer 1.00 ± 0.05
forcer-exp 1.02 ± 0.01
hyperform 1.02 ± 0.07
ibp-box2l 1.01 ± 0.01
ibp-mbox1l 1.00 ± 0.03
ibp-npbox2l 1.00 ± 0.01
ibp-nptri3l 1.00 ± 0.01
ibp-pent1l 0.99 ± 0.04
ibp-tri3l 1.00 ± 0.01
minceex 1.02 ± 0.11
mincer 1.07 ± 0.11
mzv-dm 1.01 ± 0.06
sort-2-disk 1.02 ± 0.03
sort-2-large 1.04 ± 0.06
sort-2-small 1.02 ± 0.08
sort-disk 1.00 ± 0.01
sort-large 1.02 ± 0.02
sort-small 1.04 ± 0.04
trace 0.99 ± 0.06

This commit makes a change to resolve a performance regression reported
privately by Adam Kardos, which was not detected by form-bench tests at
the time of commit 5f8f71d.

That commit parallelised the term merging in the final sortbot, and the
writing out of the data by the master. Usually the master writes out much
faster than the terms are merged, which can interact badly with the final
sortbot's detection of a "waiting reader". We resolve this by inflating the
MINWRITENUMBEROFTERMS value by 16 for that final transfer. This was determined
to be a reasonably number "experimentally", but the optimal value is problem
and system dependent.

Additionally, reorganise the sortblock book-keeping from SoA to AoS layout.
This reduces false cache-line sharing between sortbot threads. This change
improves performance on some tests, for which the above change makes no
difference.

Co-authored-by: AnaIPereira <AnaIPereira@users.noreply.github.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 66.073% (+0.004%) from 66.069% — jodavies:sortbot-perf-2 into form-dev:master

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