PLAN: better code for reals, done Against v0.8.0, on test/bench's kernels, raz against FPC -O2: Jacobi 3.1 -> 1.3 times (251 -> 103 ms), NBody 4.4 -> 1.4 (375 -> 116); rat's workload and the integer kernels as they were. compiler.md says what is left: Jacobi's index, worked out for each element where FPC shares it; NBody's call to Math.sqrt; a comparison of reals that jumps without a BOOL. Not tagged.
| @@ -91,9 +91,12 @@ | ||
| 91 | 91 | `raz-tutorial(7)`, `raz(7)` and `raz-lib(3)`, made by `tools/Doc.raz` |
| 92 | 92 | from `lib/`, and v0.8.0, better code again: slices in registers, |
| 93 | 93 | parameters left in rdi and rsi, operands as the machine has them, |
| 94 | -`while` tested at the bottom, and one line table, DWARF's. `make | |
| 95 | -kernels` measures `test/bench` against FPC `-O2`. Next, by `PLAN.md`: | |
| 96 | -what the owner chooses. | |
| 94 | +`while` tested at the bottom, and one line table, DWARF's, and, | |
| 95 | +not yet tagged, better code for reals: reals on the stack and the | |
| 96 | +busiest real variables in xmm registers, and an array's element and a | |
| 97 | +constant offset as operands, measured on two kernels of reals, | |
| 98 | +`Jacobi` and `NBody`. `make kernels` measures `test/bench` against | |
| 99 | +FPC `-O2`. Next, by `PLAN.md`: what the owner chooses. | |
| 97 | 100 | |
| 98 | 101 | **The freeze.** Since v0.5.0 the language changes only to mend a |
| 99 | 102 | defect, and the library grows only by what breaks no program written |
| @@ -5,12 +5,12 @@ | ||
| 5 | 5 | stopping for the owner's review. A finished milestone is cut from this |
| 6 | 6 | file: git keeps the history, and the report's section 12 the language's. |
| 7 | 7 | |
| 8 | -Better code for reals is under way, by the owner's word. v0.7.1, the | |
| 9 | -manual, and v0.8.0, better code again, are tagged; all before v0.7.1 | |
| 10 | -is approved by the owner, and v0.7.1 and v0.8.0 wait for the owner's | |
| 11 | -review. | |
| 8 | +Better code for reals, begun by the owner's word, is done and waits for the | |
| 9 | +owner's review; it isn't tagged. v0.7.1, the manual, and v0.8.0, | |
| 10 | +better code again, are tagged; all before v0.7.1 is approved by the | |
| 11 | +owner, and v0.7.1 and v0.8.0 wait for the owner's review. | |
| 12 | 12 | |
| 13 | -## Now: better code for reals | |
| 13 | +## Done: better code for reals | |
| 14 | 14 | |
| 15 | 15 | For: code with reals near FPC `-O2`'s, as integer code is. raz keeps a |
| 16 | 16 | real in an integer register and copies it to xmm0 or xmm1 and back |
| @@ -46,6 +46,13 @@ | ||
| 46 | 46 | slot, from which the trap report reads it and a call's return loads |
| 47 | 47 | it, as System V keeps no xmm register through a call. NBody 147 ms |
| 48 | 48 | to 116; rat within noise. |
| 49 | + | |
| 50 | +All told: Jacobi 3.1 times FPC `-O2`'s time to 1.3, NBody 4.4 to 1.4; | |
| 51 | +rat and the integer kernels as they were; 9,131 lines of code. Left: | |
| 52 | +Jacobi's index, worked out for each element where FPC shares it, which | |
| 53 | +one pass can't; NBody's call to `Math.sqrt`, an instruction to FPC; | |
| 54 | +a comparison of reals that jumps without making a `BOOL`, which | |
| 55 | +neither kernel needs. | |
| 49 | 56 | |
| 50 | 57 | ## Next, when the owner says |
| 51 | 58 |
| @@ -603,6 +603,19 @@ | ||
| 603 | 603 | nothing in the trap report, bought 3% more on that copy and nothing |
| 604 | 604 | on NBody. |
| 605 | 605 | |
| 606 | +All told, against v0.8.0: Jacobi 251 ms to 103, 3.1 times FPC | |
| 607 | +`-O2`'s time to 1.3; NBody 375 ms to 116, 4.4 times to 1.4; rat and | |
| 608 | +the integer kernels as they were. What is left of Jacobi is its index, | |
| 609 | +`i * N + j`, worked out five times a round, once for each element, | |
| 610 | +where FPC works it out three times: one pass keeps no expression to | |
| 611 | +share. What is left of | |
| 612 | +NBody is mostly its call to `Math.sqrt`, an instruction FPC puts in | |
| 613 | +place, with the spills and loads around it; then the `lea` of each | |
| 614 | +array's address, which FPC makes too, and the fifth real, `d2`, for | |
| 615 | +which there is no register. A comparison of reals still makes a | |
| 616 | +`BOOL` before it jumps, as `not (a < b)` isn't `a >= b` for a NaN; | |
| 617 | +neither kernel has one. | |
| 618 | + | |
| 606 | 619 | ## diag.pas: messages |
| 607 | 620 | |
| 608 | 621 | Every message the compiler prints is made here. A position, `TPos`, is |