<div dir="ltr">We are not seeing this issue at our side, can you please share your machine configuration?<div>Thanks.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 13, 2018 at 10:05 AM, Mateusz <span dir="ltr"><<a href="mailto:mateuszb@poczta.onet.pl" target="_blank">mateuszb@poczta.onet.pl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">W dniu 07.04.2018 o 04:35, <a href="mailto:mythreyi@multicorewareinc.com">mythreyi@multicorewareinc.com</a> pisze:<br>
<div><div class="h5">> # HG changeset patch<br>
> # User Jayashree <<a href="mailto:jayashree.c@multicorewareinc.com">jayashree.c@multicorewareinc.<wbr>com</a>><br>
> # Date 1522928767 -19800<br>
> # Thu Apr 05 17:16:07 2018 +0530<br>
> # Node ID f6ad2fa637fd3c8f9e2811982b89aa<wbr>28228e9f6b<br>
> # Parent 876b6e006f2080072c0684dbf75e7c<wbr>fde974ba79<br>
> x86:AVX512 Set run time flag to enable/disable avx512<br>
><br>
> diff -r 876b6e006f20 -r f6ad2fa637fd source/common/cpu.cpp<br>
> --- a/source/common/cpu.cpp Mon Feb 05 10:39:00 2018 -0800<br>
> +++ b/source/common/cpu.cpp Thu Apr 05 17:16:07 2018 +0530<br>
> @@ -122,7 +122,7 @@<br>
> #pragma warning(disable: 4309) // truncation of constant value<br>
> #endif<br>
> <br>
> -uint32_t cpu_detect(void)<br>
> +uint32_t cpu_detect(bool benableavx512 )<br>
> {<br>
> uint32_t cpu = 0;<br>
> <br>
> @@ -184,11 +184,13 @@<br>
> {<br>
> if (ebx & 0x00000020)<br>
> cpu |= X265_CPU_AVX2;<br>
> -<br>
> - if ((xcr0 & 0xE0) == 0xE0) /* OPMASK/ZMM state */<br>
> + if (benableavx512)<br>
> {<br>
> - if ((ebx & 0xD0030000) == 0xD0030000)<br>
> - cpu |= X265_CPU_AVX512;<br>
> + if ((xcr0 & 0xE0) == 0xE0) /* OPMASK/ZMM state */<br>
> + {<br>
> + if ((ebx & 0xD0030000) == 0xD0030000)<br>
> + cpu |= X265_CPU_AVX512;<br>
> + }<br>
> }<br>
> }<br>
> }<br>
> @@ -327,7 +329,7 @@<br>
> int PFX(cpu_fast_neon_mrc_test)(<wbr>void);<br>
> }<br>
> <br>
> -uint32_t cpu_detect(void)<br>
> +uint32_t cpu_detect(bool benableavx512)<br>
> {<br>
> int flags = 0;<br>
> <br>
> @@ -370,7 +372,7 @@<br>
> <br>
> #elif X265_ARCH_POWER8<br>
> <br>
> -uint32_t cpu_detect(void)<br>
> +uint32_t cpu_detect(bool benableavx512)<br>
> {<br>
> #if HAVE_ALTIVEC<br>
> return X265_CPU_ALTIVEC;<br>
> @@ -381,7 +383,7 @@<br>
> <br>
> #else // if X265_ARCH_POWER8<br>
> <br>
> -uint32_t cpu_detect(void)<br>
> +uint32_t cpu_detect(bool benableavx512)<br>
> {<br>
> return 0;<br>
> }<br>
> diff -r 876b6e006f20 -r f6ad2fa637fd source/common/cpu.h<br>
> --- a/source/common/cpu.h Mon Feb 05 10:39:00 2018 -0800<br>
> +++ b/source/common/cpu.h Thu Apr 05 17:16:07 2018 +0530<br>
> @@ -50,7 +50,7 @@<br>
> #endif<br>
> <br>
> namespace X265_NS {<br>
> -uint32_t cpu_detect(void);<br>
> +uint32_t cpu_detect(bool);<br>
> <br>
> struct cpu_name_t<br>
> {<br>
> diff -r 876b6e006f20 -r f6ad2fa637fd source/common/param.cpp<br>
> --- a/source/common/param.cpp Mon Feb 05 10:39:00 2018 -0800<br>
> +++ b/source/common/param.cpp Thu Apr 05 17:16:07 2018 +0530<br>
> @@ -99,13 +99,13 @@<br>
> {<br>
> x265_free(p);<br>
> }<br>
> -<br>
> +bool benableavx512 = false;<br>
> void x265_param_default(x265_param* param)<br>
> {<br>
> memset(param, 0, sizeof(x265_param));<br>
> <br>
> /* Applying default values to all elements in the param structure */<br>
> - param->cpuid = X265_NS::cpu_detect();<br>
> + param->cpuid = X265_NS::cpu_detect(<wbr>benableavx512);<br>
> param->bEnableWavefront = 1;<br>
> param->frameNumThreads = 0;<br>
> <br>
> @@ -609,6 +609,17 @@<br>
> if (0) ;<br>
> OPT("asm")<br>
> {<br>
> + sscanf(value, "%s", p->asmname);<br>
<br>
</div></div>p->asmname is a pointer to unallocated memory. It is not used in x265.<br>
VS 2015 and VS 2017 builds hangs at command-line:<br>
x265 --asm sse4 -V<br>
<br>
I think we should remove 'asmname' from x265_param<br>
or allocate memory before we copy anything to this location.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
> + if (strcmp(value, "avx512")==0)<br>
> + {<br>
> + p->bEnableavx512 = 1;<br>
> + benableavx512 = true;<br>
> + }<br>
> + else<br>
> + {<br>
> + p->bEnableavx512 = 0;<br>
> + benableavx512 = false;<br>
> + }<br>
> if (bValueWasNull)<br>
> p->cpuid = atobool(value);<br>
> else<br>
> @@ -1072,7 +1083,7 @@<br>
> if (isdigit(value[0]))<br>
> cpu = x265_atoi(value, bError);<br>
> else<br>
> - cpu = !strcmp(value, "auto") || x265_atobool(value, bError) ? X265_NS::cpu_detect() : 0;<br>
> + cpu = !strcmp(value, "auto") || x265_atobool(value, bError) ? X265_NS::cpu_detect(<wbr>benableavx512) : 0;<br>
> <br>
> if (bError)<br>
> {<br>
> diff -r 876b6e006f20 -r f6ad2fa637fd source/test/pixelharness.cpp<br>
> --- a/source/test/pixelharness.cpp Mon Feb 05 10:39:00 2018 -0800<br>
> +++ b/source/test/pixelharness.cpp Thu Apr 05 17:16:07 2018 +0530<br>
> @@ -332,8 +332,9 @@<br>
> memset(ref_dest, 0, 64 * 64 * sizeof(pixel));<br>
> memset(opt_dest, 0, 64 * 64 * sizeof(pixel));<br>
> int j = 0;<br>
> + bool enableavx512 = true;<br>
> int width = 16 * (rand() % 4 + 1);<br>
> - int cpuid = X265_NS::cpu_detect();<br>
> + int cpuid = X265_NS::cpu_detect(<wbr>enableavx512);<br>
> if (cpuid & X265_CPU_AVX512)<br>
> width = 32 * (rand() % 2 + 1);<br>
> int height = 8;<br>
> diff -r 876b6e006f20 -r f6ad2fa637fd source/test/testbench.cpp<br>
> --- a/source/test/testbench.cpp Mon Feb 05 10:39:00 2018 -0800<br>
> +++ b/source/test/testbench.cpp Thu Apr 05 17:16:07 2018 +0530<br>
> @@ -96,7 +96,8 @@<br>
> <br>
> int main(int argc, char *argv[])<br>
> {<br>
> - int cpuid = X265_NS::cpu_detect();<br>
> + bool enableavx512 = true;<br>
> + int cpuid = X265_NS::cpu_detect(<wbr>enableavx512);<br>
> const char *testname = 0;<br>
> <br>
> if (!(argc & 1))<br>
> diff -r 876b6e006f20 -r f6ad2fa637fd source/x265.h<br>
> --- a/source/x265.h Mon Feb 05 10:39:00 2018 -0800<br>
> +++ b/source/x265.h Thu Apr 05 17:16:07 2018 +0530<br>
> @@ -585,7 +585,14 @@<br>
> * somehow flawed on your target hardware. The asm function tables are<br>
> * process global, the first encoder configures them for all encoders */<br>
> int cpuid;<br>
> -<br>
> + /*==Assembly features ==*/<br>
> + /* x265_param_parse() will detect if the avx512 is enabled (in cli )and set <br>
> + * bEnableavx512 to 1 to use avx512 SIMD. By default this flag will not be set , <br>
> + * hence the encoding will happen without avx512 assembly primitives even if the cpu has <br>
> + * avx512 capabilities. <br>
> + * Ensure to use --asm avx512 if you need to encode with avx512 assembly primitives*/<br>
> + int bEnableavx512;<br>
> + char* asmname;<br>
> /*== Parallelism Features ==*/<br>
> <br>
> /* Number of concurrently encoded frames between 1 and X265_MAX_FRAME_THREADS<br>
> ______________________________<wbr>_________________<br>
> x265-devel mailing list<br>
> <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
> <a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br>
______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
</div></div></blockquote></div><br></div>