-
-
Notifications
You must be signed in to change notification settings - Fork 0
Metrics and Objective Functions
When appropriate, the compiler may choose from among equivalent candidate functions and data to minimize a final objective metric.
Metrics are integer tuples. Zero is the perfect score.
0 < 1 < (1 1) < (1 (0 2))
A single expression may yield multiple metrics such as memory pressure or cpu pressure.
cpu( e ) = (2 34 (5 67))
memory( e ) = (8 (9 1011))
Objective functions are optimization goals that can be tweaked and weighted.
Goal: min( 0.8 * cpu(program) + 0.2 * memory(program) )
Sometimes selecting a candidate representation is straightforward. Sometimes it can be not so simple. Constraint Solvers may be involved in the future.
mov := λ(: src Imm64)(: tgt Register64). asm!( 'mov \s src , \s tgt \n );
mov := λ(: src Imm64/0)(: tgt Register64). asm!( 'xor \s tgt , \s tgt \n );
In this code two forms of mov
are declared.
Types define equivalence.
Metrics define preference.
The λ☶ source code and documentation are released under the terms of the attached permissive MIT license. This license is intended only to protect the future development of the project while otherwise allowing people to use the code and IP as they would like. Please, just be nice.