🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #657

Re: vector length CSR?

#657
From: Thomas Koenig
Date: Thu, 12 Nov 2026 06:53
45 lines
2783 bytes
Stephen Fuld <sfuld@alumni.cmu.edu.invalid> schrieb:

> It seems the 
> advantage of an SIMD approach is the large set of addressable registers 
> that can be used to keep data readily available for future use.

Plus, you can do wide permutes, and it can also help with reduction.
Having mask for reducing operations also helps (or a length field).

There is one other thing that VVM does not do natively: Reductions
on commutative operators.  Consider the implementation of a simple
SUM intrinsic of FORTRAN.  If you write the assembly equivalent of

  s = 0;
  for (long int i=0; i<n; i++)
    s = s + a[i];

then VVM will add a loop-carried dependency.  For faster code
on long arrays one can unroll the loop, like

  tmp[0] = 0;
  tmp[1] = 0;
  tmp[2] = 0;
  tmp[3] = 0;
  n_end = (n / 4) * 4;
  for (long int i = 0; i < n_nend; i++)
    {
      tmp[0] = tmp[0] + a[i];
      tmp[1] = tmp[1] + a[i+1];
      tmp[2] = tmp[2] + a[i+2];
      tmp[3] = tmp[3] + a[i+3];
    }
  for (long int i = 0; i < n % 4; i++)
    tmp[i] = tmp[i] + a[i+n_end];

  s = tmp[0] + tmp[1] + tmp[2] + tmp[3];

(hope I got this right) but if that is needed, one might as well
use an SIMD register - it is as complex, and register pressure is,
of course, much higher if you use general-purpose registers.

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Technical Details
Message-ID: <11d3npt$3mmho$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11cpqih$acf5$1@dont-email.me> <sgu0flpndaqltpdbft40fghmi7vk78q2hs@4ax.com> <11cq2v7$dh5b$1@dont-email.me> <8jk1fl182pskj3fsmp4ju6qf420pgl0htg@4ax.com> <11csull$1ef6e$1@dont-email.me> <2026Nov9.230104@mips.complang.tuwien.ac.at> <11cvcr4$28k7g$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Thomas Koenig <tkoenig@netcologne.de>
Newsgroups: comp.arch
Subject: Re: vector length CSR?
Date: Thu, 12 Nov 2026 06:53:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <11d3npt$3mmho$1@dont-email.me>
References: <11cpqih$acf5$1@dont-email.me>
 <sgu0flpndaqltpdbft40fghmi7vk78q2hs@4ax.com> <11cq2v7$dh5b$1@dont-email.me>
 <8jk1fl182pskj3fsmp4ju6qf420pgl0htg@4ax.com>
 <11csull$1ef6e$1@dont-email.me>
 <2026Nov9.230104@mips.complang.tuwien.ac.at>
 <11cvcr4$28k7g$1@dont-email.me>
Injection-Date: Thu, 12 Nov 2026 06:53:50 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3889720"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19XAhstrKe/ArAj8I5nGkSytWZ0U6UO1lU="; posting-host="cf9ae724042f1266fdbd721393653efe"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:LyVZhzaSSyRMcVdg5QnxaYRzoYc= sha256:mjTz0TyBG9T6ln+hsIRnN9D9zfG9LA/bU6GtaOas2MU=
	sha1:aMa7WHnhLhrO9xdAC+XgnWHTDLI= sha256:foYfRKziu1Pj1NZDGgFzlYBFtnJqYCAU2kyeuKecj+o=