public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Andrew Fish <afish@apple.com>
To: Amit kumar <akamit91@hotmail.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: Accessing AVX/AVX2 instruction in UEFI.
Date: Tue, 02 May 2017 08:12:14 -0700	[thread overview]
Message-ID: <0E40AA0F-3FDD-420D-9982-43FB8E0DE81A@apple.com> (raw)
In-Reply-To: <MWHPR11MB1822E95D7DEB0735B40E52E0DC170@MWHPR11MB1822.namprd11.prod.outlook.com>


> On May 2, 2017, at 6:57 AM, Amit kumar <akamit91@hotmail.com> wrote:
> 
> Hi,
> 
> Am trying to optimize an application using AVX/AVX2, but my code hangs while trying to access YMM registers.
> The instruction where my code hangs is :
> 
> 
>  vmovups ymm0, YMMWORD PTR [rax] 
> 
> 
> I have verified the cpuid in OS and it supports AVX and AVX2 instruction. Processor i7 6th gen.
> Can somebody help me out here ? Is there a way to enable YMM registers ?
> 

Amit,

I think these instructions will generate an illegal instruction fault until you enable AVX. You need to check the Cpu ID bits in your code, then write BIT18 of CR4. After that XGETBV/XSETBV instructions are enabled and you can or in the lower 2 bits of XCR0. This basic operation is in the Intel Docs, it is just hard to find. Usually the OS has done this for the programmer and all the code needs to do is check the CPU ID. 

Thanks,

Andrew Fish

> 
> Thanks And Regards
> Amit Kumar 
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



  reply	other threads:[~2017-05-02 15:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 13:57 Accessing AVX/AVX2 instruction in UEFI Amit kumar
2017-05-02 15:12 ` Andrew Fish [this message]
2017-05-02 17:03   ` Kinney, Michael D
2017-05-03  5:48     ` Amit kumar
2017-05-04 11:13       ` Amit kumar
2017-05-04 11:32         ` Andrew Fish
2017-05-04 12:18           ` Amit kumar
2017-05-04 12:22             ` Amit kumar
2017-05-04 15:20               ` Andrew Fish
2017-05-04 17:26                 ` Kinney, Michael D
2017-05-05 13:08                   ` Amit kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0E40AA0F-3FDD-420D-9982-43FB8E0DE81A@apple.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox