[x265] [PATCH] fix invalid Instruction Set provided in CLI if CPU doesn't support it

Deepthi Nandakumar deepthi at multicorewareinc.com
Tue Nov 3 06:06:13 CET 2015


Since the idea here is to correctly log a user-generated error (user-cpuid
> detected cpuid), the patch is headed in the right direction.

Min's suggestion on using an AND mask sounds good, and can you also make
the warning more informative (print user-cpuid, and the cpuid we're
defaulting to) ?

On Thu, Oct 29, 2015 at 11:16 PM, Steve Borho <steve at borho.org> wrote:

> On 10/28, dnyaneshwar at multicorewareinc.com wrote:
> > # HG changeset patch
> > # User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
> > # Date 1446021877 -19800
> > #      Wed Oct 28 14:14:37 2015 +0530
> > # Node ID 975087370d14e90cd63edecb34fb4bf2feda2468
> > # Parent  6563218ce342c30bfd4f9bc172a1dab510e6e55b
> > fix invalid Instruction Set provided in CLI if CPU doesn't support it
> >
> > This patch avoids crash/invalid instructions when we provide instruction
> sets to
> > be used are higher than the cpu capabilities.
> >
> > For example, if our cpu supports instruction sets upto AVX and we provide
> > --asm "avx2" (AVX2 is higher than AVX) then it will show warning and use
> default
> > x265 detected intruction sets.
>
> The whole point of having this override is in case our CPU detection is
> somehow wrong. The user needs to be able to override the detection mask.
>
> That said.. if the user provided mask has bits set that were not
> detected, it's ok to log a serious warning that says you think the
> encoder is about to break and it is the user's fault.
>
> BTW: this feature is often used for benchmarking, to disable certain
> optimizations piecemeal, but that is not the primary reason why it
> exists.
>
> > diff -r 6563218ce342 -r 975087370d14 source/common/primitives.cpp
> > --- a/source/common/primitives.cpp    Mon Oct 26 12:13:53 2015 +0530
> > +++ b/source/common/primitives.cpp    Wed Oct 28 14:14:37 2015 +0530
> > @@ -238,6 +238,15 @@
> >              primitives.cu[i].intra_pred_allangs = NULL;
> >
> >  #if ENABLE_ASSEMBLY
> > +
> > +        if ((uint32_t)param->cpuid > X265_NS::cpu_detect())
> > +        {
> > +            if (param->logLevel >= X265_LOG_INFO)
> > +                x265_log(param, X265_LOG_WARNING, "Unsupported CPUID
> provided in CLI, so choosing x265 detected CPUID!\n");
> > +
> > +            param->cpuid = X265_NS::cpu_detect();
> > +        }
> > +
> >          setupInstrinsicPrimitives(primitives, param->cpuid);
> >          setupAssemblyPrimitives(primitives, param->cpuid);
> >  #endif
> > _______________________________________________
> > x265-devel mailing list
> > x265-devel at videolan.org
> > https://mailman.videolan.org/listinfo/x265-devel
>
> --
> Steve Borho
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>



-- 
Deepthi Nandakumar
Engineering Manager, x265
Multicoreware, Inc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20151103/27f513f9/attachment.html>


More information about the x265-devel mailing list