Skip to content

Commit 7d4c6c7

Browse files
committed
Address reviewer comments
1 parent f074da3 commit 7d4c6c7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

proposals/compilation-hints/Overview.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Based on the [branch hinting proposal](https://github.com/WebAssembly/branch-hin
2020

2121
Each family of hints is bundled in a respective custom section following the example of branch hints. These sections all have the naming convention `metadata.code.*` and follow the structure
2222
* *function index* |U32|
23-
* a vector of hints with entries
23+
* a vector of hints with entries (starting with the number of entries as |U32|)
2424
* *byte offset* |U32| of the hinted instruction from the beginning of the function body (0 for function level hints) (the function body begins at the first byte of its local declarations, the same as branch hints),
2525
* *hint length* |U32| indicating the number of bytes each hint requires,
2626
* *values* |U32| with the actual hint information
@@ -42,7 +42,7 @@ The section `metadata.code.compilation_priority` contains the priority in which
4242

4343
If a length of larger than required to store the 2 values is present, only the first two values of the following hint data is evalued while the rest is ignored. This leaves space for future extensions, e.g. grouping functions. Similarly, the *optimization priority* can be dropped if a length corresponding to only 1 value is given.
4444

45-
The *optimization priority* has no clear implication on whether a function is tiered up using a more optimized compiler. The smaller the value, to more often a function is expected to be running. So an engine can simply order the functions by priority and tier up the ones with the smallest *optimization priority* until the compilation budget is exceeded. The compilation budget might depend on the engine, compiler, available resources, how long the program has been running, etc. Using a threshold might look easier but relies heavily on the accuracy of the estimation, making it potentially less reliable.
45+
The *optimization priority* has no clear implication on whether a function is tiered up using a more optimized compiler. The smaller the value, the more often a function is expected to be running. So an engine can simply order the functions by priority and tier up the ones with the smallest *optimization priority* until the compilation budget is exceeded. The compilation budget might depend on the engine, compiler, available resources, how long the program has been running, etc. Using a threshold might look easier but relies heavily on the accuracy of the estimation, making it potentially less reliable.
4646

4747
During profiling runs, engines can generate the *optimization priority* easily based on either sampling based profiling by simply counting the number of samples where the function is on top or through explicit instrumentation of counters. The latter is a little more contrived. Function call counters alone might not be sufficient to estimate this as the total time spent within a function also heavily depends on its size and jumps within the function. It's therefore a good idea to at least estimate the time spent by adding counters to loops which multiplied by the loop size might be a sufficiently accurate estimator of instructions executed.
4848

@@ -65,7 +65,14 @@ The above example is equivalent to
6565
```
6666
and tools can produce one or the other.
6767

68-
To produce the special value of 127 for the optimization value, one can pass `run_once` without any number instead of the `optimization` annotation.
68+
To produce the special value of 127 for the optimization value, one can pass `run_once` without any number instead of the `optimization` annotation, e.g.
69+
```
70+
(@metadata.code.compilation_priority (compilation 1) (run_once))
71+
```
72+
for
73+
```
74+
(@metadata.code.compilation_order "\01\1F")
75+
```
6976

7077

7178
### Instruction frequencies

0 commit comments

Comments
 (0)