From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: lloda Newsgroups: gmane.lisp.guile.devel Subject: Re: more advanced bytevector => supervectors Date: Wed, 8 Sep 2021 09:18:05 +0200 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_71ABEA1F-CF09-49A9-98D7-AD1B5757987F" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18607"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-devel To: Stefan Israelsson Tampe Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Sep 08 09:19:03 2021 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNrrI-0004Uv-2t for guile-devel@m.gmane-mx.org; Wed, 08 Sep 2021 09:19:00 +0200 Original-Received: from localhost ([::1]:34084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNrrG-0004Ej-4v for guile-devel@m.gmane-mx.org; Wed, 08 Sep 2021 03:18:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNrqk-0003xs-7o for guile-devel@gnu.org; Wed, 08 Sep 2021 03:18:26 -0400 Original-Received: from mta-13-3.privateemail.com ([198.54.118.204]:9518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNrqi-00072m-6m for guile-devel@gnu.org; Wed, 08 Sep 2021 03:18:25 -0400 Original-Received: from mta-13.privateemail.com (localhost [127.0.0.1]) by mta-13.privateemail.com (Postfix) with ESMTP id EAD3918002C6; Wed, 8 Sep 2021 03:18:09 -0400 (EDT) Original-Received: from [192.168.1.105] (unknown [10.20.151.223]) by mta-13.privateemail.com (Postfix) with ESMTPA id 00E14180015A; Wed, 8 Sep 2021 03:18:08 -0400 (EDT) In-Reply-To: X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Virus-Scanned: ClamAV using ClamSMTP Received-SPF: pass client-ip=198.54.118.204; envelope-from=lloda@sarc.name; helo=MTA-13-3.privateemail.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20845 Archived-At: --Apple-Mail=_71ABEA1F-CF09-49A9-98D7-AD1B5757987F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 8 Sep 2021, at 04:04, Stefan Israelsson Tampe = wrote: >=20 ... > So using get-setter typically means > ((get-setter #f bin1 #f=20 > (lambda (set) (set v 2 val))) >=20 > #:is-endian 'little ;; only consider little endian setters = like I know=20 > #:is-unsigned #t ;; only use unsigned > #:is-integer #t ;; only use integer representations > #:is-fixed #t ;; do not use the scm value vector = versions > ) > So a version where we only consider handling nonegative integers of up = to 64bit. The gain is faster compilation as this ideom will dispatch > between 4 different versions of the the loop lambda and the compiler = could inline all of them or be able to detect the one that are used and = hot compile that version > (a feature we do not have yet in guile) now whe you select between a = ref and a set you will similarly end up with 4*4 versions =3D 16 = different loops that. full versions > is very large and a double loop with all featurs consists of (2*2 + = 3*2*2*2 + 4 + 1)**2 =3D 33*33 ~ 1000 versions of the loop which is crazy = if we should expand the loop > for all cases in the compilation. Now guile would just use a = functional approach and not expand the loop everywhere. We will have = parameterised versions of > libraries so that one can select which versions to compile for. for = example the general functions that performs transform form one = supervector to another is a general > ideom that would use the full dispatc which is not practical,=20 I'm curious where you're going with this. I implemented something similar (iiuc) in = https://github.com/lloda/guile-newra/ = , specifically = https://github.com/lloda/guile-newra/blob/master/mod/newra/map.scm = , = where the lookup/set methods are inlined in the loop. The compilation = times indeed grow exponentially so I'm forced to have a default = 'generic' case.=20 The idea for fixing this was to have some kind of run time compilation = cache so only a fixed number of type combinations that actually get used = would be compiled, instead of the tensor product of all types. But I = haven't figured out, or actually tried to do that yet. Regards =09 Daniel --Apple-Mail=_71ABEA1F-CF09-49A9-98D7-AD1B5757987F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On 8 Sep 2021, at 04:04, Stefan Israelsson Tampe <stefan.itampe@gmail.com> wrote:


...

So using get-setter typically means
((get-setter #f bin1 #f 
  =  (lambda (set) (set v 2 val)))

   #:is-endian 'little  =         ;; only consider little endian setters like = I know 
   #:is-unsigned  = #t         ;; only use unsigned
   #:is-integer      #t    =      ;; only use integer representations
   #:is-fixed          = #t        ;; do not use the scm value vector = versions
)
So a version where = we only consider handling nonegative integers of up to 64bit. The gain = is faster compilation as this ideom will dispatch
between 4 different versions of the the loop lambda and = the compiler could inline all of them or be able to detect the one that = are used and hot compile that version
(a feature we = do not have yet in guile) now whe you select between a ref and a set you = will similarly end up with 4*4 versions =3D 16 different loops = that. full versions
is very large and a double loop = with all featurs consists of (2*2 + 3*2*2*2 + 4 + 1)**2 =3D= 33*33 ~ 1000 versions of the loop which is crazy if we should expand = the loop
for all cases in the compilation. Now = guile would just use a functional approach and not expand the loop = everywhere. We will have parameterised versions of
libraries so that one can select which versions to = compile for. for example the general functions that performs transform = form one supervector to another is a general
ideom that would use the full dispatc which is not = practical, 

I'm curious where you're going with = this.

I implemented = something similar (iiuc) in https://github.com/lloda/guile-newra/, = specifically https://github.com/lloda/guile-newra/blob/master/mod/newra/map.= scm , where the lookup/set methods are inlined in the loop. The = compilation times indeed grow exponentially so I'm forced to have a = default 'generic' case. 

The = idea for fixing this was to have some kind of run time compilation cache = so only a fixed number of type combinations that actually get used would = be compiled, instead of the tensor product of all types. But I haven't = figured out, or actually tried to do that yet.

Regards
= Daniel

= --Apple-Mail=_71ABEA1F-CF09-49A9-98D7-AD1B5757987F--