From: Daniel Vetter Subject: Re: [PATCH] drm/i915: Use hash tables for the command parser Date: Mon, 12 May 2014 18:49:24 +0200 Message-ID: <20140512164924.GQ25056@phenom.ffwll.local> References: <1399756243-30974-1-git-send-email-bradley.d.volkin@intel.com> <5370DF5E.5020808@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by gabe.freedesktop.org (Postfix) with ESMTP id BBF886E72F for ; Mon, 12 May 2014 09:49:28 -0700 (PDT) Received: by mail-ee0-f51.google.com with SMTP id e51so4883976eek.24 for ; Mon, 12 May 2014 09:49:27 -0700 (PDT) Content-Disposition: inline In-Reply-To: <5370DF5E.5020808@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Tvrtko Ursulin Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Mon, May 12, 2014 at 03:49:02PM +0100, Tvrtko Ursulin wrote: > > On 05/10/2014 10:10 PM, bradley.d.volkin@intel.com wrote: > >From: Brad Volkin > > > >For clients that submit large batch buffers the command parser has > >a substantial impact on performance. On my HSW ULT system performance > >drops as much as ~20% on some tests. Most of the time is spent in the > >command lookup code. Converting that from the current naive search to > >a hash table lookup reduces the performance drop to ~10%. > > > >The choice of value for I915_CMD_HASH_ORDER allows all commands > >currently used in the parser tables to hash to their own bucket (except > >for one collision on the render ring). The tradeoff is that it wastes > >memory. Because the opcodes for the commands in the tables are not > >particularly well distributed, reducing the order still leaves many > >buckets empty. The increased collisions don't seem to have a huge > >impact on the performance gain, but for now anyhow, the parser trades > >memory for performance. > > > >NB: Ville noticed that the error paths through the ring init code > >will leak memory. I've not addressed that here. We can do a follow > >up pass to handle all of the leaks. > > > >v2: improved comment describing selection of hash key mask (Damien) > >replace a BUG_ON() with an error return (Tvrtko, Ville) > >commit message improvements > > > >Signed-off-by: Brad Volkin > > Reviewed-by: Tvrtko Ursulin Nice. Queued for -next, thanks for the patch. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch