2015-12-19 21:35:35 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015, PHILIPPE TILLET. All rights reserved.
|
|
|
|
*
|
|
|
|
* This file is part of ISAAC.
|
|
|
|
*
|
|
|
|
* ISAAC is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301 USA
|
|
|
|
*/
|
2015-12-21 17:04:09 -05:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
#ifndef ISAAC_DRIVER_COMMAND_QUEUE_H
|
|
|
|
#define ISAAC_DRIVER_COMMAND_QUEUE_H
|
|
|
|
|
|
|
|
#include <map>
|
2015-07-21 22:02:36 -07:00
|
|
|
#include "isaac/defines.h"
|
|
|
|
#include "isaac/driver/common.h"
|
|
|
|
#include "isaac/driver/context.h"
|
|
|
|
#include "isaac/driver/device.h"
|
2015-04-29 15:50:57 -04:00
|
|
|
#include "isaac/driver/handle.h"
|
|
|
|
|
|
|
|
namespace isaac
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace driver
|
|
|
|
{
|
|
|
|
|
|
|
|
class Kernel;
|
|
|
|
class Event;
|
|
|
|
class NDRange;
|
|
|
|
class Buffer;
|
|
|
|
|
|
|
|
// Command Queue
|
2016-05-31 01:29:31 -04:00
|
|
|
class ISAACAPI CommandQueue: public has_handle_comparators<CommandQueue>
|
2015-04-29 15:50:57 -04:00
|
|
|
{
|
2015-12-21 18:43:05 -05:00
|
|
|
public:
|
2016-05-31 23:28:32 -04:00
|
|
|
typedef Handle<cl_command_queue, CUstream> handle_type;
|
2015-12-21 18:43:05 -05:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
public:
|
2016-05-31 01:29:31 -04:00
|
|
|
//Constructors
|
2015-07-26 21:13:28 -07:00
|
|
|
CommandQueue(cl_command_queue const & queue, bool take_ownership = true);
|
2015-04-29 15:50:57 -04:00
|
|
|
CommandQueue(Context const & context, Device const & device, cl_command_queue_properties properties = 0);
|
2016-05-31 01:29:31 -04:00
|
|
|
//Accessors
|
|
|
|
handle_type & handle();
|
|
|
|
handle_type const & handle() const;
|
2015-12-21 18:43:05 -05:00
|
|
|
backend_type backend() const;
|
2015-04-29 15:50:57 -04:00
|
|
|
Context const & context() const;
|
|
|
|
Device const & device() const;
|
2016-05-31 01:29:31 -04:00
|
|
|
//Synchronize
|
2015-04-29 15:50:57 -04:00
|
|
|
void synchronize();
|
2016-05-31 01:29:31 -04:00
|
|
|
//Profiling
|
2015-08-12 00:46:51 -07:00
|
|
|
void enable_profiling();
|
|
|
|
void disable_profiling();
|
2016-05-31 01:29:31 -04:00
|
|
|
//Enqueue calls
|
2015-12-21 18:43:05 -05:00
|
|
|
void enqueue(Kernel const & kernel, NDRange global, driver::NDRange local, std::vector<Event> const *, Event *event);
|
2015-04-29 15:50:57 -04:00
|
|
|
void write(Buffer const & buffer, bool blocking, std::size_t offset, std::size_t size, void const* ptr);
|
|
|
|
void read(Buffer const & buffer, bool blocking, std::size_t offset, std::size_t size, void* ptr);
|
2016-05-31 01:29:31 -04:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
private:
|
|
|
|
backend_type backend_;
|
2015-08-03 20:20:27 -07:00
|
|
|
Context context_;
|
2015-04-29 15:50:57 -04:00
|
|
|
Device device_;
|
2015-12-21 18:43:05 -05:00
|
|
|
handle_type h_;
|
2015-04-29 15:50:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|