From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 721CA3858D29 for ; Fri, 24 May 2024 23:39:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 721CA3858D29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 721CA3858D29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716593945; cv=none; b=mUQIrHHEtSH3wKw72HNHwGtXUZc0T1111rSAFQjOAlreE0ByxAvCBNzLei02HcuKEw722PUcTaxAQA1zkxZoiGE9/EbaSzvf+PxNpwKqBi/rVoL8h+y/wIXrUyriBAGmGVXDQCXbRTVRC2ocTQFdwd0a+5sP7yyx5hfvs2Dr/I4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716593945; c=relaxed/simple; bh=vUOffBkgaFu7dkcITiAqYQAtPQvvU9OdvarZjncweOE=; h=DKIM-Signature:Date:Subject:From:To:Message-ID:Mime-Version; b=Nx+9sS8HqYeHvGsmkv0RTy1CG3QfEr10z1bCg7GYCACpKh19zNhQSY3Ffx53/2FXnCB4NWv/P3IHmQUtGflKzNqjpjR/jaF7E8ySQ0zdL4QMlIdij61wt+kmH5yJlraC1PKrV6Z5TFndzDHNxFVRuGZLQq0Pv4hkAb7e4AFxy3E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6f6765226d0so3636688b3a.3 for ; Fri, 24 May 2024 16:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20230601.gappssmtp.com; s=20230601; t=1716593942; x=1717198742; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=14Ur3BOLeH66M7sPd3H06tXJkuTOfZY6KrE/sivGSjQ=; b=EYVsGIFzub16jMfz3BHaLpkAQWbi3AfmUyDHu+0itR+Obvq4wO9qPAGFYfkn556akW ejqZ6NndIpSvC7u3tbyFwn4xac4ull+vwW7kVMki2DzjTj4bf73WRvBEtg5QfIUCIKZa +qRtEXb0N9y7BktkO/GLxJChFjIxyWyRpSljTYHmtQlaBH0NhvAwxyi255ww10i9DQ7h MJI+t0R8atd1Rdf38jOLlG6g+3PK7jEIeQ5ro7jSHuhLngArgD1MR8+fRVElVazDwhAF Jy9oeahmBSzPOUsSbplIneFud7SziVmUtwDUbLxnc68m6SHXgo1EjObHc4Nwrpz8Btmt IsuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716593942; x=1717198742; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=14Ur3BOLeH66M7sPd3H06tXJkuTOfZY6KrE/sivGSjQ=; b=WK0wWRVCQMbkaX2ItDsRCYdWK+DNgKilNSZJdwT16Qilko6HXO9H+EUaJq3AO1LEVP kD0ySEK9m6WKq8RHPoBz4FxKvbPHFsCJqKtrdRxKaDzpebC+hxexKKYHNYgucRIIcDEL u8NSN8ePMYK56kGlXgkMBNV4y0OWid4ad011ivwB6G7/XSuEfuNIo2PiSZww9QftjqCd 43vAjhMcKs8LfU2/ijmw/rup28NC/f9M5bKPUXm+T44x4m5j17t/BUBfPscPv/8nMmpt W3ThY/jiwWUi5VQPsGXm6v/ImkhkGrZB5hbL6l5F2mUUUESS82hEBS4JWDrQsp8eTRSC sJ7g== X-Forwarded-Encrypted: i=1; AJvYcCXbtRNIoiPrvKuuMzVqcd+JEHc26tFvfJHnj52LtiIQ34SIdpGYYQD4sc5uowysIivx1+H+pVgbUb3g4D3O+0zAd0TSkxIq1w== X-Gm-Message-State: AOJu0YzfqbA5lUsVZcFuCjFSPUNehj2PuBUySuryzwHNqBJNjFVULbku q1gH7ycWz16NAW3IJijk0YAf9m0hULas3N3VEnEwGoe9cw4tJn1OwgNYpl83kg0= X-Google-Smtp-Source: AGHT+IHCJ6vS1NWjSsGynCSWzl4G5i1oM/WbDIhNkN+zhA5H2xEHRpBKNHa9QhQEwgFDVdZVoT/Z+g== X-Received: by 2002:a05:6a00:4489:b0:6f4:b20e:a08a with SMTP id d2e1a72fcca58-6f8f3f9711bmr4120155b3a.29.1716593942201; Fri, 24 May 2024 16:39:02 -0700 (PDT) Received: from localhost ([192.184.165.199]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fcbeac00sm1636566b3a.97.2024.05.24.16.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 16:39:01 -0700 (PDT) Date: Fri, 24 May 2024 16:39:01 -0700 (PDT) X-Google-Original-Date: Fri, 24 May 2024 16:39:00 PDT (-0700) Subject: Re: [PATCH v2] RISC-V: Introduce -mrvv-allow-misalign. In-Reply-To: CC: Robin Dapp , gcc-patches@gcc.gnu.org, Kito Cheng , juzhe.zhong@rivai.ai From: Palmer Dabbelt To: jeffreyalaw@gmail.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,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 Fri, 24 May 2024 16:31:48 PDT (-0700), jeffreyalaw@gmail.com wrote: > > > On 5/24/24 11:14 AM, Palmer Dabbelt wrote: >> On Fri, 24 May 2024 09:19:09 PDT (-0700), Robin Dapp wrote: >>>> We should have something in doc/invoke too, this one is going to be >>>> tricky for users.  We'll also have to define how this interacts with >>>> the existing -mstrict-align. >>> >>> Addressed the rest in the attached v2 which also fixes tests. >>> I'm really not sure about -mstrict-align.  I would have hoped that using >>> -mstrict-align we'd never run into any movmisalign situation but that >>> might be wishful thinking.  Do we need to specify an >>> interaction, though?  For now the new options disables movmisalign so >>> if we hit that despite -mstrict-align we'd still not vectorize it. >> >> I think we just need to write it down.  I think there's two ways to >> encode this: either we treat scalar and vector as independent, or we >> couple them.  If we treat them independently then we end up with four >> cases, it's not clear if they're all interesting.  IIUC with this patch >> we'd be able to encode > Given the ISA documents them as independent, I think we should follow > suit and allow them to vary independently. I'm only reading Zicclsm as saying both scalar and vector misaligned accesses are supported, but nothing about the performance. >> * -mstrict-align: Both scalar and vector misaligned accesses are >>  unsupported (-mrvv-allow-misalign doesn't matter).  I'm not sure if >>  there's hardware there, but given we have systems that don't support >>  scalar misaligned accesses it seems reasonable to assume they'll also >>  not support vector misaligned accesses. >> * -mno-strict-align -mno-rvv-allow-misalign: Scalar misaligned are >>  supported, vector misaligned aren't supported.  This matches our best >>  theory of how the k230 and k1 behave, so it also seems reasonable to >>  support. >> * -mno-strict-align -mrvv-allow-misalign: Both scalar and vector >>  misaligned accesses are supported.  This seems reasonable to support >>  as it's how I'd hope big cores end up being designed, though again >>  there's no hardware. > I'd almost lean towards -m[no-]scalar-strict-align and > -m[no-]vector-strict-align and deprecate -mstrict-align (aliasing it to > the scalar alignment option). But I'll go with consensus here. Seems reasonable to me. Just having a regular naming scheme for the scalar/vector makes it clear what we're doing, and it's not like having the extra name for -mscalar-strict-align really costs anything. >> The fourth case is kind of wacky: scalar misaligned is unsupported, >> vector misaligned is supported.  I'm not really sure why we'd end up >> with a system like that, but HW vendors do wacky things so it's kind of >> hard to predict. > I've worked on one of these :-) The thinking from the designers was > unaligned scalar access just wasn't that important, particularly with > mem* and str* using the vector rather than scalar ops. OK then ;)