Implementing private class method as ispc function

45 views
Skip to first unread message

Martin Šošić

unread,
Apr 18, 2013, 8:44:44 AM4/18/13
to ispc-...@googlegroups.com
Hi everybody, I have a following situation:
I have a static private class method which I can parallelize, so I decided to call ispc function from it.
Problem is I am using private structures (nested in class) inside my function, which means I need to also use them in ispc function, and I don't know what is the best way to do it?
How can I make them visible to ispc function? I can not do extern "C" because these structures are nested in class.
My best idea so far is to create extra .h file where i declare this structures and then include it both in .hpp class file and in .ispc file, however if I do that then those structures will not be private but global, which I dont like.

Thank you 

Dmitry Babokin

unread,
Apr 18, 2013, 10:11:21 AM4/18/13
to ispc-...@googlegroups.com
Unfortunatelly, ispc doesn't work with magled names (all C++ symbols, except those, which are marked with extern C). So all symbols (functions, variables, types) should be C-style symbols. One of implications is that these symbols should have global visibility (in C++ namespace/class and etc is part of mangled name). So you have to have global definitions for exposred symbols/types.

But as you've mentioned, you can do a hack and define these types in some file, which is included inside the class (so the types belong to class) and included in .ispc file. In this case this is your responsibility to make sure that it works as you expect (alignment and structures layout and etc are the same).


--
You received this message because you are subscribed to the Google Groups "Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispc-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages