Allow setting of custom alignments
Alignment can introduce a bias to benchmarking results which isn't obvious. To help deal with that I want to add some options adjusting alignment for generated code.
To give one example I came across while looking into #15124 (closed):
Padding a function that **is not even called** in nofib/real/eff/FS by multiples of 8 bytes gave runtimes of ~240ms, ~220ms and ~210ms depending on the padding. At 64 byte it seems to loop around (size of a cache line).
At a minimum it should be possible to specify alignment of functions.
Potentially we could also consider:
- Padding for sections.
- Padding for functions
- Alignment for info tables.
- Padding for info tables.
- Alignment for Data
The cases where this could have benefits:
Problem: We optimize one subroutine changing it's size. This leads to alignment changes for the following functions making overall performance potentially worse.
Here aligning functions along cache lines would make benchmarks more resilient against accidental alignment changes.
Problem: We might try to optimize code based on a specific benchmark. Going purely by performance of this benchmark we might end up optimizing our code for this specific benchmark instead of the general case.
Varying the alignment would to check if our code simply found a optimum for the alignment caused by this benchmark or if it is generally better.