arrow_back_ios Back to List

-offloadshowptrcalls

Offload KB - offload-library

Old Content Alert

Please note that this is a old document archive and the will most likely be out-dated or superseded by various other products and is purely here for historical purposes.

This commandline option makes the Offload compiler print information (call site, signature of called function) inside offload blocks/functions. This is useful to spot all calls to PPU addresses, so the programmer can either remove/refactor that call (because those call hit performance) or build the correct virtual domain to make this call possible from the SPU (see article on virtual domains).

struct test{    virtual void func(int*){}};void do_call(test* ptr,int *arg){   ptr->func(arg); //virtual call}int main(){    test ovar;    int oint = 1;    __blockingoffload    {        test ivar;        int iint = 1;        do_call(&ivar,&oint); //call with local and outer address        do_call(&ovar,&iint); //call with outer and inner address    }}

For example, on the source code above the compiler prints the following output:

domain.cpp(8), test ::func, __offload void (int __outer*), local this pointerdomain.cpp(8), test ::func, __offload void (int *)*** WARNING: (Offload1203) This virtual call or pointer call may fail due to a missing domain. The __offload block declared at domain.cpp(16) must have a domain attached to be able to offload functions, for example __offload [& myfunction]{ ....  .--- In file: domain.cpp, at line: 8, column: 3   $ptr->func(arg); //virtual call*** WARNING: (Offload1203) This virtual call or pointer call may fail due to a missing domain. The __offload block declared at domain.cpp(16) must have a domain attached to be able to offload functions, for example __offload [& myfunction]{ ....  .--- In file: domain.cpp, at line: 8, column: 3   $ptr->func(arg); //virtual call

There are two calls to do_call with SPU and PPU pointers. That means that inside (the duplicated) do_call the virtual call to test::func is called with SPU and PPU pointers. This information can then be used to offload the correct functions (see virtual domains).

The other warnings (Offload1203) mean that the virtual methods are not on the SPU, so a domain needs to be attached to the offload block (see article on virtual domain), otherwhise the call will fail with a DOMAIN_NOT_FOUND runtme error(see article).