/usr/include/oclgrind/Memory.h is in liboclgrind-dev 16.10-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | // Memory.h (Oclgrind)
// Copyright (c) 2013-2016, James Price and Simon McIntosh-Smith,
// University of Bristol. All rights reserved.
//
// This program is provided under a three-clause BSD license. For full
// license terms please see the LICENSE file distributed with this
// source code.
#include "common.h"
namespace oclgrind
{
class Context;
class Memory
{
public:
struct Buffer
{
size_t size;
cl_mem_flags flags;
unsigned char *data;
};
public:
Memory(unsigned addrSpace, unsigned bufferBits, const Context *context);
virtual ~Memory();
size_t allocateBuffer(size_t size, cl_mem_flags flags=0,
const uint8_t *initData = NULL);
uint32_t atomic(AtomicOp op, size_t address, uint32_t value = 0);
uint32_t atomicCmpxchg(size_t address, uint32_t cmp, uint32_t value);
void clear();
size_t createHostBuffer(size_t size, void *ptr, cl_mem_flags flags=0);
bool copy(size_t dest, size_t src, size_t size);
void deallocateBuffer(size_t address);
void dump() const;
unsigned int getAddressSpace() const;
const Buffer* getBuffer(size_t address) const;
void* getPointer(size_t address) const;
size_t getTotalAllocated() const;
bool isAddressValid(size_t address, size_t size=1) const;
bool load(unsigned char *dst, size_t address, size_t size=1) const;
void* mapBuffer(size_t address, size_t offset, size_t size);
bool store(const unsigned char *source, size_t address, size_t size=1);
size_t extractBuffer(size_t address) const;
size_t extractOffset(size_t address) const;
size_t getMaxAllocSize();
private:
const Context *m_context;
std::queue<unsigned> m_freeBuffers;
std::vector<Buffer*> m_memory;
unsigned int m_addressSpace;
size_t m_totalAllocated;
unsigned m_numBitsBuffer;
unsigned m_numBitsAddress;
size_t m_maxNumBuffers;
size_t m_maxBufferSize;
unsigned getNextBuffer();
};
}
|