Method x ≝ variable that occupies n bits Vx ≝ conservative estimate of value set
Method x ≝ variable that occupies n bits Vx ≝ conservative estimate of value set
log2|Vx| < n ⇒ RAM compression possible
Method x ≝ variable that occupies n bits Vx ≝ conservative estimate of value set
log2|Vx| < n ⇒ RAM compression possible Cx ≝ another set such that |Cx| = |Vx|
Method x ≝ variable that occupies n bits Vx ≝ conservative estimate of value set
log2|Vx| < n ⇒ RAM compression possible Cx ≝ another set such that |Cx| = |Vx| fx ≝ bijection from Vx to Cx
Method x ≝ variable that occupies n bits Vx ≝ conservative estimate of value set
log2|Vx| < n ⇒ RAM compression possible Cx ≝ another set such that |Cx| = |Vx| fx ≝ bijection from Vx to Cx n - log2|Cx| ⇒ bits saved through compression of x
Example Compression void (*function_queue[8])(void);
Example Compression void (*function_queue[8])(void); x
n = size of a function pointer = 16 bits
Example Compression
x
Vx &function_A &function_B &function_C NULL
Example Compression
x
Vx
n = 16 bits |Vx| = 4
log2|Vx| < n 2 < 16
➼
Example Compression
x
Vx
Cx 0 1 2 3
fx ≝ Vx to Cx ≝ compression
fx-1 ≝ Cx to Vx ≝ decompression
Example Compression ROM x
Cx
Vx = {
,
,
,
}
0 1 2 3
fx ≝ compression table scan fx-1 ≝ decompression table lookup
Example Compression ROM x
Cx
Vx = {
,
,
,
}
0 1 2
128 bits reduced to 16 bits
3
112 bits of RAM saved
Implementation ●
Source-to-source transformation for C −
●
What about value sets of size 1? −
●
Rewrite declaration, initializer, reads, writes
Constant propagation (then DCE, DDE)
Optimizations −
Avoid table-driven compression funcs when possible
Can elect to not compress some compressible variables −
●
For each compressible variable compute a cost / benefit ratio − −
●
But which ones?
Cost – estimated penalty in ROM or CPU cycles Benefit – RAM savings
Sort compressible variables by ratio and compress until some threshold is met
Cost/Benefit Ratio
∑ C i Ai B i V C ≝ access profile A,B ≝ platform-specific costs V ≝ cardinality of value set
Cost/Benefit Ratio
∑ C i Ai B i V C ≝ access profile A,B ≝ platform-specific costs V ≝ cardinality of value set
S u −S c Su ≝ original size Sc ≝ compressed size
Turning the RAM Knob 0%
Turning the RAM Knob 10%
Turning the RAM Knob 20%
Turning the RAM Knob 30%
Turning the RAM Knob 40%
Turning the RAM Knob 50%
Turning the RAM Knob 60%
Turning the RAM Knob 70%
Turning the RAM Knob 80%
Turning the RAM Knob 90%
Turning the RAM Knob 100%
Turning the RAM Knob 95%
Compression Spectrum
Compression Spectrum 95%
Compression Spectrum 95%
Conclusion ●
● ●
RAM likely to remain scarce in low-cost, low-power systems RAM is used inefficiently Manually tweaking data sizes (even among char, short, long, etc.) is unpleasant
$12.5 billion market in 2006. â Products with embedded computing are usually⦠.... Benefit â RAM savings. â Sort compressible variables by ratio and.