arrow_back_ios Back to List

class WriteArray<>

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.

Include: <liboffload>

The WriteArray class template is instantiated within Offload contexts. It will leave the data uninitialized in local store on construction and will DMA it back to main memory on destruction.

Usage:

#include <liboffload>
#define SIZE 128

class ParamsBlock
{
	int param1, param2, param3, param4;
};

ParamsBlock gParams[SIZE] __ALIGN16;

int DoSomeWork()
{
	int ret = 0;
	liboffload::data::WriteArray<ParamsBlock, SIZE> localParams(&gParams[0]);
	for(int i = 0; i < SIZE; i++)
	{
		localParams[i].param1 = i;
	}
	return ret;
}

Limitations:

The __outer PPU pointer passed to the constructor must be aligned to 16 bytes, or naturally aligned if size is < 16.Reference types are not supported.The size of the local array must be a compile-time constant.