@@ -33,6 +33,7 @@ namespace math {
3333struct kernel_parts {
3434 std::string includes; // any function definitions - as if they were includet
3535 // at the start of kernel source
36+ std::string declarations; // declarations of any local variables
3637 std::string initialization; // the code for initializations done by all
3738 // threads, even if they have no work
3839 std::string body_prefix; // the code that should be placed at the start of
@@ -43,14 +44,18 @@ struct kernel_parts {
4344 std::string args; // kernel arguments
4445
4546 kernel_parts operator +(const kernel_parts& other) {
46- return {
47- includes + other.includes , initialization + other.initialization ,
48- body_prefix + other.body_prefix , body + other.body ,
49- reduction + other.reduction , args + other.args };
47+ return {includes + other.includes ,
48+ declarations += other.declarations ,
49+ initialization + other.initialization ,
50+ body_prefix + other.body_prefix ,
51+ body + other.body ,
52+ reduction + other.reduction ,
53+ args + other.args };
5054 }
5155
5256 kernel_parts operator +=(const kernel_parts& other) {
5357 includes += other.includes ;
58+ declarations += other.declarations ;
5459 initialization += other.initialization ;
5560 body_prefix += other.body_prefix ;
5661 body += other.body ;
0 commit comments