From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id D3F213860758 for ; Fri, 30 Jun 2023 11:11:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3F213860758 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2b6a675743dso26182331fa.2 for ; Fri, 30 Jun 2023 04:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688123482; x=1690715482; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=36LzM8labIebj7ywZforsn45Zjh4Cc3oHXYhxBcWDU4=; b=S+LrbLYFgPESoVlppftzf44u6fuTLxD3rImNp8QhXZvvLtRbIWyYgr3hYeclDwLaQ2 VQ7kdJN9P6csad3nA++WyDm6vLAmPu+6+Av3fYMK79ddnecTqWAdkiYsJHrejIQG7zDS GPeq4bVNmmUZgGlrzCXq9oXgrI2nMFQqIUcKz0YNU2xFPq3YUIkucvKlc9gfOPL3O0CJ qXYkrlBIsnoXP32gF3FzVEm3GmBiditEKUbX9GijFk9HxWRtOa/Zn76GCtHDsrsTlIF7 jvmAm1GYl/WnFyd/WQlBW2Iq78z9YAlvHx4jDS12Jty7JKwlYBH08oc+0GLfqWXF9S1P 5a5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688123482; x=1690715482; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=36LzM8labIebj7ywZforsn45Zjh4Cc3oHXYhxBcWDU4=; b=M4jL2pZ3B3VlPgjcNwIM1O4GED3LQJwAtsp991Td7fGLF/gh4BJW0LSfmg2/TJmeST Ab6Siv61qY5G46HmbESvOpdbUtnWgNl1mjTIY2NCfIV+K2JWZbifUyJfzpMLPrpSdFQk CNEYeqOcw7V3FVXBSbe8aoOXLpB0gKtPQTuGh5LoTdiPvIle9S5TfbW8fIN8lr2mj7Wt NFQv2YZbzsWsEsmWSZVGhjlIH0PFp7/y4YC8os8ssa5UIAoY3iSlTeQNm/AT8znN8MEF PMlOOwitgLdtAWcb5l1n7WRPJQMlmxK1PFi8PKKFb+wmHuwzmCmGrXh98n6aLzP/pzjp iStg== X-Gm-Message-State: ABy/qLYft0ox7K5h2tESUwv3tCnnNWZ2z1uorvP5ZQ+MsDuYLaw7MugA 5Vb6/nqtGN30VfDMINJFnL8pj2vbx10eQ8Ktukg= X-Google-Smtp-Source: APBJJlFbu1OcQLZfSX30FeaWhBPNQ6GP26PIWj0je9SsDf4sFbwQahpe6YVqR5UgIPnARY/5rPk6JeFncG8j7+puTII= X-Received: by 2002:a2e:3508:0:b0:2b6:cdfb:fe36 with SMTP id z8-20020a2e3508000000b002b6cdfbfe36mr2154960ljz.39.1688123482093; Fri, 30 Jun 2023 04:11:22 -0700 (PDT) MIME-Version: 1.0 References: <9bad792a4bcef35fbd9906245bf3493672b340fe.1686573640.git.linkw@linux.ibm.com> In-Reply-To: <9bad792a4bcef35fbd9906245bf3493672b340fe.1686573640.git.linkw@linux.ibm.com> From: Richard Biener Date: Fri, 30 Jun 2023 13:11:09 +0200 Message-ID: Subject: Re: [PATCH 2/9] vect: Adjust vectorizable_load costing on VMAT_GATHER_SCATTER && gs_info.decl To: Kewen Lin Cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com, segher@kernel.crashing.org, bergner@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Jun 13, 2023 at 4:03=E2=80=AFAM Kewen Lin wro= te: > > This patch adds one extra argument cost_vec to function > vect_build_gather_load_calls, so that we can do costing > next to the tranform in vect_build_gather_load_calls. > For now, the implementation just follows the handlings in > vect_model_load_cost, it isn't so good, so placing one > FIXME for any further improvement. This patch should not > cause any functional changes. > > gcc/ChangeLog: > > * tree-vect-stmts.cc (vect_build_gather_load_calls): Add the hand= lings > on costing with one extra argument cost_vec. > (vectorizable_load): Adjust the call to vect_build_gather_load_ca= lls. > (vect_model_load_cost): Assert it won't get VMAT_GATHER_SCATTER w= ith > gs_info.decl set any more. > --- > gcc/tree-vect-stmts.cc | 31 +++++++++++++++++++++++-------- > 1 file changed, 23 insertions(+), 8 deletions(-) > > diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc > index 44514658be3..744cdf40e26 100644 > --- a/gcc/tree-vect-stmts.cc > +++ b/gcc/tree-vect-stmts.cc > @@ -1135,6 +1135,8 @@ vect_model_load_cost (vec_info *vinfo, > slp_tree slp_node, > stmt_vector_for_cost *cost_vec) > { > + gcc_assert (memory_access_type !=3D VMAT_GATHER_SCATTER || !gs_info->d= ecl); > + > unsigned int inside_cost =3D 0, prologue_cost =3D 0; > bool grouped_access_p =3D STMT_VINFO_GROUPED_ACCESS (stmt_info); > > @@ -2819,7 +2821,8 @@ vect_build_gather_load_calls (vec_info *vinfo, stmt= _vec_info stmt_info, > gimple_stmt_iterator *gsi, > gimple **vec_stmt, > gather_scatter_info *gs_info, > - tree mask) > + tree mask, > + stmt_vector_for_cost *cost_vec) > { > loop_vec_info loop_vinfo =3D dyn_cast (vinfo); > class loop *loop =3D LOOP_VINFO_LOOP (loop_vinfo); > @@ -2831,6 +2834,23 @@ vect_build_gather_load_calls (vec_info *vinfo, stm= t_vec_info stmt_info, > poly_uint64 gather_off_nunits > =3D TYPE_VECTOR_SUBPARTS (gs_info->offset_vectype); > > + /* FIXME: Keep the previous costing way in vect_model_load_cost by cos= ting > + N scalar loads, but it should be tweaked to use target specific cos= ts > + on related gather load calls. */ > + if (!vec_stmt) going over the series now, I'm collecting comments but wanted to get this one out here: I'd rather see if (cost_vec) here, that 'vec_stmt' argument is quite legacy (I think it can be completely purged everywhere) > + { > + unsigned int assumed_nunits =3D vect_nunits_for_cost (vectype); > + unsigned int inside_cost; > + inside_cost =3D record_stmt_cost (cost_vec, ncopies * assumed_nuni= ts, > + scalar_load, stmt_info, 0, vect_bod= y); > + if (dump_enabled_p ()) > + dump_printf_loc (MSG_NOTE, vect_location, > + "vect_model_load_cost: inside_cost =3D %d, " > + "prologue_cost =3D 0 .\n", > + inside_cost); > + return; > + } > + > tree arglist =3D TYPE_ARG_TYPES (TREE_TYPE (gs_info->decl)); > tree rettype =3D TREE_TYPE (TREE_TYPE (gs_info->decl)); > tree srctype =3D TREE_VALUE (arglist); arglist =3D TREE_CHAIN (arglist= ); > @@ -9483,13 +9503,8 @@ vectorizable_load (vec_info *vinfo, > > if (memory_access_type =3D=3D VMAT_GATHER_SCATTER && gs_info.decl) > { > - if (costing_p) > - vect_model_load_cost (vinfo, stmt_info, ncopies, vf, memory_acces= s_type, > - alignment_support_scheme, misalignment, &gs= _info, > - slp_node, cost_vec); > - else > - vect_build_gather_load_calls (vinfo, stmt_info, gsi, vec_stmt, &g= s_info, > - mask); > + vect_build_gather_load_calls (vinfo, stmt_info, gsi, vec_stmt, &gs= _info, > + mask, cost_vec); > return true; > } > > -- > 2.31.1 >