From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id DCB223851C30 for ; Wed, 26 Jun 2024 15:48:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCB223851C30 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DCB223851C30 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719416901; cv=none; b=eswN3Cn1MOLkeYuyRzqu5mybuOzvEgEpsuCCl7hYc6hdHQjRYAEGmzBmYC61l18xy+P4d44c5S+wII++o3p3x4l17Uttis6H0NOu3wu0Wcj6tJTguG4YJLy7pGZ0mFAuVHhONydjGLWx9K6adIc07gTkQNIh90ujkHVgDD7O6+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719416901; c=relaxed/simple; bh=l29ChsvOq1thJ76iFKA37mL385ZG80geQA5vvCMG7ds=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=pRYIARhXn7X3k9VPXEiR8lS/SHBuZm0ED71MnHZ2pQJLUviwcZHXqeBibQ7+r07gOL9ai6neSMRF4lYzfW1U/akSlYre4Ft0oDax7Yq1FkAEwUt53um+fNx6cQJ8ouqGwfUcLN6n01rlRJqAtGIBpOCuVYhOcMVDPxadzTmSXrA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719416898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l29ChsvOq1thJ76iFKA37mL385ZG80geQA5vvCMG7ds=; b=KEmieJmLx5nJ3Mc51CP/NpZmnFZEdrClJiyJhiglqALuzMCF/xV740K+jNBVUl5Tl0a8wp DL1Bo+QQ86HnHY6OyxkA16ovA7KTrEMd8YvVMKM+8w2Sxobcpv5EOKpZb0z/hsN4uiq4zx uDttMOr3MF61cizMY5WKKjguV0ZtKO4= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-58-FqRejr6PMlmPfBfh6K5DCA-1; Wed, 26 Jun 2024 11:48:17 -0400 X-MC-Unique: FqRejr6PMlmPfBfh6K5DCA-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-797d167a402so1006063485a.2 for ; Wed, 26 Jun 2024 08:48:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719416896; x=1720021696; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=l29ChsvOq1thJ76iFKA37mL385ZG80geQA5vvCMG7ds=; b=DoYElM0vQaTNso2N7u/wpkBiXpG1dDFScUIkeMVABcLA2XAuyq4whPJqIpfH9YiNwQ ergyBLK0AyR3NIqydE+nWW9sWh7dq/agNK968+WtPI9dWhQ5Tzr5BQTQ13m3xNvrMsoo pZ7Mp8nwe/9haWAVfGJl+OZ7jpwnrcd3pZlRBAGv0DYP0yElcfMpPtt2Ds3Mne/wXZOf h4S97bl4ItBpYzggNfGqLT9L6g6QziFJmq3dVTmuEux7oaji+XHBsBGgJpT+eH/jq2p4 P1xv9X7+TY/wR3MJ9nQyUIw9hjNrvXknEHf3wFep9ho9eVO5hv4wKx7Ze4UdWRDzNCX1 rWYw== X-Forwarded-Encrypted: i=1; AJvYcCVVc8b3jlO/R/XeCNtZ5sRNZsBVBXhlu6L/wG9mOb+O4Fs4cZA0+S223bPm2d3bo3BR9ROlxyN2kDuoFuSlDuPux2prwdw8Cw== X-Gm-Message-State: AOJu0YylGg5Vs8JF5l7FIemsTOVkXAf58wrvHBDGLpBGG7/dt0KkyskJ Tebh33SMTsKDG/42d3IeIkC4aV1Ql2iG1zOCl9m6xU7Nfa2bMeCdkg78rzSDN3ltbnChrPv+365 aw2saF5nttZsppEFyngUY4SMxvjvBXRtnFmTFozMawlcertrVlIJ+6E0= X-Received: by 2002:a05:620a:2a01:b0:795:5ca2:374e with SMTP id af79cd13be357-79be6f10ea8mr1145022385a.54.1719416896441; Wed, 26 Jun 2024 08:48:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsmeY1Y9O6tR4PQLvMWHAwvLqxOcx84ta4XJADFDhZrg90PsmIkFeQDt8Fw2G7V/6UlyGJNg== X-Received: by 2002:a05:620a:2a01:b0:795:5ca2:374e with SMTP id af79cd13be357-79be6f10ea8mr1145020885a.54.1719416896141; Wed, 26 Jun 2024 08:48:16 -0700 (PDT) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79c0ab69643sm137622985a.114.2024.06.26.08.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 08:48:15 -0700 (PDT) Message-ID: <6f0067536e8ec473204fa7eca2bfb0c10c5bf476.camel@redhat.com> Subject: Re: [PATCH] libgccjit: Add support for the type bfloat16 From: David Malcolm To: Antoni Boucher , jit@gcc.gnu.org, gcc-patches@gcc.gnu.org Date: Wed, 26 Jun 2024 11:48:14 -0400 In-Reply-To: References: <83774dc19d819b75998f72116f54c7dad12667d2.camel@zoho.com> <1c8d83e6f6759b82dc221667cc6545246b51ad8e.camel@zoho.com> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 Wed, 2024-02-21 at 10:56 -0500, Antoni Boucher wrote: > Thanks for the review. > Here's the updated patch. Thanks for the update patch; sorry for the delay in reviewing. The updated patch looks good for trunk. Dave >=20 > On Fri, 2023-12-01 at 12:45 -0500, David Malcolm wrote: > > On Thu, 2023-11-16 at 17:20 -0500, Antoni Boucher wrote: > > > I forgot to attach the patch. > > >=20 > > > On Thu, 2023-11-16 at 17:19 -0500, Antoni Boucher wrote: > > > > Hi. > > > > This patch adds the support for the type bfloat16 (bug 112574). > > > >=20 > > > > This was asked to be splitted from a another patch sent here: > > > > https://gcc.gnu.org/pipermail/jit/2023q1/001607.html > > > >=20 > > > > Thanks for the review. > > >=20 > >=20 > > Thanks for the patch. > >=20 > > > diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc > > > index 18cc4da25b8..7e1c97a4638 100644 > > > --- a/gcc/jit/jit-playback.cc > > > +++ b/gcc/jit/jit-playback.cc > > > @@ -280,6 +280,8 @@ get_tree_node_for_type (enum gcc_jit_types > > > type_) > > > =C2=A0 > > > =C2=A0=C2=A0=C2=A0=C2=A0 case GCC_JIT_TYPE_FLOAT: > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return float_type_node; > > > +=C2=A0=C2=A0=C2=A0 case GCC_JIT_TYPE_BFLOAT16: > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bfloat16_type_node; > >=20 > > The code to create bfloat16_type_node (in build_common_tree_nodes) > > is > > guarded by #ifdef HAVE_BFmode, so we should probably have a test > > for > > this in case GCC_JIT_TYPE_BFLOAT16 to at least add an error message > > when it's NULL_TREE, rather than silently returning NULL_TREE and > > crashing. > >=20 > > [...] > >=20 > > > diff --git a/gcc/testsuite/jit.dg/test-bfloat16.c > > > b/gcc/testsuite/jit.dg/test-bfloat16.c > > > new file mode 100644 > > > index 00000000000..6aed3920351 > > > --- /dev/null > > > +++ b/gcc/testsuite/jit.dg/test-bfloat16.c > > > @@ -0,0 +1,37 @@ > > > +/* { dg-do compile { target x86_64-*-* } } */ > > > + > > > +#include > > > +#include > > > + > > > +#include "libgccjit.h" > > > + > > > +/* We don't want set_options() in harness.h to set -O3 so our > > > little local > > > +=C2=A0=C2=A0 is optimized away. */ > > > +#define TEST_ESCHEWS_SET_OPTIONS > > > +static void set_options (gcc_jit_context *ctxt, const char > > > *argv0) > > > +{ > > > +} > >=20 > >=20 > > Please add a comment to all-non-failing-tests.h noting the > > exclusion > > of > > this test case from the array. > >=20 > > [...] > >=20 > > > diff --git a/gcc/testsuite/jit.dg/test-types.c > > > b/gcc/testsuite/jit.dg/test-types.c > > > index a01944e35fa..9e7c4f3e046 100644 > > > --- a/gcc/testsuite/jit.dg/test-types.c > > > +++ b/gcc/testsuite/jit.dg/test-types.c > > > @@ -1,3 +1,4 @@ > > > +#include > > > =C2=A0#include > > > =C2=A0#include > > > =C2=A0#include > > > @@ -492,4 +493,5 @@ verify_code (gcc_jit_context *ctxt, > > > gcc_jit_result *result) > > > =C2=A0 > > > =C2=A0=C2=A0 CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_= type > > > (ctxt, GCC_JIT_TYPE_FLOAT)), sizeof (float)); > > > =C2=A0=C2=A0 CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_= type > > > (ctxt, GCC_JIT_TYPE_DOUBLE)), sizeof (double)); > > > +=C2=A0 CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type > > > (ctxt, GCC_JIT_TYPE_BFLOAT16)), sizeof (__bfloat16)); > >=20 > >=20 > > This is only going to work on targets which #ifdef HAVE_BFmode, so > > this > > CHECK_VALUE needs to be conditionalized somehow, to avoid having > > this, > > test-combination, and test-threads from bailing out early on > > targets > > without BFmode. > >=20 > > Dave > >=20 >=20