OpenCL™规范 5.5.4. 访问内存对象的映射区域

5.5.4. Accessing Mapped Regions of a Memory Object
5.5.4. 访问内存对象的映射区域

This section describes the behavior of OpenCL commands that access mapped regions of a memory object.

本节描述访问内存对象的映射区域的OpenCL命令的行为。

The contents of the region of a memory object and associated memory objects (sub-buffer objects or 1D image buffer objects that overlap this region) mapped for writing (i.e. CL_MAP_WRITE or CL_MAP_WRITE_INVALIDATE_REGION is set in map_flags argument to clEnqueueMapBuffer, or clEnqueueMapImage) are considered to be undefined until this region is unmapped.

​被映射用于写入的存储器对象的区域和相关联的存储器对象(子缓冲区对象或与该区域重叠的1D图像缓冲区对象)的内容(即CL_MAP_WRITE或CL_MAP_WRITE_INVALIDATE_REGION在map_flags参数中被设置为clEnqueueMapBuffer或clEnqueueMap image)被认为是未定义的,直到该区域被取消映射为止。

Multiple commands in command-queues can map a region or overlapping regions of a memory object and associated memory objects (sub-buffer objects or 1D image buffer objects that overlap this region) for reading (i.e. map_flags = CL_MAP_READ). The contents of the regions of a memory object mapped for reading can also be read by kernels and other OpenCL commands (such as clEnqueueCopyBuffer) executing on a device(s).

​命令队列中的多个命令可以映射存储器对象和相关联的存储器对象(与该区域重叠的子缓冲器对象或1D图像缓冲器对象)的一个或多个重叠区域以供读取(即,map_flags=CL_MAP_READ)。映射用于读取的存储器对象的区域的内容也可以由内核和在设备上执行的其他OpenCL命令(例如clEnqueueCopyBuffer)读取。

Mapping (and unmapping) overlapped regions in a memory object and/or associated memory objects (sub-buffer objects or 1D image buffer objects that overlap this region) for writing is an error and will result in CL_INVALID_OPERATION error returned by clEnqueueMapBuffer, or clEnqueueMapImage.

​映射(和取消映射)存储器对象或相关联的存储器对象(与该区域重叠的子缓冲区对象或1D图像缓冲区对象)中的重叠区域以进行写入是一个错误,并且将导致clEnqueueMapBuffer或clEnqueueMap image返回CL_INVALID_OPERATION错误。

If a memory object is currently mapped for writing, the application must ensure that the memory object is unmapped before any enqueued kernels or commands that read from or write to this memory object or any of its associated memory objects (sub-buffer or 1D image buffer objects) or its parent object (if the memory object is a sub-buffer or 1D image buffer object) begin execution; otherwise the behavior is undefined.

如果存储器对象当前被映射用于写入,则应用程序必须确保在从该存储器对象或其任何相关联的存储器对象(子缓冲器或1D图像缓冲器对象)或其父对象(如果存储器对象是子缓冲器或一维图像缓冲器对象)读取或写入的任何排队内核或命令开始执行之前,该存储器对象未被映射;否则行为是未定义的。

If a memory object is currently mapped for reading, the application must ensure that the memory object is unmapped before any enqueued kernels or commands that write to this memory object or any of its associated memory objects (sub-buffer or 1D image buffer objects) or its parent object (if the memory object is a sub-buffer or 1D image buffer object) begin execution; otherwise the behavior is undefined.

如果存储器对象当前被映射用于读取,则应用程序必须确保在写入该存储器对象或其任何相关联的存储器对象(子缓冲器或1D图像缓冲器对象)或其父对象(如果存储器对象是子缓冲器或一维图像缓冲区对象)的任何排队内核或命令开始执行之前,该存储器对象未被映射;否则行为是未定义的。

A memory object is considered as mapped if there are one or more active mappings for the memory object irrespective of whether the mapped regions span the entire memory object.

如果内存对象存在一个或多个活动映射,则无论映射的区域是否跨越整个内存对象,都将该内存对象视为已映射。

Accessing the contents of the memory region referred to by the mapped pointer that has been unmapped is undefined.

访问未映射的映射指针所引用的内存区域的内容是未定义的。

The mapped pointer returned by clEnqueueMapBuffer or clEnqueueMapImage can be used as the ptr argument value to clEnqueueReadBufferclEnqueueWriteBufferclEnqueueReadBufferRectclEnqueueWriteBufferRectclEnqueueReadImage, or clEnqueueWriteImage provided the rules described above are adhered to.

​clEnqueueMapBuffer或clEnqueueMappingImage返回的映射指针可以用作clEnqueueReadBuffer、clEnqueueWriteBuffer、clEnqueueReadBufferRect、clEnQueue WriteBufferRect、clEnQueueReadImage或clEnQueueWriteImage的ptr参数值,前提是遵守上述规则。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值