Talvos  0.1
SPIR-V interpreter and dynamic analysis framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Workgroup.h
Go to the documentation of this file.
1 // Copyright (c) 2018 the Talvos developers. All rights reserved.
2 //
3 // This file is distributed under a three-clause BSD license. For full license
4 // terms please see the LICENSE file distributed with this source code.
5 
8 
9 #ifndef TALVOS_WORKGROUP_H
10 #define TALVOS_WORKGROUP_H
11 
12 #include <memory>
13 #include <vector>
14 
15 #include "talvos/Dim3.h"
16 
17 namespace talvos
18 {
19 
20 class Device;
21 class Invocation;
22 class Memory;
23 class Object;
24 class PipelineExecutor;
25 
27 class Workgroup
28 {
29 public:
31  typedef std::vector<std::unique_ptr<Invocation>> WorkItemList;
32 
34  typedef std::vector<std::pair<uint32_t, Object>> VariableList;
35 
37  Workgroup(Device &Dev, const PipelineExecutor &Executor, Dim3 GroupId);
38 
40  ~Workgroup();
41 
42  // Do not allow Workgroup objects to be copied.
44  Workgroup(const Workgroup &) = delete;
45  Workgroup &operator=(const Workgroup &) = delete;
47 
49  void addWorkItem(std::unique_ptr<Invocation> WorkItem);
50 
52  Dim3 getGroupId() const { return GroupId; }
53 
56 
58  const WorkItemList &getWorkItems() const { return WorkItems; }
59 
61  const VariableList &getVariables() const { return Variables; }
62 
63 private:
65 
67 
69 
71 };
72 
73 } // namespace talvos
74 
75 #endif
Dim3 getGroupId() const
Returns the group ID of this workgroup.
Definition: Workgroup.h:52
std::vector< std::pair< uint32_t, Object > > VariableList
List of mappings from variable ID to object.
Definition: Workgroup.h:34
Workgroup & operator=(const Workgroup &)=delete
Dim3 GroupId
The group ID.
Definition: Workgroup.h:64
void addWorkItem(std::unique_ptr< Invocation > WorkItem)
Add a work-item invocation to this group, transferring ownership.
Definition: Workgroup.cpp:46
WorkItemList WorkItems
List of work items in this workgroup.
Definition: Workgroup.h:68
Memory & getLocalMemory()
Returns the local memory instance associated with this workgroup.
Definition: Workgroup.h:55
VariableList Variables
Workgroup scope OpVariable allocations.
Definition: Workgroup.h:70
Class representing a 3-dimensional size or ID.
Definition: Dim3.h:22
Workgroup(Device &Dev, const PipelineExecutor &Executor, Dim3 GroupId)
Create a workgroup.
Definition: Workgroup.cpp:23
This file declares the Dim3 class.
This class represents an address space in the virtual device.
Definition: Memory.h:37
An internal class that handles pipeline execution, including the interactive debugger.
const VariableList & getVariables() const
Return the workgroup scope variable pointer values.
Definition: Workgroup.h:61
A Device instance encapsulates properties and state for the virtual device.
Definition: Device.h:29
This class represents a workgroup executing a compute command.
Definition: Workgroup.h:27
Memory * LocalMemory
The local memory of this workgroup.
Definition: Workgroup.h:66
~Workgroup()
Destroy this workgroup.
Definition: Workgroup.cpp:44
std::vector< std::unique_ptr< Invocation > > WorkItemList
List of work items in the workgroup.
Definition: Workgroup.h:31
const WorkItemList & getWorkItems() const
Return the list of work items in this workgroup.
Definition: Workgroup.h:58