-
Getting Started
-
FAQs
-
Getting Performance
-
Case Studies
-
Offload™ Library
-
C++ Language Extensions
-
Runtime API
-
Command Line Options
- -snvsips3
- -offloadshowptrcalls
- -nomemcpycacheflush
- -minmemcpysize=[n]
- -memcpydmasize=[n]
- -cachesets=[n]
- -warnonouterreadswrites
- -offloadshowptrcalls
- -BEspul[opt]
- -BEspuL[opt]
- -finline-limit=[n]
- -unroll-factor=[n]
- -outputoffloadcode
- -fno-access-control
- -O[n]
- -BEO[n]
- -BEspuopt:[opt]
- -showcallstackonduplerror
- -ignoretrapwordonspu
- -save-temps
- -ocdir [dir]
- -warnouterthiscalls
-
The liboffload header
-
Software caching library
-
Data locality library
-
Constructs library
-
PS3 SDK Function Overloads
-
Technical Information
-
Compiler Errors
- Summary
- Offload1101
- Offload3001
- Offload3005
- Offload3007
- Offload4000
- Offload4001
- Offload4002
- Offload4003
- Offload4105
- Offload4106
- Offload4107
- Offload2401
- Offload2400
- Offload2302
- Offload1108
- Offload1109
- Offload1115
- Offload1122
- Offload1201
- Offload1202
- Offload2000
- Offload2100
- Offload2200
- Offload2301
- Offload4108
-
Compiler Advice
-
Compiler Warnings
-
-
Features
-
Calling PPU functions from SPU
-
Accessing Global Variables
-
PPU virtual methods on SPU
-
Exploiting SPU Performance
-
Using Altivec Instrinsics
-
Using SPU Instrinsics
-
The Software Cache
-
Type Safe Pointers
-
VMX2SPU Engine
-
Compiler Advice
-
Implicit Function Duplication
-
Structure Type Duplication
-
Helpful command line options
-
Offload (SPU) Job functions
-
Core compiler features
-
Case Studies
Offloading a Function Call
Caching instance data
How To Call A Method On A Cached Object.
This article was updated on 2011-06-03 03:58:38
The code below caches the this pointer only by using a local temporary object on the SPU, copies data from the PPU via DMA or Software Cache into that object and calls the (duplicated) method func on it with 2 PPU pointer arguments.
__offload()
{
auto localptr = *ptr; //DMA or SW cache read into a local
localptr.func(ptrarg1,ptrarg2);//__inner this pointer and outer argument pointers* ptr
*ptr = localptr; //writing data back
}
This means that all fields of the instance are now in fast local memory. The write-back at the end may not be necessary if func is a const-qualified member function (doesn't modify the SPU local instance). In fact if any code before the write-back causes side-effects to the (PPU) data that ptr points to, the a single write-back would clobber these changes.
This caching required changes to existing code which may not be practical when offloading larger chunks of code. The next Article 136 describes how to minimise those changes by using standard C++ cache classes.

