P4 to Git Change 1138047 by gandryey@gera-w8 on 2015/04/07 11:38:28

ECR #304775 - Some code clean-up
	- Remove amd::Context reference from the event object. Runtime can use queue to get the context for the limited number of use cases
	- User/GL events will keep the context as a member

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_event.cpp#8 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#69 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#75 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#120 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#91 edit
Этот коммит содержится в:
foreman
2015-04-07 12:03:48 -04:00
родитель c4bbb00b35
Коммит 458cca25ce
4 изменённых файлов: 28 добавлений и 17 удалений
+8 -5
Просмотреть файл
@@ -26,17 +26,15 @@
namespace amd {
Event::Event(HostQueue& queue)
: context_(queue.context())
, callbacks_(NULL)
: callbacks_(NULL)
, status_(CL_INT_MAX)
, profilingInfo_(
queue.properties().test(CL_QUEUE_PROFILING_ENABLE)
|| Agent::shouldPostEventEvents())
{ notified_.clear(); }
Event::Event(Context& context)
: context_(context)
, callbacks_(NULL)
Event::Event()
: callbacks_(NULL)
, status_(CL_SUBMITTED)
{ notified_.clear(); }
@@ -252,6 +250,11 @@ Command::enqueue()
}
}
const Context&
Command::context() const
{
return queue_->context();
}
NDRangeKernelCommand::NDRangeKernelCommand(
HostQueue& queue,
+18 -10
Просмотреть файл
@@ -75,7 +75,6 @@ private:
Monitor lock_;
SharedReference<Context> context_; //!< context associated with this event.
std::atomic<CallBackEntry*> callbacks_; //!< linked list of callback entries.
volatile cl_int status_; //!< current execution status.
std::atomic_flag notified_; //!< Command queue was notified
@@ -117,8 +116,8 @@ protected:
} profilingInfo_;
//! Construct a new event in the given \a context.
Event(Context& context);
//! Construct a new event.
Event();
//! Construct a new event associated to the given command \a queue.
Event(HostQueue& queue);
@@ -138,10 +137,8 @@ protected:
void processCallbacks(cl_int status) const;
public:
//! Return the context for this event.
Context& context() { return context_(); }
const Context& context() const { return context_(); }
virtual const Context& context() const = 0;
//! Return the command this event is associated with.
inline Command& command();
@@ -219,8 +216,8 @@ protected:
const EventWaitList& eventWaitList = nullWaitList);
//! Construct a new command of the given OpenCL type.
Command(Context& context, cl_command_type type) :
Event(context), queue_(NULL), next_(NULL), type_(type),
Command(cl_command_type type) :
Event(), queue_(NULL), next_(NULL), type_(type),
exception_(0), data_(NULL), eventWaitList_(nullWaitList)
{ }
@@ -280,27 +277,36 @@ public:
//! Get the next GPU command
Command* getNext() const { return next_; }
//! Return the context for this event.
virtual const Context& context() const;
};
class UserEvent : public Command
{
const Context& context_;
public:
UserEvent(Context& context) : Command(context, CL_COMMAND_USER) {
UserEvent(Context& context) : Command(CL_COMMAND_USER), context_(context) {
setStatus(CL_SUBMITTED);
}
virtual void submit(device::VirtualDevice& device) {
ShouldNotCallThis();
}
virtual const Context& context() const { return context_; }
};
class ClGlEvent : public Command
{
private:
const Context& context_;
bool waitForFence();
public:
ClGlEvent(Context& context) : Command(context, CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR) {
ClGlEvent(Context& context)
: Command(CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR)
, context_(context) {
setStatus(CL_SUBMITTED);
}
@@ -311,6 +317,8 @@ public:
bool awaitCompletion() {
return waitForFence();
}
virtual const Context& context() const { return context_; }
};
inline Command&
+1 -1
Просмотреть файл
@@ -1543,7 +1543,7 @@ SvmBuffer::malloc(
}
void
SvmBuffer::free(Context& context, void* ptr)
SvmBuffer::free(const Context& context, void* ptr)
{
Remove(reinterpret_cast<uintptr_t>(ptr));
context.svmFree(ptr);
+1 -1
Просмотреть файл
@@ -647,7 +647,7 @@ public:
size_t alignment);
//! Release shared buffer
static void free(Context& context, void* ptr);
static void free(const Context& context, void* ptr);
//! Fill the destination buffer \a dst with the contents of the source
//! buffer \a src \times times.