averycrespi / yolk Goto Github PK
View Code? Open in Web Editor NEWNumerical computing for Yolol
Home Page: https://yolk.crespi.dev
License: Apache License 2.0
Numerical computing for Yolol
Home Page: https://yolk.crespi.dev
License: Apache License 2.0
yolk -i source.yolk -o out.yolol
Text -> YolkNode
YololNode::format_as_program
to_string
impls in ast.rs
See TODOs in ast.rs
FoldExpr { op: InfixOp, args: Vec<Expr>
"sum"
or "product"
YololNumber::from_str
optimize
is idempotenttests/idempotence.rs
YololNode
-> YololNode
Source:
define foo(a) = sum(a);
let n = foo(0);
export n;
Error:
thread 'main' panicked at 'undefined variable: a', src/bin/yolkc.rs:30:68
--debug
x
parse
, transpile
, and optimize
In src/lib.rs
pub use parser::parse;
pub use transpiler::transpile;
pub us optimizer::optimize;
Refocus Yolk on pipelined, parallel computation.
Yolk currently focuses on single-chip numerical computing. This proposal would allow Yolk to seamlessly spread its Yolol output over n
chips, making use of m
data fields as registers. A scheduler would be implemented to manage statement execution.
Build a DAG of variable dependencies. Yolk's SSA form ensures that the dependency graph is acyclic.
Linearize the DAG into stages. Statements within the same stage may be executed in any order.
Assign statements to chips. All statements in stage n
must execute before any statements in stage n+1
. The assignment algorithm will minimize the following criteria, in order:
Maximum number of lines on a single chip
Number of chips used
Number of register saves and loads
Add register saves and loads to share values between stages. Register positions have already been marked by the previous step.
Map stages to physical lines on chips. Some stages may take more than one physical line. Insert // Sync
comments on empty lines.
Waiting for fix in yolol_number
import a
let b = 1 + (2 + a)
export b
produces b=1+2+a
, but should produce b=3+a
.
Can add match case to optimizer. Need to handle both (2+a)
and (a+2)
, as well as all other commutative operations.
Propagate source statements and expressions through into errors
import a
let b = 1 - (2-a)
export b
produces b=1-2-a
, but should produce b=1-2+a
, or at least b=1-(2-a)
e.g. Disallow importa
to_string
for YololStmt
, YololExpr
to_string
internally calls format_stmt
, etc.YolkNode
-> YololNode
n
chipsAfter the newline change, semicolons are no longer required
Use failure crate
ParseError
, TranspileError
, etc.Error
From
methodsimport a
b = a and (a and a)
produces b=a and a and a
, but should produce b=a and(a and a)
Use associativity instead of commutativity for bracket choices in formatter
Replace TODOs
Must use yolol_number::prelude::*;
yolol_ssa
?
serde
examples
dirCargo.toml
Same format as YOLOL: // comment goes here
Index: get single elem
Slice: get array of elems
index_expr = { expr ~ "[" ~ NUM ~ "]" }
slice_expr = { expr ~ "[" ~ NUM ~ ":" ~ NUM ~ "]" }
Return YolkError::BadParse
instead
YOLOL -> Yolol
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.