带有 Intel Core i7 的 AVX 上的非法指令 [英] Illegal instruction on AVX with Intel Core i7

查看:22
本文介绍了带有 Intel Core i7 的 AVX 上的非法指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Windows x64 C++ 程序,它是由 MSVC 12 编译的,没有 AVX 支持(编译选项中没有/arch:AVX).

I have a Windows x64 C++ program which is compiled by MSVC 12 without AVX support (no /arch:AVX in compile options).

我收到了一位在 Win7 上使用 Core i7 4700MQ 的客户的崩溃报告.异常代码为 c000001d(非法指令),异常偏移指向 sin() 函数内部的vmovd r9,xmm0"指令.我已经用这个用户尝试了两种不同的构建,在这两种情况下,它都指向相同的指令.

And I have a crash report from one customer with Core i7 4700MQ on Win7. Exception code is c000001d (illegal instruction), and exception offset points to "vmovd r9,xmm0" instruction inside sin() function. I've tried two different builds with this user and in both cases it points to this same instruction.

看起来像 msvc 库版本的 sin() 内在函数具有特殊的 AVX 代码路径,即使在没有 AVX 支持的情况下进行编译.这段代码在没有 AVX 的旧 i3 处理器上运行良好.

Looks like msvc library version of sin() intrinsic have special AVX code path even if compiled without AVX support. And this code works fine on older i3 processors which didn't have AVX.

那么是什么导致了这个特定 i7 上的这个异常呢?对于使用广泛 CPU 的许多客户来说,相同的代码运行没有任何问题.

So what can cause this exception on this particular i7? Same code is running without any problems for many customers with wide rage of CPUs.

也许可以在操作系统设置/BIOS 中以某种方式禁用 AVX,而 sin() 代码无法检查这一点?或者也许有一些操作系统更新增加了 AVX 支持,没有它任何 AVX 代码会触发 c000001d?

Maybe AVX can be somehow disabled in OS settings/BIOS and sin() code fails to check this? Or maybe there was some OS update which added AVX support and without it any AVX code triggers c000001d?

推荐答案

如果那是动态链接库中的代码,那么代码的编译选项无关紧要.dll 很可能会根据 cpuid 的返回值分派到不同的实现,以确定 avx 是否可用,如果不可用,则回退到 sse 版本.

If that's code in a dynamically linked library then the compile options for your code don't matter much. The dll could well be doing dispatch to different implementations based on the return value of cpuid to determine if avx is available and falling back to an sse version if not.

vmovd r9,xmm0

vmovd r9,xmm0

对我来说看起来像是关于 corei7 的法律说明.

looks like a legal instruction on a corei7 to me.

http://www.felixcloutier.com/x86/MOVD:MOVQ.html

这篇关于带有 Intel Core i7 的 AVX 上的非法指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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