« メモ:SIMDあれこれ | トップページ | JPOUG in 15 minutes #2 @ Yahoo! Japan 紀尾井町 »

2016年9月24日 (土) / Author : Hiroshi Sekiguchi.

VirtualBoxとSIMD

Previously on Mac De Oracle
SIMDのメモをあれこれ貼り付けただけでしたが、実は今回のことを調べてる次いでに見つけたものだったんですよ。



OracleもSIMDを使う操作が多くなりつつあるようなのでどうなんだろというわけで、今回もメモです。

元ネタは以下のエントリ

VirtualBoxゲストでSIMD命令: DB In-Memory
https://blogs.oracle.com/LetTheSunShineIn/entry/virtualboxゲストでsimd命令_db_in_memory

上記は約2年前の記事で現在のVirtualBoxでは、SSE4.1/SSE4.2は有効化されています。
以下ドキュメントを参照のこと。

9.27. Experimental support for passing through SSE4.1 / SSE4.2 instructions
https://www.virtualbox.org/manual/ch09.html#sse412passthrough


ただ、AVXはどうなのか書かれてはいないのでどうなってんのかな〜とか、ググってたら

Ticket #14427 (new defect)
https://www.virtualbox.org/ticket/14427#comment:3
こんな記事を見つけたのであー有効になってるよねーということで、うちの環境での確認

確認に利用したVirtualBoxは現時点の最新版です。

MacBook:˜ lampeyes$ VBoxManage -version
5.1.6r110634
MacBook:˜ lampeyes$


うちのMacファミリーでは最古参w (そろそろなんとか新しいのにしたいなぁ〜w)
古いCPUだけど、マニュアル通り、SSE4.1/4.2はguestでも有効化されていました。おし!

MacPro:˜ lampeyes$ /usr/sbin/system_profiler SPHardwareDataType | grep -E 'Model|Processor|Core|Cache'
Model Name: Mac Pro
Model Identifier: MacPro5,1
Processor Name: 6-Core Intel Xeon
Processor Speed: 2.4 GHz
Number of Processors: 2
Total Number of Cores: 12
L2 Cache (per Core): 256 KB
L3 Cache (per Processor): 12 MB
Processor Interconnect Speed: 5.86 GT/s
MacPro:˜ lampeyes$
MacPro:˜ lampeyes$ grep -E 'Mnemonic|SSE4|AVX' '/Users/lampeyes/VirtualBox VMs/Linux Group/OralceLinux (Oracle12c R1)/Logs/VBox.log'
00:00:02.472827 Mnemonic - Description = guest (host)
00:00:02.472916 SSE4_1 - SSE4_1 support = 1 (1)
00:00:02.472919 SSE4_2 - SSE4_2 support = 1 (1)
00:00:02.472934 AVX - AVX support = 0 (0)
00:00:02.472942 Mnemonic - Description = guest (host)
00:00:02.472951 AVX2 - Advanced Vector Extensions 2 = 0 (0)
00:00:02.472968 AVX512F - AVX512 Foundation instructions = 0 (0)
00:00:02.472978 AVX512PF - AVX512 Prefetch instructions = 0 (0)
00:00:02.472980 AVX512ER - AVX512 Exponential & Reciprocal instructions = 0 (0)
00:00:02.472981 AVX512CD - AVX512 Conflict Detection instructions = 0 (0)
00:00:02.473041 Mnemonic - Description = guest (host)
00:00:02.473103 SSE4A - SSE4A instructions = 0 (0)
MacPro:˜ lampeyes$

