From patchwork Fri Sep 30 18:39:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 677168 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 3sm0bm3nzPz9ryr for ; Sat, 1 Oct 2016 04:39:47 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=q9wRi6SI; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=KpQQL2QxqTs1tci4fJjgaUYwIX2B0G94S8XlhMi+gAgioz/3Bb HQw7CiTuZs8l15hbM1/wQlC41hp+0s5OoPoXjrs2lxJ2wpUul8f1BOxYrKJerysb EknMvE4dFnE/V8OP3yWN4T691Q2Fj5WMRlprNbrD8L9dvgK7KCTa3HMBU= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Sm5e8x3mUFVaixmkBmT7PEvmN5Q=; b=q9wRi6SIIoqP39MwBw5h E0iQzi0pNHEjRoRGOlPpJedjXBPOCI9yWXMbbNBUQZNeW6FDgTsHWa3QmGwJUdzC T6bru0+y/hTL/6+fKhT/IZDI4H3pnGPp4hzk3djApEWeUgd7iQAcdUwIB7KkAGRW i16Wb4+QoSbLK8MVHqUu058= Received: (qmail 5996 invoked by alias); 30 Sep 2016 18:39:40 -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 5983 invoked by uid 89); 30 Sep 2016 18:39:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=Pick, gomp4, outermost, UD:omp-low.c X-HELO: mail-qt0-f178.google.com Received: from mail-qt0-f178.google.com (HELO mail-qt0-f178.google.com) (209.85.216.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Sep 2016 18:39:29 +0000 Received: by mail-qt0-f178.google.com with SMTP id r60so40680963qtd.3 for ; Fri, 30 Sep 2016 11:39:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version; bh=BOixcVI9F0oFms0+XR5YDIc7AFQiPwtllZEmsOCM9nI=; b=molk+peFfFFR/ym4Li5hzvsv/WtJYF0FXZkgfzAi5oPbG/q92J8C9aSWT3EI1CGISA k/DnzMPb3ccmQTkmDL1QHwYu1ZUFTZD58wGXwLrQhmP2CYbVPOjx2iDgCwjCAKUcVqDO n1mXZHaRCmnAaMZmthJU3sT/2wZuML19Dxy7JM21PucMFxh1Gi3/vbeksI4Gp/FBes8r LwtvmxrGYB61G8D7nx+gKGhII/B0YgF7NJ8RPnxK8fQHVwY+mjD1hyoZXqGRNH67Fz6p Z8HJJCcBkm5sV1bLxGNHi56lrkxqy84dgEHZDuU/y+0U97KiOUSsst/MWh4zvi90uCKQ PdiQ== X-Gm-Message-State: AA6/9RkA1G4Td5I8znFWlv0OxPytxH/KP8/ET/WNVLDrR62eO056MJ3o3kX3WB3dFaWVLw== X-Received: by 10.200.45.72 with SMTP id o8mr3428560qta.93.1475260767344; Fri, 30 Sep 2016 11:39:27 -0700 (PDT) Received: from ?IPv6:2601:181:c003:1930:3fe6:c217:b86a:6e86? ([2601:181:c003:1930:3fe6:c217:b86a:6e86]) by smtp.googlemail.com with ESMTPSA id 2sm9568053qki.28.2016.09.30.11.39.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Sep 2016 11:39:25 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [gomp4] simplify parition allocation logic Message-ID: <0a64c1e5-c028-1f35-75ce-ef9f20ad541e@acm.org> Date: Fri, 30 Sep 2016 14:39:23 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 The code I wrote to determine partitions on auto loops was too complicated, making it hard for me to figure out the changes needed for tiling. I've committed this patch, which doesn't do such egregious bit twiddling. nathan 2016-09-30 Nathan Sidwell * omp-low.c (oacc_loop_auto_partition): Simplify logic. Index: omp-low.c =================================================================== --- omp-low.c (revision 240664) +++ omp-low.c (working copy) @@ -19867,15 +19867,19 @@ oacc_loop_auto_partitions (oacc_loop *lo { /* Allocate outermost and non-innermost loops at the outermost non-innermost available level. */ - unsigned this_mask = outer_mask + 1; + unsigned this_mask = GOMP_DIM_MASK (GOMP_DIM_GANG); + + /* Find the first outermost available partition. */ + while (this_mask <= outer_mask) + this_mask <<= 1; + + /* Prohibit the innermost partitioning at the moment. */ + this_mask &= GOMP_DIM_MASK (GOMP_DIM_MAX - 1) - 1; - /* Make sure it's the single outermost available partition. */ - while (this_mask != (this_mask & -this_mask)) - this_mask += this_mask & -this_mask; - - if (!(this_mask & (loop->inner | GOMP_DIM_MASK (GOMP_DIM_MAX) - | GOMP_DIM_MASK (GOMP_DIM_MAX - 1)))) - loop->mask = this_mask; + /* Don't use any dimension explicitly claimed by an inner loop. */ + this_mask &= ~loop->inner; + + loop->mask = this_mask; } if (loop->child) @@ -19897,15 +19901,13 @@ oacc_loop_auto_partitions (oacc_loop *lo /* Pick the partitioning just inside that one. */ this_mask >>= 1; - /* And avoid picking one use by an outer loop. */ this_mask &= ~outer_mask; - if (!this_mask && !loop->mask && noisy) + loop->mask |= this_mask; + if (!loop->mask && noisy) warning_at (loop->loc, 0, "insufficient partitioning available to parallelize loop"); - - loop->mask |= this_mask; } if (assign && dump_file)