[Intel-gfx] [PATCH 06/13] drm/i915: Use binary search when looking up forcewake domains
Chris Wilson
chris at chris-wilson.co.uk
Fri Sep 30 11:22:11 UTC 2016
On Fri, Sep 30, 2016 at 12:08:26PM +0100, Tvrtko Ursulin wrote:
>
> On 29/09/2016 17:16, Chris Wilson wrote:
> >On Thu, Sep 29, 2016 at 04:35:49PM +0100, Tvrtko Ursulin wrote:
> >>+ entry = bsearch((void *)(unsigned long)offset, (const void *)ranges,
> >>+ num_ranges, sizeof(struct intel_forcewake_range),
> >>+ fw_range_cmp);
> >How much for bsearch() to be turned into a generator macro?
>
> By default it is a small code size win (128 bytes). It makes
> find_fw_domain a function with an inlined comparator (so one
> function call less per search iteration than using library bsearch)
> and inlines is_gen8_shadowed completely.
>
> Forcing find_fw_domain to be fully inline adds approximately 1k.
>
> I am not sure - you think it is worth doing some of the above?
> Function calls are supposed to be cheap so perhaps just with the
> default inlining, but then it is either pushing the core patch or
> having a local copy of a macro.
But I wonder if we get better branch predictor from inlining.
Happy enough with the default inlining, whilst we are in the noise
compared to the actual fw and mmio, we might as well try to keep the irq
paths trim at least.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list