1
1
//! proc_macro for accel's #[kernel]
2
- #![ feature( proc_macro) ]
3
2
#![ recursion_limit = "128" ]
4
3
5
4
extern crate nvptx;
@@ -55,9 +54,9 @@ const QUOTE: &[char] = &[' ', '"'];
55
54
/// equals to `accel-core = { path = "/some/path" }`
56
55
fn parse_crate ( attr : & syn:: Attribute ) -> Crate {
57
56
let path = & attr. path ;
58
- let path = quote ! { #path} . to_string ( ) ;
57
+ let path = quote ! { #path} . to_string ( ) ;
59
58
let tts = & attr. tts ;
60
- let tts = quote ! { #tts} . to_string ( ) ;
59
+ let tts = quote ! { #tts} . to_string ( ) ;
61
60
let tokens: Vec < _ > = tts
62
61
. trim_matches ( PENE )
63
62
. split ( '=' )
@@ -102,7 +101,7 @@ fn header(crates: &[Crate]) -> String {
102
101
. iter ( )
103
102
. map ( |c| syn:: Ident :: from ( c. name . replace ( "-" , "_" ) ) )
104
103
. collect ( ) ;
105
- let tt = quote ! {
104
+ let tt = quote ! {
106
105
#![ feature( abi_ptx) ]
107
106
#![ no_std]
108
107
#( extern crate #crates; ) , *
@@ -122,7 +121,7 @@ fn ptx_kernel(func: &syn::ItemFn) -> String {
122
121
let inputs = & decl. inputs ;
123
122
let output = & decl. output ;
124
123
125
- let kernel = quote ! {
124
+ let kernel = quote ! {
126
125
#[ no_mangle]
127
126
#vis #unsafety extern "ptx-kernel" #fn_token #ident( #inputs) #output #block
128
127
} ;
@@ -153,9 +152,9 @@ fn func2caller(ptx_str: &str, func: &syn::ItemFn) -> TokenStream {
153
152
_ => unreachable ! ( "" ) ,
154
153
} )
155
154
. collect ( ) ;
156
- let kernel_name = quote ! { #ident } . to_string ( ) ;
155
+ let kernel_name = quote ! { #ident } . to_string ( ) ;
157
156
158
- let caller = quote ! {
157
+ let caller = quote ! {
159
158
#vis #fn_token #ident( grid: :: accel:: Grid , block: :: accel:: Block , #inputs) #output {
160
159
use :: accel:: kernel:: void_cast;
161
160
use :: accel:: module:: Module ;
0 commit comments