File tree Expand file tree Collapse file tree 7 files changed +13
-26
lines changed
emu_examples/arithmetic/src Expand file tree Collapse file tree 7 files changed +13
-26
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,4 @@ edition = "2018"
1616
1717[dependencies ]
1818ocl = " 0.19.3"
19- emu_macro = " 0.1.0 "
19+ emu_macro = { path = " ../emu_macro " }
Original file line number Diff line number Diff line change @@ -144,10 +144,10 @@ macro_rules! get_buffer_key {
144144/// 3. Launching on the GPU with `gpu_do!(launch())`
145145///
146146/// Note that data must be an identifier. The only hard requirement for data is
147- /// that it must have the 2 following methods.
147+ /// that it must have the 2 following methods.
148148/// - `fn as_slice(&self) -> &[f32]`
149149/// - `fn as_mut_slice(&mut self) -> &mut [f32]`
150- ///
150+ ///
151151/// There is a soft requirement that the data should be representing a list of
152152/// `f32`s and indexing it with `data[i]` should return an `f32`. But this is
153153/// really just to ensure that when we lift code from CPU to GPU it is
Original file line number Diff line number Diff line change @@ -25,9 +25,8 @@ fn main() {
2525// for (i, chunk) in x.chunks(10).enumerate() {
2626// let mut scratch = vec![0.0; 10];
2727// for (j, _) in chunk.enumerate() {
28-
28+
2929// }
3030// }
3131
32-
33- // }
32+ // }
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ use syn::visit::Visit;
1313use syn:: * ;
1414
1515// for etc.use crate::generator::Generator;
16+ use crate :: generator:: Generator ;
1617use crate :: identifier:: get_global_work_size;
1718use crate :: identifier:: Dim ;
18- use crate :: generator:: Generator ;
1919
2020// there is passing
2121// then there is accelerating
Original file line number Diff line number Diff line change @@ -16,11 +16,11 @@ use syn::fold::Fold;
1616use syn:: * ;
1717
1818// THE TABLE OF CONTENTS
19- //
19+ //
2020// these modules are the main modules Emu uses
2121mod accelerating; // for looking through code for gpu_do!() and using the GPU appropriately
2222mod passing; // for passing around a reference to the GPU from function to function
23- // these modules are more linke utilities for Emu
23+ // these modules are more linke utilities for Emu
2424mod generator; // for generating OpenCL from Rust
2525mod identifier; // for identifying a for loop as potentially something we can work with
2626mod inspector; // for inspecting a function for more info
Original file line number Diff line number Diff line change @@ -236,9 +236,7 @@ impl Fold for HelperFunctionReturnModifier {
236236// modifies return statements
237237// this mainly just creates an instance of the above "folder" that we defined
238238// we then just invoke it's "fold_item_fn" method to fold on the function
239- pub fn modify_returns_for_helper_function (
240- input : TokenStream ,
241- ) -> Result < TokenStream , Vec < Error > > {
239+ pub fn modify_returns_for_helper_function ( input : TokenStream ) -> Result < TokenStream , Vec < Error > > {
242240 // parse into function
243241 let maybe_ast = syn:: parse :: < ItemFn > ( input. clone ( ) ) ;
244242
@@ -340,8 +338,9 @@ impl Fold for HelperFunctionInvocationModifier {
340338 }
341339
342340 if is_helper_function_invocation {
343- let gpu_ident = quote ! { gpu} . into ( ) ;
344- i. args . insert ( 0 , gpu_ident) ;
341+ let gpu_ident = syn:: Ident :: new ( "gpu" , syn:: export:: Span :: call_site ( ) ) ;
342+ i. args
343+ . insert ( 0 , syn:: Expr :: Verbatim ( gpu_ident. to_token_stream ( ) ) ) ;
345344
346345 let new_code = quote ! {
347346 {
You can’t perform that action at this time.
0 commit comments