Skip to content
Snippets Groups Projects
Commit 21ef764d authored by Praneet Rathi's avatar Praneet Rathi
Browse files

w host

parent 4897c13f
No related branches found
No related tags found
1 merge request!115GPU backend
......@@ -9,6 +9,8 @@ pub fn device_placement(functions: &Vec<Function>, callgraph: &CallGraph) -> Vec
let mut devices = vec![];
for (idx, function) in functions.into_iter().enumerate() {
devices.push(Device::CUDA);
continue;
if let Some(device) = function.device {
devices.push(device);
} else if function.entry || callgraph.num_callees(FunctionID::new(idx)) != 0 {
......
This diff is collapsed.
......@@ -970,6 +970,7 @@ impl PassManager {
_ => todo!(),
}
}
println!("{}", cuda_ir);
println!("{}", llvm_ir);
println!("{}", rust_rt);
......
fn matmul<3>(a: array(i32, #0, #1), b: array(i32, #1, #2)) -> array(i32, #0, #2)
c = constant(array(i32, #0, #2), [])
i_j_ctrl = fork(start, #0, #2)
fn matmul(a: array(i32, 16, 64), b: array(i32, 64, 32)) -> array(i32, 16, 32)
c = constant(array(i32, 16, 32), [])
i_j_ctrl = fork(start, 16, 32)
i_idx = thread_id(i_j_ctrl, 0)
j_idx = thread_id(i_j_ctrl, 1)
k_ctrl = fork(i_j_ctrl, #1)
k_ctrl = fork(i_j_ctrl, 64)
k_idx = thread_id(k_ctrl, 0)
k_join_ctrl = join(k_ctrl)
i_j_join_ctrl = join(k_join_ctrl)
......
#[entry]
fn main<m, n : usize>() -> i32[m, n, 64, 64] {
let res : i32[m, n, 64, 64];
for bi = 0 to m {
for bj = 0 to n {
let tile : i32[64, 64];
for ti = 0 to 64 {
for tj = 0 to 64 {
tile[ti, tj] = (ti as i32) + (tj as i32) + (bi as i32) + (bj as i32);
}
}
for si = 1 to 63 {
for sj = 1 to 63 {
tile[si, sj] = tile[si-1, sj-1] + tile[si+1, sj+1];
}
}
for ri = 0 to 64 {
for rj = 0 to 64 {
res[bi, bj, ri, rj] = tile[ri, rj];
}
}
}
}
return res;
}
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment