More Practical Dynamo: Practical Uses for Dynamo Within Revit
Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.
-
Upload
julianna-campbell -
Category
Documents
-
view
212 -
download
0
Transcript of Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.
![Page 1: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/1.jpg)
Dynamo: A Transparent Dynamic Optimization System
Bala, Dueterwald, and Banerjia
www.hpl.hp.com/cambridge/projects/Dynamo
![Page 2: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/2.jpg)
What is Dynamo? Dynamic translation = quick &
dirty virtual-to-native translation + focused native-to-native optimization of the most frequently executed portions of the translated code
Dynamo focuses on the latter component
![Page 3: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/3.jpg)
Motivation for Dynamo? Programs typically spend most of their
execution time in a small fraction of program code
Optimizing code at translation-time can be counterproductive
Dynamo allows for implementation of a quick virtual-to-native optimizer while letting the native-to-native optimizer clean up the translated code “hot” at runtime.
![Page 4: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/4.jpg)
Dynamo Implementation The native-to-native optimizer is
implemented as a software layer tightly coupled to the CPU hardware
![Page 5: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/5.jpg)
How does Dynamo work? Dynamo operates at runtime Interprets an application’s
instructions via a native instruction interpreter
Activates counter for application addresses satisfying a start of trace condition—an address reached by taking a backward branch in the application
![Page 6: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/6.jpg)
![Page 7: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/7.jpg)
Establishing “Hot” traces If a start of trace is referred to again in the
program, Dynamo goes into the fragment cache thus suspending itself and resuming native execution of the program.
Key: when an address becomes “hot”, it is statistically likely that the very next sequence of interpreted instructions will also be “hot”.
When a counter is “hot”, the interpreter changes state and goes into trace selection mode.
![Page 8: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/8.jpg)
What is done with hot traces? Once selected the instructions are
converted into a low-level IR (intermediate representation).
Next, a lightweight optimizer processes the IR to create a fragment—a single-entry, multi-exit sequence of instructions laid out contiguously in memory.
Finally, a linker emits the fragment code to the fragment cache and links it with others in the cache
![Page 9: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/9.jpg)
Continued… The linker also gives a linker stub at the
bottom of each fragment for each taken branch in the fragment.
If the branch cannot be found in the fragment cache then it is set to jump to its corresponding linker stub which invokes Dynamo’s interpretive loop.
Once a fragment is put into the fragment cache and linked, the hot counter is recycled, thus allowing Dynamo to control the counter storage amount used for trace selection.
![Page 10: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/10.jpg)
The above illustrates the trace selection, fragment formation, and fragment linking processes in terms of application flow
![Page 11: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/11.jpg)
Optimization Results for Dynamo
![Page 12: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/12.jpg)
Dynamo’s Worst-Case Scenario Designed to be an adaptive system,
Dynamo can adjust its thresholds based on the changing behavior of the program running on top.
This allows Dynamo to bail out of the overhead of its own operation—allowing the input program to run directly on the machine. (typical result is break even)
![Page 13: Dynamo: A Transparent Dynamic Optimization System Bala, Dueterwald, and Banerjia projects/Dynamo.](https://reader036.fdocuments.us/reader036/viewer/2022083005/56649f275503460f94c3e86a/html5/thumbnails/13.jpg)
What’s Next? The eventual goal is to run
applications that use Dynamo as a backend to optimize dynamically generated code.
Virtual Machines being the primary focus.