英特尔和AMD如何区别但仍兼容? [英] How can Intel and AMD be different but still compatible?

查看:378
本文介绍了英特尔和AMD如何区别但仍兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我一直了解的那样,AMD通过对Intel的指令集进行逆向工程来构建CPU,现在向Intel支付使用他们的指令集的费用,而Intel对AMD的64位指令也这样做.

这是在不需要购买特定版本(例如为ARM编译的版本)的情况下在两种类型的CPU上安装Windows的方式,因此所有应用程序,游戏等都以相同的方式工作,并且可以在CPU上互换使用.

但是最近有些事情使我对此有些疑问...

首先,我注意到某些游戏在我的系统(AMD)上有些滞后,阅读后发现该游戏针对Intel CPU进行了优化...

此外,OSX在Intel CPU上出售,但是在发现hackintosh社区后,事实证明有可能但非常难以使OSX在AMD上运行.这是因为OSX还是专为Intel设计的.

在这些事情之后.

针对Intel或AMD进行优化意味着什么?如果它们打算彼此替代,那么如何才能针对另一个而不是另一个进行优化/优化呢?也就是说,它们都支持相同的指令,等等.

解决方案

它们实现了同一ISA ,但具有不同的性能特征,因为 micro architecture 是不同.

例如有关详细信息,请参见 Agner Fog的microarch pdf ,以及标签Wiki.例如 David Kanter的Haswell微体系结构文章在可能的情况下进行一些移位/添加.在Intel上,仅当您可以按一班或两班制/lea指令完成工作时,才值得.

AMD的设计还具有明显较弱的缓存层次结构,并且由于使用了永久拆分的成对内核,而不是Intel的超线程在同一内核上的两个硬件线程之间动态共享资源,因此单线程吞吐量也较低. IIRC和AMD计划针对其下一个微体系结构进行更改.其中有些是您无法真正优化"的东西,只是AMD速度较慢. :(


所以他们运行相同的代码,因为这意味着要具有相同的体系结构.

某些CPU支持另一个不支持的ISA扩展(新指令).例如XOP仅限AMD,而AVX2和BMI2到目前为止(仅限Intel),因此,要使用比通用基准更多的代码,必须在运行时检查支持.

Wikipedia的 AMD挖掘机的文章不是很新.硬件已经有一段时间了,但是文章仍然说它有望"拥有AVX2和BMI2. Agner Fog尚未测试它,也没有更新他的说明表.

As I have always understood it, AMD built their CPUs by reverse engineering Intel's instruction set and now pay Intel to use their instruction set, and Intel do the same for AMDs 64-bit instructions.

This is how windows can be installed on both types of CPUs without needing to purchase a specific build, such as a version compiled for ARM, and so all apps, games etc work in the same way, working interchangeable on CPUs...

However lately some things have been making me question some of this...

Firstly, I've noticed some games have been a bit laggy on my system (AMD) and after reading it turns out the game is optimised for Intel CPUs...

Also, OSX is sold on Intel CPUs but after discovering the hackintosh community it turns out it is possible but very hard to get OSX to run on AMD. This is because again OSX is designed for Intel...

After these things..

What does it mean to be optimised for Intel or AMD? How can it be possible to be different / optimised for one but not the other, if they are meant to be slot in replacements for each other? I.e both support same instructions etc.

解决方案

They implement the same ISA, but with different performance characteristics because the microarchitecture is different.

e.g. see Agner Fog's microarch pdf for details, and other links from the tag wiki. e.g. David Kanter's Haswell microarchitecture writeup vs. his writeup of AMD Bulldozer.

Agner Fog's instruction tables also show you exactly how fast each instruction is on each CPU. e.g. imul r64, r64/m32, imm32 is 6 cycle latency / one per 4c throughput on AMD Bulldozer-family. On Intel SnB-family, it's 3c latency with one per 1c throughput.

So when tuning for AMD, it would be worth replacing a 64bit multiply by a constant with a couple shifts / adds if possible. On Intel, it's maybe only worth it if you can get the job done in one or 2 shift / lea instructions.

AMD's designs also have a notably weaker cache hierarchy, and lower single-threaded throughput due to using pairs of cores that are permanently split instead of Intel's Hyperthreading dynamic sharing of resources between two hardware threads on the same core. IIRC, AMD is planning to change that for their next microarchitecture. Some of this is stuff you can't really "optimize for", it's just AMD being slower. :(


So they run the same code, because that's what it means to be the same architecture.

Some CPUs support ISA extensions (new instructions) that the other doesn't. e.g. XOP is AMD-only, while AVX2 and BMI2 are (so far) Intel-only, so code that wants to use more than a common baseline has to check for support at runtime.

Wikipedia's AMD Excavator article is not very up to date. Hardware has been out for a while now, but the article still says it's "expected to have" AVX2 and BMI2. Agner Fog hasn't tested it and updated his instruction tables yet, either.

这篇关于英特尔和AMD如何区别但仍兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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