Here is the code for the spe (enter as spe_distance.c).
下面是spe的代码(请将其输入到spe_distance . c中)。
SPE programs often do at least some of their own data transfer, however.
不过,SPE程序通常必须要有一些自己的数据转换工作。
This is a special tool that converts spe programs into an object file that can be linked into a PPE executable.
这是一个特殊工具,可以将SPE程序转换成一个能被链接进PPE可执行程序的对象文件。
Therefore, to avoid branches I offload as much of the conditional work onto the SPE as possible.
因此,为了避免出现分支,我将尽可能多的有条件工作分载到SPE中。
This command causes the spe to wait until all tags specified in the tag mask have no remaining commands before returning.
这个命令会导致SPE开始等待,直到标签掩码中指定的所有标签都没有剩余命令才能返回。
So, take a look at how a simple program is constructed to perform processing tasks on the SPE.
因此,让我们来了解一下简单程序是如何构造来在SPE上执行处理任务的。
When you want to do unit tests on SPE code or algorithms or get timing information on them, this is probably enough.
当希望对SPE代码或算法进行单元测试或获取有关它们的分时信息时,这可能就足够了。
The simplest usage is to have the SPE program take two Pointers: one for an input buffer and one for an output buffer.
最简单的用法是让SPE程序使用两个指针:一个用于输入缓冲区,另外一个用于输出缓冲区。
The SPE program reads in the input buffer, processes the data, and then writes it to the output buffer.
SPE程序从输入缓冲区中读取数据,然后对数据进行处理,再将结果写入输出缓冲区中。
MFC commands are all done from the perspective of the spe, whether or not it is actually the spe issuing the command.
MF c命令都是从SPE的角度完成的,而不管它实际上是不是SPE发出的命令。
In fact, the code above won't quite work: it gets a bus error when the SPE tries to retrieve its arguments.
实际上,上面的代码并没有多少工作:当SPE试图检索自己的参数时,会得到一个总线错误。
With all that done, though, this is a viable framework for getting data to and from an SPE.
不过,在完成这一切的前提下,这是从SPE中获取数据(或向SPE中写入数据)的一种可行框架。
Each SPE has 256kb of local storage for both instructions and data.
每个SPE对于指令和数据都有256kb的本地存储。
The two transmission steps do not involve the SPU at all, but only the MFC (which is part of the larger SPE).
两个传输步骤根本没有涉及SPU,只涉及MFC(这是比较大的SPE的一部分)。
A DMA request always involves moving data between the SPE local store and a virtual address space on the PPE side.
dma请求通常会涉及数据在SPE本地存储与ppe端虚拟地址空间之间进行移动。
The mailboxes, even for the PPE, are named according to the perspective of the SPE.
邮箱(甚至那些用于PPE的邮箱)都是从 SPE 的角度定义的。
Since the SPE does not have direct access to main memory, you cannot directly dereference this as a pointer.
由于SPE不能直接访问主存,所以无法直接将其作为一个指针废弃。
The most significant difference between the SPE and PPE lies in how they access memory.
SPE与PPE之间最显著的差别在于访问内存的方法。
The SPE API defines a number of opaque data types which are used as arguments to various API functions.
SPEAPI定义了很多不透明的数据类型,它们被用作各个api函数的参数。
Channels are used for all SPE input and output.
信道用于所有的SPE输入和输出。
Next, you define the structure that will be used as the parameter to your SPE program.
接下来,定义结构,该结构将被用作到SPE程序的参数。
After that, control is returned to the SPE.
这之后,控制权再交回给SPE。
And later articles will apply this knowledge to SPE programming in c, to make your life just a little bit easier.
这之后的文章会将这一知识应用到c中的SPE编程,以使编程工作更加轻松。
Just note that writing deeply recursive functions on the SPE is problematic because there is no stack overflow protection on the SPE, and the local store is small to begin with.
请注意在SPE上编写深度递归函数有些问题,原因是在SPE上没有任何堆栈溢出保护,而且本地存储也很小。
That's a pretty big difference because the SPE does not have direct access to main memory.
这的确是一个很大的区别,因为SPE并不直接访问主存。
Upon completion of a set of six threads, the next set of SPE offload threads are begun.
完成一组六个线程之后,开始下一组SPE负载转移线程。
This is a pointer to a structure which holds the data about the SPE program itself.
是持有有关SPE程序本身的数据的结构的指针。
That variable is the handle to the program code, which will be used to create your SPE tasks.
那个变量就是到程序代码的句柄,用来创建SPE任务。
This is a set of bit flags which modify how the SPE is set up.
是一组位标志,用来修改SPE将如何被设置。
This application is really simple, creating 16 SPE threads.
这个应用程序非常简单,它只创建16个spe线程。
应用推荐