/usr/include/oclgrind/WorkGroup.h is in liboclgrind-dev 15.5-3build1.
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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | // WorkGroup.h (Oclgrind)
// Copyright (c) 2013-2015, 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"
#define CLK_LOCAL_MEM_FENCE (1<<0)
#define CLK_GLOBAL_MEM_FENCE (1<<1)
namespace oclgrind
{
class Context;
class Memory;
class Kernel;
class KernelInvocation;
class WorkItem;
class WorkGroup
{
public:
enum AsyncCopyType{GLOBAL_TO_LOCAL, LOCAL_TO_GLOBAL};
private:
// Comparator for ordering work-items
struct WorkItemCmp
{
bool operator()(const WorkItem *lhs, const WorkItem *rhs) const;
};
std::set<WorkItem*, WorkItemCmp> m_running;
typedef struct
{
const llvm::Instruction *instruction;
AsyncCopyType type;
size_t dest;
size_t src;
size_t size;
size_t num;
size_t srcStride;
size_t destStride;
size_t event;
} AsyncCopy;
typedef struct
{
const llvm::Instruction *instruction;
std::set<WorkItem*, WorkItemCmp> workItems;
uint64_t fence;
std::list<size_t> events;
} Barrier;
public:
WorkGroup(const KernelInvocation *kernelInvocation, Size3 wgid);
virtual ~WorkGroup();
size_t async_copy(
const WorkItem *workItem,
const llvm::Instruction *instruction,
AsyncCopyType type,
size_t dest,
size_t src,
size_t size,
size_t num,
size_t srcStride,
size_t destStride,
size_t event);
void clearBarrier();
const llvm::Instruction* getCurrentBarrier() const;
Size3 getGroupID() const;
size_t getGroupIndex() const;
Size3 getGroupSize() const;
Memory* getLocalMemory() const;
WorkItem *getNextWorkItem() const;
WorkItem *getWorkItem(Size3 localID) const;
bool hasBarrier() const;
void notifyBarrier(WorkItem *workItem, const llvm::Instruction *instruction,
uint64_t fence,
std::list<size_t> events=std::list<size_t>());
void notifyFinished(WorkItem *workItem);
private:
size_t m_groupIndex;
Size3 m_groupID;
Size3 m_groupSize;
const Context *m_context;
Memory *m_localMemory;
std::vector<WorkItem*> m_workItems;
Barrier *m_barrier;
size_t m_nextEvent;
std::list< std::pair<AsyncCopy,std::set<const WorkItem*> > > m_asyncCopies;
std::map < size_t, std::list<AsyncCopy> > m_events;
};
}
|