Files
triton/lib/driver/buffer.cpp

49 lines
1.5 KiB
C++
Raw Normal View History

2017-01-17 20:25:28 -05:00
/* Copyright 2015-2017 Philippe Tillet
2017-05-07 16:51:51 -07:00
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
2017-01-17 20:25:28 -05:00
* subject to the following conditions:
2017-05-07 16:51:51 -07:00
*
* The above copyright notice and this permission notice shall be
2017-01-17 20:25:28 -05:00
* included in all copies or substantial portions of the Software.
2017-05-07 16:51:51 -07:00
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2017-01-17 20:25:28 -05:00
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
2017-05-07 16:51:51 -07:00
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2017-01-17 20:25:28 -05:00
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <iostream>
2017-05-07 16:51:51 -07:00
#include "isaac/driver/stream.h"
#include "isaac/driver/buffer.h"
2017-05-07 16:51:51 -07:00
#include "isaac/driver/context.h"
#include "isaac/driver/dispatch.h"
namespace isaac
{
namespace driver
{
2015-11-20 02:56:33 -05:00
2017-05-07 16:51:51 -07:00
Buffer::Buffer(Context const & /*context*/, size_t size) : base_type(true), size_(size){
dispatch::cuMemAlloc(&*cu_, size);
}
2017-05-07 16:51:51 -07:00
void Buffer::set_zero(Stream const & queue){
dispatch::cuMemsetD8Async(*cu_, 0, size_, queue);
}
2015-06-26 08:08:22 -07:00
}
}