最近のメインマシンw
SSE4.1/4.2に加えてAVXもguestで有効化されていました。
(探したかぎりではドキュメントには見当たらないかった。もしご存知の方がいたら教えてくだい!

ただし、AVX2はguestでは無効化されています。。。。大人の事情でもあるのかとググってますが今の所見つからず。

MacBookAir:˜ lampeyes$ /usr/sbin/system_profiler SPHardwareDataType | grep -E 'Model|Processor|Core|Cache'
Model Name: MacBook Air
Model Identifier: MacBookAir7,2
Processor Name: Intel Core i7
Processor Speed: 2.2 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 4 MB
MacBookAir:˜ lampeyes$ grep -E 'Mnemonic|SSE4|AVX' '/Users/lampeyes/VirtualBox VMs/OracleLinux/Logs/VBox.log'
00:00:02.654824 Mnemonic - Description = guest (host)
00:00:02.654876 SSE4_1 - SSE4_1 support = 1 (1)
00:00:02.654877 SSE4_2 - SSE4_2 support = 1 (1)
00:00:02.654886 AVX - AVX support = 1 (1)
00:00:02.654890 Mnemonic - Description = guest (host)
00:00:02.654894 AVX2 - Advanced Vector Extensions 2 = 0 (1)
00:00:02.654903 AVX512F - AVX512 Foundation instructions = 0 (0)
00:00:02.654909 AVX512PF - AVX512 Prefetch instructions = 0 (0)
00:00:02.654909 AVX512ER - AVX512 Exponential & Reciprocal instructions = 0 (0)
00:00:02.654910 AVX512CD - AVX512 Conflict Detection instructions = 0 (0)
00:00:02.654987 Mnemonic - Description = guest (host)
00:00:02.655021 SSE4A - SSE4A instructions = 0 (0)


AVX2をguestで有効化することは可能なようです。

MacBookAir:˜ lampeyes$ 
MacBookAir:˜ lampeyes$ VBoxManage setextradata "OracleLinux" VBoxInternal/CPUM/IsaExts/AVX2 1

MacBookAir:˜ lampeyes$  grep -E 'Mnemonic|SSE4|AVX' '/Users/lampeyes/VirtualBox VMs/OracleLinux/Logs/VBox.log'
00:00:02.557798 AVX2 = 0x0000000000000001 (1)
00:00:02.815177 Mnemonic - Description = guest (host)
00:00:02.815226 SSE4_1 - SSE4_1 support = 1 (1)
00:00:02.815227 SSE4_2 - SSE4_2 support = 1 (1)
00:00:02.815235 AVX - AVX support = 1 (1)
00:00:02.815248 Mnemonic - Description = guest (host)
00:00:02.815253 AVX2 - Advanced Vector Extensions 2 = 1 (1)
00:00:02.815262 AVX512F - AVX512 Foundation instructions = 0 (0)
00:00:02.815267 AVX512PF - AVX512 Prefetch instructions = 0 (0)
00:00:02.815268 AVX512ER - AVX512 Exponential & Reciprocal instructions = 0 (0)
00:00:02.815269 AVX512CD - AVX512 Conflict Detection instructions = 0 (0)
00:00:02.815348 Mnemonic - Description = guest (host)
00:00:02.815381 SSE4A - SSE4A instructions = 0 (0)
MacBookAir:˜ lampeyes$

最後に Intel Core m5のMacBookですが、こちらは、MacBook Airと同様で、AVX2がguest側で無効化されていて、同様に手順で有効化できました。

何か不都合があったらオフればいいので、このまま使ってみようかと。:)

