CLOVER_API cl_int
clSetKernelArgSVMPointer(cl_kernel d_kern,
cl_uint arg_index,
- const void *arg_value) {
- CLOVER_NOT_SUPPORTED_UNTIL("2.0");
- return CL_INVALID_VALUE;
+ const void *arg_value) try {
+ obj(d_kern).args().at(arg_index).set_svm(arg_value);
+ return CL_SUCCESS;
+
+} catch (std::out_of_range &e) {
+ return CL_INVALID_ARG_INDEX;
+
+} catch (error &e) {
+ return e.get();
}
CLOVER_API cl_int
throw error(CL_INVALID_ARG_SIZE);
buf = pobj<buffer>(value ? *(cl_mem *)value : NULL);
+ svm = nullptr;
+ _set = true;
+}
+
+void
+kernel::global_argument::set_svm(const void *value) {
+ svm = value;
+ buf = nullptr;
_set = true;
}
extend(v, marg.ext_type, marg.target_size);
byteswap(v, ctx.q->device().endianness());
insert(ctx.input, v);
+ } else if (svm) {
+ auto v = bytes(svm);
+ extend(v, marg.ext_type, marg.target_size);
+ byteswap(v, ctx.q->device().endianness());
+ insert(ctx.input, v);
} else {
// Null pointer.
allocate(ctx.input, marg.target_size);
/// Set this argument to some object.
virtual void set(size_t size, const void *value) = 0;
+ /// Set this argument to an SVM pointer.
+ virtual void set_svm(const void *value) {
+ throw error(CL_INVALID_ARG_INDEX);
+ };
+
/// Allocate the necessary resources to bind the specified
/// object to this argument, and update \a ctx accordingly.
virtual void bind(exec_context &ctx,
class global_argument : public argument {
public:
virtual void set(size_t size, const void *value);
+ virtual void set_svm(const void *value);
virtual void bind(exec_context &ctx,
const module::argument &marg);
virtual void unbind(exec_context &ctx);
private:
buffer *buf;
+ const void *svm;
};
class local_argument : public argument {