JNIEXPORT jint JNICALL Java_org_lwjgl_opencl_CL20_nclEnqueueSVMMap(JNIEnv *__env, jclass clazz, jlong command_queueAddress, jint blocking_map, jlong map_flags, jlong svm_ptrAddress, jlong size, jint num_events_in_wait_list, jlong event_wait_listAddress, jlong eventAddress, jlong __functionAddress) { cl_command_queue command_queue = (cl_command_queue)(intptr_t)command_queueAddress; void *svm_ptr = (void *)(intptr_t)svm_ptrAddress; const cl_event *event_wait_list = (const cl_event *)(intptr_t)event_wait_listAddress; cl_event *event = (cl_event *)(intptr_t)eventAddress; clEnqueueSVMMapPROC clEnqueueSVMMap = (clEnqueueSVMMapPROC)(intptr_t)__functionAddress; UNUSED_PARAMS(__env, clazz) return (jint)clEnqueueSVMMap(command_queue, blocking_map, map_flags, svm_ptr, (size_t)size, num_events_in_wait_list, event_wait_list, event); }
/// Enqueues a command to map \p svm_ptr to the host memory space. /// /// \opencl_version_warning{2,0} /// /// \see_opencl2_ref{clEnqueueSVMMap} void enqueue_svm_map(void *svm_ptr, size_t size, cl_map_flags flags, const wait_list &events = wait_list()) { cl_int ret = clEnqueueSVMMap( m_queue, CL_TRUE, flags, svm_ptr, size, events.size(), events.get_event_ptr(), 0 ); if(ret != CL_SUCCESS){ BOOST_THROW_EXCEPTION(opencl_error(ret)); } }
/** * This returns a smart pointer that will be unmapped automatically * upon destruction */ mapped_pointer map(cl_map_flags map_flags = CL_MAP_READ | CL_MAP_WRITE) { cl_int ret = clEnqueueSVMMap(q(), CL_TRUE, map_flags, p, n * sizeof(T), 0, NULL, NULL); if (ret != CL_SUCCESS) throw cl::Error(ret, "clEnqueueSVMUnmap"); return mapped_pointer(p, unmapper(q)); }