[DRIVER] Removed obsolete SetArg
This commit is contained in:
@@ -94,17 +94,6 @@ host_context::host_context(driver::device* dev): context(dev, host_context_t(),
|
||||
// CUDA //
|
||||
/* ------------------------ */
|
||||
|
||||
// RAII context switcher
|
||||
cu_context::context_switcher::context_switcher(const context &ctx): ctx_((const cu_context&)ctx) {
|
||||
dispatch::cuCtxPushCurrent_v2(*ctx_.cu());
|
||||
}
|
||||
|
||||
cu_context::context_switcher::~context_switcher() {
|
||||
CUcontext tmp;
|
||||
dispatch::cuCtxPopCurrent_v2(&tmp);
|
||||
assert(tmp==*ctx_.cu() && "Switching back to invalid context!");
|
||||
}
|
||||
|
||||
// import CUdevice
|
||||
CUdevice cu_context::get_device_of(CUcontext context){
|
||||
dispatch::cuCtxPushCurrent_v2(context);
|
||||
|
@@ -64,59 +64,15 @@ host_kernel::host_kernel(driver::module* program, const char *name): kernel(prog
|
||||
hst_->fn = program->hst()->functions.at(name);
|
||||
}
|
||||
|
||||
void host_kernel::setArg(unsigned int index, std::size_t size, void* ptr){
|
||||
if(index + 1> params_store_.size()){
|
||||
params_store_.resize(index+1);
|
||||
params_.resize(index+1);
|
||||
}
|
||||
params_store_[index].reset(malloc(size), free);
|
||||
memcpy(params_store_[index].get(), ptr, size);
|
||||
params_[index] = params_store_[index].get();
|
||||
}
|
||||
|
||||
void host_kernel::setArg(unsigned int index, driver::buffer* buffer){
|
||||
if(buffer)
|
||||
kernel::setArg(index, (void*)buffer->hst()->data);
|
||||
else
|
||||
kernel::setArg(index, (std::ptrdiff_t)0);
|
||||
}
|
||||
|
||||
const std::vector<void *> &host_kernel::params(){
|
||||
return params_;
|
||||
}
|
||||
|
||||
/* ------------------------ */
|
||||
// CUDA //
|
||||
/* ------------------------ */
|
||||
|
||||
cu_kernel::cu_kernel(driver::module *program, const char * name) : kernel(program, CUfunction(), true) {
|
||||
cu_params_store_.reserve(64);
|
||||
cu_params_.reserve(64);
|
||||
dispatch::cuModuleGetFunction(&*cu_, *program->cu(), name);
|
||||
// dispatch::cuFuncSetCacheConfig(*cu_, CU_FUNC_CACHE_PREFER_SHARED);
|
||||
}
|
||||
|
||||
void cu_kernel::setArg(unsigned int index, std::size_t size, void* ptr){
|
||||
if(index + 1> cu_params_store_.size()){
|
||||
cu_params_store_.resize(index+1);
|
||||
cu_params_.resize(index+1);
|
||||
}
|
||||
cu_params_store_[index].reset(malloc(size), free);
|
||||
memcpy(cu_params_store_[index].get(), ptr, size);
|
||||
cu_params_[index] = cu_params_store_[index].get();
|
||||
}
|
||||
|
||||
void cu_kernel::setArg(unsigned int index, driver::buffer* data){
|
||||
if(data)
|
||||
kernel::setArg(index, *data->cu());
|
||||
else
|
||||
kernel::setArg(index, (std::ptrdiff_t)0);
|
||||
}
|
||||
|
||||
void* const* cu_kernel::cu_params() const
|
||||
{ return cu_params_.data(); }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user