MacBook:˜ lampeyes$  /usr/sbin/system_profiler SPHardwareDataType | grep -E 'Model|Processor|Core|Cache'
Model Name: MacBook
Model Identifier: MacBook9,1
Processor Name: Intel Core m5
Processor Speed: 1.2 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 4 MB
MacBook:˜ lampeyes$
MacBook:˜ lampeyes$ grep -E 'Mnemonic|SSE4|AVX' '/Users/lampeyes/VirtualBox VMs/DOC-921720/Logs/VBox.log'
00:00:02.791014 Mnemonic - Description = guest (host)
00:00:02.791076 SSE4_1 - SSE4_1 support = 1 (1)
00:00:02.791077 SSE4_2 - SSE4_2 support = 1 (1)
00:00:02.791088 AVX - AVX support = 1 (1)
00:00:02.791093 Mnemonic - Description = guest (host)
00:00:02.791100 AVX2 - Advanced Vector Extensions 2 = 0 (1)
00:00:02.791112 AVX512F - AVX512 Foundation instructions = 0 (0)
00:00:02.791119 AVX512PF - AVX512 Prefetch instructions = 0 (0)
00:00:02.791120 AVX512ER - AVX512 Exponential & Reciprocal instructions = 0 (0)
00:00:02.791121 AVX512CD - AVX512 Conflict Detection instructions = 0 (0)
00:00:02.791227 Mnemonic - Description = guest (host)
00:00:02.791270 SSE4A - SSE4A instructions = 0 (0)
MacBook:˜ lampeyes$
MacBook:˜ lampeyes$ VBoxManage setextradata "DOC-921720" VBoxInternal/CPUM/IsaExts/AVX2 1
MacBook:˜ lampeyes$
MacBook:˜ lampeyes$
MacBook:˜ lampeyes$ grep -E 'Mnemonic|SSE4|AVX' '/Users/lampeyes/VirtualBox VMs/DOC-921720/Logs/VBox.log'
00:00:01.243213 AVX2 = 0x0000000000000001 (1)
00:00:01.405462 Mnemonic - Description = guest (host)
00:00:01.405592 SSE4_1 - SSE4_1 support = 1 (1)
00:00:01.405593 SSE4_2 - SSE4_2 support = 1 (1)
00:00:01.405604 AVX - AVX support = 1 (1)
00:00:01.405610 Mnemonic - Description = guest (host)
00:00:01.405616 AVX2 - Advanced Vector Extensions 2 = 1 (1)
00:00:01.405628 AVX512F - AVX512 Foundation instructions = 0 (0)
00:00:01.405635 AVX512PF - AVX512 Prefetch instructions = 0 (0)
00:00:01.405636 AVX512ER - AVX512 Exponential & Reciprocal instructions = 0 (0)
00:00:01.405637 AVX512CD - AVX512 Conflict Detection instructions = 0 (0)
00:00:01.405758 Mnemonic - Description = guest (host)
00:00:01.405836 SSE4A - SSE4A instructions = 0 (0)
MacBook:˜ lampeyes$



一つ忘れてた、うちで一番古いやつ。(これもそろそろ刷新したいw)
古いのでAVX以降はないですね。Windows 10 Proのリアルマシンなのでコマンドプロンプトからbashで情報取得。う~~ん便利bash w
lampeyes@LAMPEYES:/mnt/c$ cat /proc/cpuinfo | grep -E 'model name|cpu core|siblings' | sort -n | uniq

cpu cores : 6
model name : Intel(R) Core(TM) i7 CPU X 980 @ 3.33GHz
siblings : 12
lampeyes@LAMPEYES:/mnt/c$
lampeyes@LAMPEYES:/mnt/c$ grep -E 'Mnemonic|SSE4|AVX' '/mnt/c/Users/lampeyes/VirtualBox VMs/CentOS6.5 64bit/Logs/VBox.log'
00:00:04.805674 Mnemonic - Description = guest (host)
00:00:04.805719 SSE4_1 - SSE4_1 support = 1 (1)
00:00:04.805720 SSE4_2 - SSE4_2 support = 1 (1)
00:00:04.805728 AVX - AVX support = 0 (0)
00:00:04.805732 Mnemonic - Description = guest (host)
00:00:04.805756 AVX2 - Advanced Vector Extensions 2 = 0 (0)
00:00:04.805765 AVX512F - AVX512 Foundation instructions = 0 (0)
00:00:04.805770 AVX512PF - AVX512 Prefetch instructions = 0 (0)
00:00:04.805771 AVX512ER - AVX512 Exponential & Reciprocal instructions = 0 (0)
00:00:04.805772 AVX512CD - AVX512 Conflict Detection instructions = 0 (0)
00:00:04.805811 Mnemonic - Description = guest (host)
00:00:04.805842 SSE4A - SSE4A instructions = 0 (0)
lampeyes@LAMPEYES:/mnt/c$

| |

トラックバック


この記事へのトラックバック一覧です: VirtualBoxとSIMD:

コメント

コメントを書く