OpenCL™规范 3.3内存模型

3.3. Memory Model

3.3内存模型

The OpenCL memory model describes the structure, contents, and behavior of the memory exposed by an OpenCL platform as an OpenCL program runs. The model allows a programmer to reason about values in memory as the host program and multiple kernel-instances execute.

OpenCL内存模型描述了当OpenCL程序运行时,由OpenCL平台公开的内存的结构、内容和行为。该模型允许程序员在主机程序和多个内核实例执行时推理内存中的值。

An OpenCL program defines a context that includes a host, one or more devices, command-queues, and memory exposed within the context. Consider the units of execution involved with such a program. The host program runs as one or more host threads managed by the operating system running on the host (the details of which are defined outside of OpenCL). There may be multiple devices in a single context which all have access to memory objects defined by OpenCL. On a single device, multiple work-groups may execute in parallel with potentially overlapping updates to memory. Finally, within a single work-group, multiple work-items concurrently execute, once again with potentially overlapping updates to memory.

OpenCL程序定义一个上下文,该上下文包括主机、一个或多个设备、命令队列和上下文中公开的内存。考虑这样一个程序所涉及的执行单元。主机程序作为一个或多个主机线程运行,由运行在主机上的操作系统管理(其详细信息在OpenCL之外定义)。在单个上下文中可能存在多个设备,这些设备都可以访问由OpenCL定义的存储器对象。在单个设备上,多个工作组可以并行执行,对内存进行潜在的重叠更新。最后,在一个工作组中,多个工作项同时执行,再次对内存进行潜在的重叠更新。

The memory model must precisely define how the values in memory as seen from each of these units of execution interact so a programmer can reason about the correctness of OpenCL programs. We define the memory model in four parts.

内存模型必须精确地定义从这些执行单元中的每一个单元看到的内存中的值是如何交互的,这样程序员就可以推理OpenCL程序的正确性。我们将内存模型定义为四个部分。

  • Memory regions: The distinct memories visible to the host and the devices that share a context.

  • 内存区域:主机和共享上下文的设备可见的不同内存。

  • Memory objects: The objects defined by the OpenCL API and their management by the host and devices.

  • 内存对象:由OpenCL API定义的对象,以及由主机和设备管理的对象。

  • Shared Virtual Memory: A virtual address space exposed to both the host and the devices within a context. Note: SVM is missing before version 2.0.

  • ​共享虚拟内存:在一个上下文中向主机和设备公开的虚拟地址空间。注意:SVM在2.0版本之前丢失。

  • Consistency Model: Rules that define which values are observed when multiple units of execution load data from memory plus the atomic/fence operations that constrain the order of memory operations and define synchronization relationships.

  • 一致性模型:定义当多个执行单元从内存加载数据时要观察哪些值的规则,以及约束内存操作顺序并定义同步关系的原子/栅栏操作。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值