Skip to content

Commit 095942b

Browse files
committed
fixed type mismatch issues
1 parent 5b55c09 commit 095942b

File tree

7 files changed

+13
-26
lines changed

7 files changed

+13
-26
lines changed

Cargo.lock

Lines changed: 1 addition & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

em/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ edition = "2018"
1616

1717
[dependencies]
1818
ocl = "0.19.3"
19-
emu_macro = "0.1.0"
19+
emu_macro = { path = "../emu_macro" }

em/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

emu_examples/arithmetic/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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+
// }

emu_macro/src/accelerating.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use syn::visit::Visit;
1313
use syn::*;
1414

1515
// for etc.use crate::generator::Generator;
16+
use crate::generator::Generator;
1617
use crate::identifier::get_global_work_size;
1718
use crate::identifier::Dim;
18-
use crate::generator::Generator;
1919

2020
// there is passing
2121
// then there is accelerating

emu_macro/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ use syn::fold::Fold;
1616
use syn::*;
1717

1818
// THE TABLE OF CONTENTS
19-
//
19+
//
2020
// these modules are the main modules Emu uses
2121
mod accelerating; // for looking through code for gpu_do!() and using the GPU appropriately
2222
mod 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
2424
mod generator; // for generating OpenCL from Rust
2525
mod identifier; // for identifying a for loop as potentially something we can work with
2626
mod inspector; // for inspecting a function for more info

emu_macro/src/passing.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff 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
{

0 commit comments

Comments
 (0)