In computer science, rematerialization or remat is a compiler optimization which saves time by recomputing a value instead of loading it from memory. It is typically tightly integrated with register allocation, where it is used as an alternative to spilling registers to memory. It was conceived by Gregory Chaitin, Marc Auslander, Ashok Chandra, John Cocke, Martin Hopkins and Peter Markstein and implemented in the Pl.8 compiler for the 801 Minicomputer in the late 1970s. Later improvements were made by Preston Briggs, Keith D. Cooper, and Linda Torczon in 1992.

Traditional optimizations such as common subexpression elimination and loop invariant hoisting often focus on eliminating redundant computation. Since computation requires CPU cycles, this is usually a good thing, but it has the potentially devastating side effect that it can increase the live ranges of variables and create many new variables, resulting in spills during register allocation. Rematerialization is nearly the opposite: it decreases register pressure by increasing the amount of CPU computation. To avoid adding more computation time than necessary, rematerialization is done only when the compiler can be confident that it will be of benefit — that is, when a register spill to memory would otherwise occur.

Rematerialization works by keeping track of the expression used to compute each variable, using the concept of available expressions. Sometimes the variables used to compute a value are modified, and so can no longer be used to rematerialize that value. The expression is then said to no longer be available. Other criteria must also be fulfilled, for example a maximum complexity on the expression used to rematerialize the value; it would do no good to rematerialize a value using a complex computation that takes more time than a load. Usually the expression must also have no side effects.

edit
  • Chaitin, Gregory, Marc Auslander, Ashok Chandra, John Cocke, Martin Hopkins, and Peter Markstein. "Register Allocation Via Coloring, Computer Languages, Vol. 6, No. 1, 1981, pp. 47-57"
  • P. Briggs, K. D. Cooper, and L. Torczon. Rematerialization. Proceedings of the SIGPLAN 92 Conference on Programming Language Design and Implementation, SIGPLAN Notices 27(7), p.311-321. July 1992.
  • Mukta Punjabi. Register Rematerialization in GCC. Discusses gcc's implementation of rematerialization.

📚 Artikel Terkait di Wikipedia

Transporter (Star Trek)

returning it to the transporter, where it is reconverted into matter ("rematerialization"). The command often used to request activation of the transporter

Materialization

action involving energy to matter conversion: Dematerialization and rematerialization, two theorized stages of teleportation Materialization of fantasy

Oprah Winfrey

February 23, 2011. de Moraes, Lisa (February 4, 2006). "Dave Chappelle, Rematerializing Guy". The Washington Post. Archived from the original on September

Register allocation

ISSN 0302-9743. Briggs, Preston; Cooper, Keith D.; Torczon, Linda (1992). "Rematerialization". ACM SIGPLAN Notices. 27 (7): 311–321. doi:10.1145/143103.143143

Loop-invariant code motion

spilled. To counteract this, the inverse optimization can be performed, rematerialization. Code motion Loop invariant Aho, Alfred V.; Sethi, Ravi; & Ullman

List of Battle for Dream Island episodes

ownership of the show's recordings. Four is able to recover contestants by rematerializing them with his hand, eliminating the need for recovery centers. The

Optimizing compiler

while being careful to preserve the original semantics. Rematerialization Rematerialization recalculates a value instead of loading it from memory, eliminating

Helena Blavatsky

the ability to control another's consciousness, to dematerialize and rematerialize physical objects, and to project their astral bodies, thus giving the