[Beignet] [PATCH] Pad instruction stream with 8 nops;

Zou, Nanhai nanhai.zou at intel.com
Wed Jun 5 19:07:56 PDT 2013


No performance impact.
The program will end at the EOT bit. The next 8 instructions will be prefetched but not executed.


-----Original Message-----
From: beignet-bounces+nanhai.zou=intel.com at lists.freedesktop.org [mailto:beignet-bounces+nanhai.zou=intel.com at lists.freedesktop.org] On Behalf Of Zhigang Gong
Sent: Wednesday, June 05, 2013 5:01 PM
To: Zou, Nanhai
Cc: beignet at lists.freedesktop.org
Subject: Re: [Beignet] [PATCH] Pad instruction stream with 8 nops;

In general, this patch looks good to me. The only thing I'm not sure is that whether this brings any performance side effect. It will add 8 nops after the EOT send message as below. Will those 8 nop instructions be executed or they will be ignored?

send(8)         null            g0<8,8,1>UD
                thread_spawnerunsupported target 7 mlen 1 rlen 0 { align1 WE_normal 1Q EOT };
nop                                                             ;
nop                                                             ;
nop                                                             ;
nop                                                             ;
nop                                                             ;
nop                                                             ;
nop                                                             ;
nop                                                             ;

On Wed, Jun 05, 2013 at 09:09:57AM +0800, Zou Nan hai wrote:
>    According to Bspec, EU may access 8 instrunctions beyond the
>    kernel program because of prefetch.
>    Pad the instruction stream with 8 nop to avoid access into an
>    invalide page.
> 
>    Signed-off-by: Zou Nanhai <nanhai.zou at intel.com>
> ---
>  backend/src/backend/gen_context.cpp |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/backend/src/backend/gen_context.cpp 
> b/backend/src/backend/gen_context.cpp
> index 18f6c11..b9c0392 100644
> --- a/backend/src/backend/gen_context.cpp
> +++ b/backend/src/backend/gen_context.cpp
> @@ -72,6 +72,10 @@ namespace gbe
>        }
>        p->pop();
>      }
> +    /* per spec, pad the instruction stream with 8 nop to avoid 
> +	instruction prefetcher prefetch into an invalide page */
> +    for(int i = 0; i < 8; i++)
> +	p->NOP();
>    }
>  
>    void GenContext::patchBranches(void) {
> --
> 1.7.9.5
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list