arrow_back_ios Back to List


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.

One of the most useful features of Offload is being able to call a function on PPU from SPU using __outer_call.

#include <liboffload>
static int foo() __outer_call;

static int func()
	offloadThread_t handle = __offload()
		int bar = foo(); // calls back onto the PPU and performs its execution there

In the above example, the function foo will have its execution performed on the PPU, before returning the result back within the Offload™ context. This may be useful for example for PPU memory allocations from the SPU.Some restrictions apply on functions with the outer_call attribute.

  • cannot be virtual methods
  • all pointer variables must be outer pointers (pointers to main memory)
  • the this pointer (if a non-static member function) must be an outer pointer
  • all duplicated types must be outer

__outer_call is simply a define to __attribute__((outer_call)) within the library header.

Note that outer calls interrupt the PPU, so doing many outer calls severly impact performance!