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 921C3385803E for ; Fri, 1 Dec 2023 17:45:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 921C3385803E 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 921C3385803E 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=1701452715; cv=none; b=bdtJU7HgNPrJIMSXOXLwY5dX12SBFt8P18LnDIw0SS3XynUdFFBmoYO7TbpELbGnL8fa/Y3PbPAATWRKQjnb+I+vvf3Q1FeNEY3tmb6oZja4nh+8m1jrkNS/WZ6D3lMh9SSdezOvoQyuNveILzjXDeTZw6pqEf5kJnSAN5cS8ss= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701452715; c=relaxed/simple; bh=vRBTajA7BAO2Bs5dmnAGxgvqU8ugHi8RoGaTfcrdk+4=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=BPSY82Qrj0RO6o97qN6OiknXEXMXIFuwMnAAsMcl8UVzA23crhslfbaIGqzrM5AAhMAPo6rktgX0l9us/+hlHQ+Aw69zxLIa9SH344NiBzp5hjAPdzcE1oifKDfMikUKLRuadtjQi94e9U/KiuHg9YhpHPX+BIcadpbE8JALyrQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701452713; 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=wWgY4iXfr373vt0jBO3I0aruVwyiM4MHDVAhO7dlCVk=; b=HA+2ieoiORd79YYmS2eLukU8gW8W70YBVkWNS9Qu0L6xv9SsVy/SuzgZAYBEbc7zdR5F56 gb7DmWpycZ00peG5+fj/EtQ+g9olZ4WFdAzbjVgPy+i3472et8cJGBIKRnJNdnPOU14ZbG en6YuzY8zPeysuNwrcjVWKxqSCAgOtE= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-524-sOUD1WzSOoSatgID9JJ32g-1; Fri, 01 Dec 2023 12:45:12 -0500 X-MC-Unique: sOUD1WzSOoSatgID9JJ32g-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-77dd463dfb0so288684885a.1 for ; Fri, 01 Dec 2023 09:45:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701452710; x=1702057510; 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=wWgY4iXfr373vt0jBO3I0aruVwyiM4MHDVAhO7dlCVk=; b=dkUvEUelhrGO0cQbEcbU65oj4Gv8Nj4A7ehBPY31EdSqUKareViIrUFhwtw/lMpdMy 2y1Y9xEPRJHvZD1BkOI0flgts0iuTqOdJRoXOXjwLG2TvtNGk0tywivMvg4KyVcw+u2g WDn4FZygQYxuUYb1w+68OiGDJtjuVHG3byAKEZOKf3YUMgYquic95j0Q5sTFm1uHeDtB wVCMtv3C5bTTR2YLpV4nznVR1Yxp2Oh8Y0qkb3WVEi2Ak6gruA+yR4XFdifI7NnF786X 5qr7zdlTyAgvn+mV2GfxXVfeaqFGQUH76Rl7KCJR+OcF2UdTjiGCo9gu9hQtPA/AU/UE Ng0A== X-Gm-Message-State: AOJu0YwPI6tVGoGq0HZpBT5uoUaldx4KXMhis9XIVjnVE5joST+JzKnZ 2Dt1LaZK0GLeiFNSQOe5PCubicZNIaDxn3qYdPwTnJ5t6C/tAAOLMqJwdY7+EQkV/qw6GK2R+B7 qlbj9x1VasW+DcRQ= X-Received: by 2002:a05:620a:84c9:b0:77b:d90e:dd91 with SMTP id pq9-20020a05620a84c900b0077bd90edd91mr30659734qkn.46.1701452710614; Fri, 01 Dec 2023 09:45:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0rU4p0Nvrwmrj9mbTI5xyn8rnJqrC8YAcmeRaW/GJcjb9f5lI1daiMCBT57T0eizpmuyQAA== X-Received: by 2002:a05:620a:84c9:b0:77b:d90e:dd91 with SMTP id pq9-20020a05620a84c900b0077bd90edd91mr30659716qkn.46.1701452710274; Fri, 01 Dec 2023 09:45:10 -0800 (PST) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id x13-20020ae9e90d000000b0077d71d46887sm1683692qkf.112.2023.12.01.09.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 09:45:09 -0800 (PST) Message-ID: 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: Fri, 01 Dec 2023 12:45:08 -0500 In-Reply-To: <1c8d83e6f6759b82dc221667cc6545246b51ad8e.camel@zoho.com> 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=-12.7 required=5.0 tests=BAYES_00,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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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 Thanks for the patch. > 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_) > =20 > case GCC_JIT_TYPE_FLOAT: > return float_type_node; > + case GCC_JIT_TYPE_BFLOAT16: > + return bfloat16_type_node; 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. [...] > 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 loc= al > + is optimized away. */ > +#define TEST_ESCHEWS_SET_OPTIONS > +static void set_options (gcc_jit_context *ctxt, const char *argv0) > +{ > +} Please add a comment to all-non-failing-tests.h noting the exclusion of this test case from the array. [...] > diff --git a/gcc/testsuite/jit.dg/test-types.c b/gcc/testsuite/jit.dg/tes= t-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 > #include > #include > #include > @@ -492,4 +493,5 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *r= esult) > =20 > CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, GC= C_JIT_TYPE_FLOAT)), sizeof (float)); > CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, GC= C_JIT_TYPE_DOUBLE)), sizeof (double)); > + CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, GC= C_JIT_TYPE_BFLOAT16)), sizeof (__bfloat16)); 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. Dave