Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   AVX2 Support auslesen? (https://www.delphipraxis.net/184393-avx2-support-auslesen.html)

milos 23. Mär 2015 07:57

AVX2 Support auslesen?
 
Hallo,
ich habe mir eine Funktion aus dem Internet geholt die mir den Support für AVX ausliest.

Delphi-Quellcode:
function TForm1.FisAvxSupported: Boolean;
asm
{$IFDEF CPUX86}
    push ebx
{$ENDIF}
{$IFDEF CPUX64}
    mov r10, rbx
{$ENDIF}
    xor eax, eax
    cpuid
    cmp eax, 1
    jb @not_supported
    mov eax, 1
    cpuid
    and ecx, 018000000h
    cmp ecx, 018000000h
    jne @not_supported
    xor ecx, ecx
    db 0Fh, 01h, 0D0h //XGETBV
    and eax, 110b
    cmp eax, 110b
    jne @not_supported
    mov eax, 1
    jmp @done
@not_supported:
    xor eax, eax
@done:
{$IFDEF CPUX86}
    pop ebx
{$ENDIF}
{$IFDEF CPUX64}
    mov rbx, r10
{$ENDIF}
end;
Leider kann ich kein ASM und verstehe deshalb auch nicht was er da genau macht. Gibt es eine ähnliche Funktion wie diese für AVX2?

Freundliche Grüsse

himitsu 23. Mär 2015 08:56

AW: AVX2 Support auslesen?
 
Der Befehl CPUID liest von der CPU die ID-Werte aus und schreibt sie in EAX bis EDX.
Und dann wird erst geprüft, ob bestimmte Werte/Bits ($018000000) in ECX gesetzt, wenn ja, dann wird auch noch der Befehl XGETBV ausgeführt und dessen ergebnis geprüft.

http://en.wikipedia.org/wiki/CPUID
http://www.sandpile.org/x86/cpuid.htm
http://www.felixcloutier.com/x86/XGETBV.html

Union 23. Mär 2015 11:18

AW: AVX2 Support auslesen?
 
Was willst Du denn damit erreichen? Da die neuen Mnemonics von dem Delphi asm nicht unterstützt werden, müsstest Du das ja binär codieren. Die Beschreibung welche Bits Du prüfen musst, findest Du bei Intel.


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:29 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz