notifications
Intel Announces Agreement to Acquire Codeplay Software; Expanding our Open Standards Vision. Learn more here.
highlight_off
arrow_back_ios Back to List

class ReadArray<>

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 ReadArray class is defined within Offload contexts. It will DMA the data in to local store on construction and will not 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::ReadArray<ParamsBlock, SIZE> localParams(&gParams[0]);
	for(int i = 0; i < SIZE; i++)
	{
		ret += localParams[i].param1;
	}

	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.