“非时间"是什么意思?x86 中的内存访问 [英] What is the meaning of "non temporal" memory accesses in x86

查看:25
本文介绍了“非时间"是什么意思?x86 中的内存访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个有点低级的问题.在 x86 汇编中有两条 SSE 指令:

This is a somewhat low-level question. In x86 assembly there are two SSE instructions:

MOVDQA xmmi, m128

MOVNTDQA xmmi, m128

IA-32 软件开发人员手册说 MOVNTDQA 中的 NT 代表 Non-Temporal,否则与 MOVDQA 相同.

The IA-32 Software Developer's Manual says that the NT in MOVNTDQA stands for Non-Temporal, and that otherwise it's the same as MOVDQA.

我的问题是,非时间是什么意思?

My question is, what does Non-Temporal mean?

推荐答案

Non-Temporal SSE 指令(MOVNTI、MOVNTQ 等),不遵循正常的缓存一致性规则.因此,非临时存储后必须跟有 SFENCE 指令,以便其他处理器及时看到它们的结果.

Non-Temporal SSE instructions (MOVNTI, MOVNTQ, etc.), don't follow the normal cache-coherency rules. Therefore non-temporal stores must be followed by an SFENCE instruction in order for their results to be seen by other processors in a timely fashion.

当数据被产生而不(立即)再次被消耗时,内存存储操作首先读取一个完整的缓存行然后修改缓存的数据这一事实对性能是有害的.此操作将可能再次需要的数据从缓存中推出,以支持不会很快使用的数据.对于大型数据结构尤其如此,例如矩阵,它们会被填充然后使用.在填充矩阵的最后一个元素之前,庞大的大小会驱逐第一个元素,从而使写入的缓存无效.

When data is produced and not (immediately) consumed again, the fact that memory store operations read a full cache line first and then modify the cached data is detrimental to performance. This operation pushes data out of the caches which might be needed again in favor of data which will not be used soon. This is especially true for large data structures, like matrices, which are filled and then used later. Before the last element of the matrix is filled the sheer size evicts the first elements, making caching of the writes ineffective.

对于这种情况和类似情况,处理器提供对非临时写入操作的支持.在这种情况下,非临时意味着数据不会很快被重用,所以没有理由缓存它.这些非临时写入操作不会读取缓存行然后对其进行修改;相反,新内容直接写入内存.

For this and similar situations, processors provide support for non-temporal write operations. Non-temporal in this context means the data will not be reused soon, so there is no reason to cache it. These non-temporal write operations do not read a cache line and then modify it; instead, the new content is directly written to memory.

来源:http://lwn.net/Articles/255364/

这篇关于“非时间"是什么意思?x86 中的内存访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