From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 38F6D385B188 for ; Fri, 16 Dec 2022 20:23:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 38F6D385B188 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-pj1-x1030.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so7238549pjp.1 for ; Fri, 16 Dec 2022 12:23:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=pncFsSd1nUdTAzAHjY00vQvwfHat9gRE98ytOKKh8fU=; b=W12q/EomuJ48vd9a/Wg85x17GgO2Qlwr7OKRtdsody9wiQIO2SifjV4fjXeR+nzg0H 6HV6EdtkbHXKk2iDUGbSTJ2mUcIM8cIn/Cwz7U8RHb6eFHlAKRt4UXc685S00SBhJreC GtAP8lsNX4XaVHOaUxByJO2GNMF+ALX6dY+a8WaZYLucC8h1f7LKw1dm13s7UerGxIB+ WRO00BDO4uPkXenanQQjsbHc9XisiPFMfPfwk0/vmBRYfhYP/5l69o7ZX+L7REDBZw/O YOXcQKjgLkoIjqZyGFC4uw7cg3LD+Loi6iFbXaeilEtHx77rbJEhmEUwHWwXnjQgejiw h5xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pncFsSd1nUdTAzAHjY00vQvwfHat9gRE98ytOKKh8fU=; b=dk6xL4Ay82vdS39RllHz56TcgfL5KT2C8cYqmvGr9g6ocl/OdftXFqe+ZxRIo/opur j0jOc15LPP0FElZi8R5hIzp8uuoA4zWJJbuLQrQapdJP7cSFT2P4fRR49APecVVvT7Fa JO5qpzVewAzvpk1kt9I3REvXjP3uZZTIh6LnG9zGvUIBc5srftfZtuvt2muDqOrvtaAq HKOXeue1Hw8TzEVX6gwdWO6msxmB0lrCZvAuQbFnpaSMa0mMJF7ktrTcHWrEuL0pbQCG 97nGF0+94OD03iV0TW5i99ssOqY07kPVMnx/nV3mu2FH5QbeljxMGUToZEW5QGEcITgq ppAg== X-Gm-Message-State: ANoB5pkyV7J5EwKb9wggBZd95CWnGSKjwe2bxH6rDYE7qe90+tm0i7wQ fa/CQ8e5HduzAwJJTpOnEgs= X-Google-Smtp-Source: AA0mqf5x3/63x/wT8p+cRjisOk4xZ5RLmHiKbjkFyJcU7ZhYnoWPXylKFwQjBk9O8VxqzNQZdUUS/w== X-Received: by 2002:a17:902:d3d3:b0:189:cc58:77a8 with SMTP id w19-20020a170902d3d300b00189cc5877a8mr32661230plb.46.1671222179109; Fri, 16 Dec 2022 12:22:59 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c20600b00186881e1feasm2041519pll.112.2022.12.16.12.22.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Dec 2022 12:22:58 -0800 (PST) Message-ID: <190019d9-155b-e0d1-43d3-d9baae96a2cc@gmail.com> Date: Fri, 16 Dec 2022 13:22:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] RISC-V: Fix RVV mask mode size Content-Language: en-US To: juzhe.zhong@rivai.ai, gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com References: <20221214064825.240605-1-juzhe.zhong@rivai.ai> From: Jeff Law In-Reply-To: <20221214064825.240605-1-juzhe.zhong@rivai.ai> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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 12/13/22 23:48, juzhe.zhong@rivai.ai wrote: > From: Ju-Zhe Zhong > > This patch is to fix RVV mask modes size. Since mask mode size are adjust > as a whole RVV register size LMUL = 1 which not only make each mask type for > example vbool32_t tied to vint8m1_t but also increase memory consuming. > > I notice this issue during development of VSETVL PASS. Since it is not part of > VSETVL support, I seperate it into a single fix patch now. > > gcc/ChangeLog: > > * config/riscv/riscv-modes.def (ADJUST_BYTESIZE): Reduce RVV mask mode size. > * config/riscv/riscv.cc (riscv_v_adjust_bytesize): New function. > (riscv_modes_tieable_p): Don't tie mask modes which will create issue. > * config/riscv/riscv.h (riscv_v_adjust_bytesize): New function. So I haven't really studied the masking model for RVV (yet). But there's two models that I'm generally aware of. One model has a bit per element in the vector we're operating on. So a V4DF will have 4 bits in the mask. I generally call this the dense or packed model. The other model has a bit for every element for the maximal number of elements that can ever appear in a vector. So if we support an element length of 8bits and a 1kbit vector, then the sparse model would have 128 bits regardless of the size of the object being operated on. So we'd still have 128 bits for V4DF, but the vast majority would be don't cares. ISTM that you're trying to set the mode size to the smallest possible which would seem to argue that you want the dense/packed mask model. Does that actually match what the hardware does? If not, then don't we need to convert back and forth? Or maybe I'm missing something here?!? Jeff