<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 7, 2016, at 5:56 PM, Hal Finkel via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">----- Original Message -----</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">From: "Sebastian Pop" <<a href="mailto:sebpop.llvm@gmail.com" class="">sebpop.llvm@gmail.com</a>><br class="">To: "Renato Golin" <<a href="mailto:renato.golin@linaro.org" class="">renato.golin@linaro.org</a>><br class="">Cc: "Kristof Beyls" <<a href="mailto:Kristof.Beyls@arm.com" class="">Kristof.Beyls@arm.com</a>>, "Sebastian Paul Pop" <<a href="mailto:s.pop@samsung.com" class="">s.pop@samsung.com</a>>, "llvm-dev"<br class=""><<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>>, "nd" <<a href="mailto:nd@arm.com" class="">nd@arm.com</a>>, "Abe Skolnik" <<a href="mailto:a.skolnik@samsung.com" class="">a.skolnik@samsung.com</a>>, "Clang Dev"<br class=""><<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>>, "Hal Finkel" <<a href="mailto:hfinkel@anl.gov" class="">hfinkel@anl.gov</a>>, "Stephen Canon" <<a href="mailto:scanon@apple.com" class="">scanon@apple.com</a>>, "Matthias Braun"<br class=""><<a href="mailto:matze@braunis.de" class="">matze@braunis.de</a>><br class="">Sent: Friday, October 7, 2016 7:34:40 PM<br class="">Subject: [test-suite] making the test-suite succeed with "-Ofast" and "-ffp-contract=on"<br class=""><br class="">Hi,<br class=""><br class="">I would like to provide a summary of the different proposals on how<br class="">to<br class="">fix the test-suite to make it succeed when specifying extra CFLAGS<br class="">"-Ofast" and "-ffp-contract=on". I would like to expose the issue<br class="">and<br class="">proposed ways to fix it to other potential reviewers that could<br class="">provide extra feedback. We also need to decide which proposal (or<br class="">combination of) to implement and commit.<br class=""><br class="">Proposal 1: <a href="https://reviews.llvm.org/D25277" class="">https://reviews.llvm.org/D25277</a><br class="">modify the CMakes to compile and run each of these benchmarks twice:<br class="">once with added CFLAGS -ffp-contract=off. Record on disk the full<br class="">output of both runs and compare with FP_TOLERANCE. Hash the output<br class="">of<br class="">the run with -ffp-contract=off and exact match against the reference<br class="">output.<br class=""><br class="">The good for Proposal 1:<br class="">- changes contained in the build system: no change to the code of the<br class="">benchmarks<br class="">- runs benchmarks under an extra configuration with CFLAGS +=<br class="">-ffp-contract=off<br class=""><br class="">The bad for Proposal 1:<br class="">- compilation time will double<br class="">- running time on the device will double<br class="">- build system is more complex<br class="">- the build directory goes from 300M to 1.2G due to the extra<br class="">reference outputs recorded under -ffp-contract=off,<br class="">- when running test-suite over small devices it will cost 1G more<br class="">transfer over the network.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I prefer proposal 1 (although, to be fair, it was something I suggested). Being the the business of trying to heavily modify every benchmark that does floating-point computation, as in proposal 2, does not seem to scale well, and can't always be done regardless.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">We can make some effort to reduce the size of the problems being computed by some of the benchmarks (e.g. pollybench); I think that is reasonable and will help with the extra space requirements. That having been said, functionally speaking, our test suite is at least an order of magnitude too small, and so my sympathy is somewhat limited. We're going to have to find a way to execute the test suite in stages on smaller devices to limit the peak usage, if not because of this then because we've added a lot more test applications and benchmarks in the future.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-Hal</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">Proposal 2: <a href="https://reviews.llvm.org/D25346" class="">https://reviews.llvm.org/D25346</a><br class="">like Proposal 1, except that there are no files written to disk<br class="">(transferred over the network from the device to the host that does<br class="">the fpcmp and hashing), the outputs of both normal compilation and<br class="">the<br class="">kernel compiled under "#pragma STDC FP_CONTRACT OFF" are computed and<br class="">compared on the device running the benchmark. The output of<br class="">-ffp-contract=off is written to disk, and as currently done in the<br class="">test-suite, the output is hashed and exactly matched against the<br class="">reference output.<br class=""><br class="">The good for Proposal 2:<br class="">- no modifications to CMake and Makefiles<br class="">- no extra space to store the extra reference output<br class="">- tests both user CFLAGS specified mode and fast-math and<br class="">fp-contraction=off.<br class=""><br class="">The bad for Proposal 2:<br class="">- compilation time will double: e.g., Polly will optimize both<br class="">kernels,<br class="">- memory requirements on the device will almost double: added one<br class="">extra output array, input arrays are not modified, so no need to<br class="">duplicate them,<br class="">- compute time on the device will more than double: running the<br class="">kernel<br class="">twice, plus an extra loop over both outputs to compare with<br class="">FP_TOLERANCE.<br class="">- requires modifications to the code of the benchmarks: some<br class="">benchmarks may not be easily modified and will need to be only run<br class="">under -ffp-contract=off (as in Proposal 3.)<br class=""><br class="">Proposal 3: <a href="https://reviews.llvm.org/D25351" class="">https://reviews.llvm.org/D25351</a><br class="">modify the Makefiles and CMakes to explicitly specify the flags under<br class="">which the results will match the recorded reference output.<br class=""><br class="">The good for Proposal 3:<br class="">- no modifications to the benchmarks<br class="">- minimal modifications to the build system<br class=""><br class="">The bad for Proposal 3:<br class="">- these benchmarks will not be tested with -ffp-contract=on: exact<br class="">matching of the reference output requires -ffp-contract=off<br class="">- adding more tests (as in Proposals 1 and 2) is actually a good<br class="">thing<br class="">for the test-suite<br class=""><br class="">I would like to invite other people to review the above proposals and<br class="">suggest a way forward on fixing the current state of the test-suite<br class="">when running under CFLAGS="-Ofast" and "-ffp-contract=on." Once<br class="">consensus is achieved, I am willing to implement and follow up with<br class="">addressing all reviews necessary to commit the change to the<br class="">test-suite.<br class=""><br class="">Thank you,<br class="">Sebastian<br class=""><br class=""></blockquote></div></blockquote><div><br class=""></div></div><div class="">- First: I don't think we can find a 100% solution for the -ffp-contract=on differences; fpcmp with tolerances won't work on the output of oggenc. Luckily this seems to be the only problematic benchmark today. But at least for that one I see no better solution than adding the -ffp-contract=off switch.</div><div class=""><br class=""></div><div class="">- We should consider Polybench to be the problem here! Benchmarks that just run for a few seconds and produce hundreds of megabytes output are useless as a compiler/CPU benchmarks (time is really spend in libc, the kernel and waiting for disks). In case of well behaving benchmarks Proposal 1 is unnecessary: We can just ship the reference results together with the benchmark and use fpcmp with tolerances, we do that with most other benchmarks today. We just don't really want to do that in the case of Polybench because the output is so huge, so instead we went for just shipping a md5sum of the output which now failed in combination with floating point accuracy swings, starting this whole discussion...</div><div class=""><br class=""></div><div class="">- Because of the nature of Polybench I'd rather see Proposal 2 implemented. Compilation time of polybench is small compared to many of the other benchmarks, if we run into memory issues we can reduce the size of the arrays to normalize runtimes (so far I have no reason to believe we do though, looking at some random polybenchs it seemed by default they create a 1024*1024 array of doubles which should only be 8Meg per array). And hey if we modify the benchmarks anyway we could also add some checksumming to the code (maybe bitcasting the doubles to integers, adjusting for endianess and XOR'ing them together is enough?) and avoid all the I/O.</div><div class=""><br class=""></div><div class="">- I personally could live with Proposal 3 on the grounds of just declaring polybench a problematic benchmark so -ffp-contract=off is fine as a stopgap measure and relying on the fact that we have several other benchmarks that have smaller references outputs and use fpcmp correctly. Of course Proposal 2 is the saner solution here.</div><div class=""><br class=""></div><div class="">- Matthias</div></body></html>