From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 9C35B3858D29 for ; Fri, 24 May 2024 23:31:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C35B3858D29 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9C35B3858D29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716593513; cv=none; b=iQEpBLIeye07B4/slCYomtAhlNsaihW3u4Bbz+4k83Scs0fjMFgvQCYJVVQbTYEU9MzaHvU7tUsh15yQPW+tJwki3EBsfcbAxdPEQ636l+8HU9B0IntG05YkcjVGd/j+BD7935b0h9hZ/pHSPG9KIo+DJYrUpoluKHahC+WWM0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716593513; c=relaxed/simple; bh=Aw+7yNdxoRjOcDZPJoKLGEXAOA6+WYv1PEPu72+NpU0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=LGLHX5IN7adcwyOjfabYxRkxNT0oJpU8WUf4rC8ldeGc2fck6I86wMt4wRasc7JxAUU/mK7vG89lHMyMqi4bJkA1zLsJ/arae6niudON1BoaRLDMG182MVnW0DUseRIyNEO6s3MRs5NNA6kYQxfha8c61yvkJsxNVHA5kcO7gaI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6f966840af7so985110b3a.2 for ; Fri, 24 May 2024 16:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716593510; x=1717198310; darn=gcc.gnu.org; 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=3ryXDsDZvq+2ES/2jgjSAzl83m4OO01VV7TWCfY8KI0=; b=NPLE7lrg+n1keDBxvt2U+n1t9sAguPmqfkgC/kqC0GT9Sxo00wrkvs/k8AcBz1BcxE kILOlVJ9UVJ61utmw2bdWlpVTM2YVGyOY1ZZbd0OSh1D2fWfl9HdB9wPCjyoYwERrTcb LrQA1zFyyQEdoOjiZnaDfnDrmDKx1wJiXQt+rO28vUp6AJyy2HE3gZ2+MQT+lBXiWZ1p w/VEGhFPyW2c+PxCTpGBes1bPxoUAOewxXE0AVt0FTlaAhy4fyKnPZkS8rZOmWVY9iwI GDNM1YDuAx3S8O+rEfzW/nGdbj7wnAX/xnmox2zxQgCul93Nfj5zzPcObH8tb2SOZQZx Mfqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716593510; x=1717198310; 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=3ryXDsDZvq+2ES/2jgjSAzl83m4OO01VV7TWCfY8KI0=; b=exVrgE/CCd51DXuwAuYuK7j3M7J/6oEiDNveS3t+JLRIkR8SIHqLVDGHCv/CY9BDSh mm+f/FiOubAzzByDRHcaymCL+C6ufz+tDDsPMyIn/IBtVmoUwue3hWXmoaT06ETNVC2x f9fRUCES5RKIwhZsvzwJNK7lrUU2irvDe/2wtbdj7V+Y8yQWyp4YOuSZzSX4YJSVwqjx Fb1nNAu8B0+3dS2pGAN9FRavqVoHouRbu753YABoodrYudOnmd3YS0VikSUkOs/duC7h uM5DcBW8kk3RsPciDLrFguUSmSpFDS/2wO75mCKXkSID7qNOuRVZddeJTDsy2uEkdbwB AXPw== X-Gm-Message-State: AOJu0YzoSD5QVYVuYO8brqPhOD1Mf2Qmc684mRiwVn3YH5TQSMvG2m3j B0QQEB6ZiQWewj1dImAwGiJjkPurYygYZh2q6EJs/7pKgRYpIfWG X-Google-Smtp-Source: AGHT+IE0KdD4Kci8Wi3zPdjtMoLOUDuYqc5w1bCkFzUU86qQ0vqfTgqGQ+fWjnGMehmvr4uLZB4/rQ== X-Received: by 2002:a05:6a00:e0c:b0:6ed:caf6:6e54 with SMTP id d2e1a72fcca58-6f8f42bd52amr3143108b3a.28.1716593510188; Fri, 24 May 2024 16:31:50 -0700 (PDT) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fd4d5193sm1589613b3a.191.2024.05.24.16.31.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 May 2024 16:31:49 -0700 (PDT) Message-ID: Date: Fri, 24 May 2024 17:31:48 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH v2] RISC-V: Introduce -mrvv-allow-misalign. Content-Language: en-US To: Palmer Dabbelt , Robin Dapp Cc: gcc-patches@gcc.gnu.org, Kito Cheng , juzhe.zhong@rivai.ai References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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,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 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. > > * -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. > > 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. jeff