From patchwork Tue Oct 28 16:40:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Brown X-Patchwork-Id: 404294 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B1130140077 for ; Wed, 29 Oct 2014 03:40:50 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=i1vCdH/iEVs2WZaVwjCsKGHRzUgZYFwprO1pKMPCdHU3I1uS4g /HZt9JhnEnwTh8TQdRE/iQbZzgwQRBPTFq10rWfJSp+/DmNKvYJ+7meAEjpVWnAd EY2N/k6CY+As7St3L5xhHL8etqWMYGfWF4nbLhF+ZPGU54+Wh1VCgJ430= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=ZxdtzxkcgUa9wx5FC1nzKSPGDkA=; b=NlQLr7y/RXyYtXJMWM7r 4FJqbbtoPBMdIYLpa36Wy4ubTdBzXc5zF6RRl6E/pVR06eP9tbPr9DFcQt6Xdt+c eTVbe/XCzlbtfl/tvMcolRafAfbFWwIUODG6b5qpr8RjVEbvQO14YpI9p5Oj8HTa i8znGwhSxrCsU2/8aLXRP3w= Received: (qmail 20848 invoked by alias); 28 Oct 2014 16:40:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20837 invoked by uid 89); 28 Oct 2014 16:40:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Oct 2014 16:40:42 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Xj9p0-0007ls-T4 from Julian_Brown@mentor.com ; Tue, 28 Oct 2014 09:40:39 -0700 Received: from octopus (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.181.6; Tue, 28 Oct 2014 16:40:37 +0000 Date: Tue, 28 Oct 2014 16:40:31 +0000 From: Julian Brown To: CC: Thomas Schwinge , Jakub Jelinek Subject: [gomp4] Remove redundant get_caps hook invocations Message-ID: <20141028164031.6d53c732@octopus> MIME-Version: 1.0 X-IsSubscribed: yes Hi, This patch causes the get_caps hook to be called only once during device initialisation, and caches the result in the device's "capabilities" field. OK for gomp4 branch? Thanks, Julian ChangeLog libgomp/ * target.c (gomp_load_plugin_for_device): Only call get_caps once. (gomp_find_available_plugins): ...and don't call it again here. commit 271ee70eec93866e312c7b9363cb0e736b6361d3 Author: Julian Brown Date: Tue Oct 28 07:14:19 2014 -0700 Remove redundant get_caps calls. diff --git a/libgomp/target.c b/libgomp/target.c index 73a186b..615ba6b 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -1036,9 +1036,10 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device, DLSYM (device_free); DLSYM (device_dev2host); DLSYM (device_host2dev); - if (device->get_caps_func () & TARGET_CAP_OPENMP_400) + device->capabilities = device->get_caps_func (); + if (device->capabilities & TARGET_CAP_OPENMP_400) DLSYM (device_run); - if (device->get_caps_func () & TARGET_CAP_OPENACC_200) + if (device->capabilities & TARGET_CAP_OPENACC_200) { optional_present = optional_total = 0; DLSYM_OPT (openacc.exec, openacc_parallel); @@ -1167,7 +1168,6 @@ gomp_find_available_plugins (void) devicep->mem_map.is_initialized = false; devicep->type = devicep->get_type_func (); devicep->name = devicep->get_name_func (); - devicep->capabilities = devicep->get_caps_func (); gomp_mutex_init (&devicep->mem_map.lock); devicep->ord = i; devicep->target_data = NULL;