From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126530 invoked by alias); 7 Aug 2017 14:29:07 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 123039 invoked by uid 89); 7 Aug 2017 14:29:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*nz, HTo:D*nz X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Aug 2017 14:29:00 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84A6E13A5D; Mon, 7 Aug 2017 14:28:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 84A6E13A5D Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dmalcolm@redhat.com Received: from ovpn-116-185.phx2.redhat.com (ovpn-116-185.phx2.redhat.com [10.3.116.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15AD2600C4; Mon, 7 Aug 2017 14:28:57 +0000 (UTC) Message-ID: <1502116137.2723.7.camel@redhat.com> Subject: Re: does libgccjit support vector types? From: David Malcolm To: Michael Cree , jit@gcc.gnu.org Date: Sun, 01 Jan 2017 00:00:00 -0000 In-Reply-To: <20170807081235.oujwzxfp6vujlg7f@tower> References: <20170807081235.oujwzxfp6vujlg7f@tower> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 07 Aug 2017 14:28:58 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00003.txt.bz2 On Mon, 2017-08-07 at 20:12 +1200, Michael Cree wrote: Hi Michael > I am wondering if libgccjit supports vector types, i.e., can one > attach attribute __vector_size__ to the base types? There does not > seem to be any indication of this in the manual. Currently this isn't supported. [notes to self e.g.: typedef int v4si __attribute__ ((vector_size (16))); is normally handled by C/C++ here: c-family/c-attribs.c:260: { "vector_size", 1, 1, false, true, false, handle_vector_size_attribute, true }, which ultimately calls: new_type = build_vector_type (type, nunits); /* Build back pointers if needed. */ *node = lang_hooks.types.reconstruct_complex_type (*node, new_type); (the latter does some support stuff for C++ templates). Hence the "vector_size" attribute itself isn't supported by libgccjit, and the underlying build_vector_type call within gcc's internal API isn't exposed yet via libgccjit. end of notes to self] Is this a blocker for you using libgccjit? What would the ideal API look like? Maybe something like: extern gcc_jit_type * gcc_jit_type_get_vector (gcc_jit_type *type, unsigned nunits); with various requirements (type must be integral/floating point; nunits must be a power of two). > I presume using gcc_jit_context_add_command_line_option() one can > turn > on code generation for sse/avx/neon/altivec, etc. That ought to work, though currently the only usage examples in the testsuite for this entrypoint are platform-independent (e.g. "-ffast- math"). > And is there a way to access built-in functions such as the machine > specific simd intrinsics? gcc_jit_context_get_builtin_function ought to work, though I don't think I've tested this particular use-case (as above, the usage examples in the testsuite are currently all platform-independent). Hope this is helpful Dave