Skip to content

Commit

Permalink
thinking about support for block algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
calebwin committed Oct 27, 2019
1 parent 9febbf8 commit 3ed4b69
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
20 changes: 19 additions & 1 deletion emu_examples/arithmetic/src/main.rs
Expand Up @@ -12,4 +12,22 @@ fn main() {
gpu_do!(read(data));

println!("{:?}", data);
}
}

// fn main() {
// // i = get_group_id
// // j = get_local_id

// for (i, j) in x.enumerate().map(|(i, _)| (i / 10, i % 10)) {

// }

// for (i, chunk) in x.chunks(10).enumerate() {
// let mut scratch = vec![0.0; 10];
// for (j, _) in chunk.enumerate() {

// }
// }


// }
15 changes: 15 additions & 0 deletions emu_macro/src/lib.rs
Expand Up @@ -29,6 +29,21 @@ use accelerating::*;
use inspector::*;
use passing::*;

// TODO document this somewhere
// let's consider the following where x is of type T
// gpu_do!(load(x))
// gpu_do!(read(x))
// here are the restrictions for what T can be
// - T must have .as_slice() for reading from slice to GPU
// - T must have .as_mut_slice() for writing to slice back from GPU
// - T must implement Index, IndexMut for use inside a launched loop
// these requirements are here for 2 reasons
// 1. loading and reading T should be possible for GPU
// 2. using T inside of launched loop should be same on GPU or CPU
// by following these requirements you can use not only Vec but also your
// own types like a Tensor or Matrix or Queue
// of course, you can't use methods and stuff but Emu already enforces that

// error represents an error in compilation that makes it more confusing to user to proceed
// if e is an error, we just stop the proc macro execution and just return what was already there + errors
//
Expand Down

0 comments on commit 3ed4b69

Please sign in to comment.