sleef icon indicating copy to clipboard operation
sleef copied to clipboard

[SVE] Remove all instances of sizeless structures

Open shibatch opened this issue 4 years ago • 3 comments

We are going to modify the code base so that it will comply with the latest ACLE SVE specification. Since the sizeless structures are removed from the ACLE, we need to change the way certain data structures (e.g. vdouble2) are handled. We are going to use setter and getter fuctions to substitute and refer to those variables.

As for vdouble2 data type, we are going to add 5 setter/getter functions like the following.

typedef struct {
  vdouble x, y;
} vdouble2;

static vdouble  vd2getx_vd_vd2(vdouble2 v) { return v.x; }
static vdouble  vd2gety_vd_vd2(vdouble2 v) { return v.y; }
static vdouble2 vd2setxy_vd2_vd_vd(vdouble x, vdouble y)  {
  vdouble2 v; v.x = x; v.y = y; return v;
}
static vdouble2 vd2setx_vd2_vd2_vd(vdouble2 v, vdouble d) { v.x = d; return v; }
static vdouble2 vd2sety_vd2_vd2_vd(vdouble2 v, vdouble d) { v.y = d; return v; }

The SVE version of the above functions is as follows.

typedef svfloat64x2_t vdouble2;
static vdouble  vd2getx_vd_vd2(vdouble2 v) { return svget2_f64(v, 0); }
static vdouble  vd2gety_vd_vd2(vdouble2 v) { return svget2_f64(v, 1); }
static vdouble2 vd2setxy_vd2_vd_vd(vdouble x, vdouble y)  { return svcreate2_f64(x, y); }
static vdouble2 vd2setx_vd2_vd2_vd(vdouble2 v, vdouble d) { return svset2_f64(v, 0, d); }
static vdouble2 vd2sety_vd2_vd2_vd(vdouble2 v, vdouble d) { return svset2_f64(v, 1, d); }

We will change the handling of the following data types as well.

  • di_t
  • ddi_t
  • dd2
  • vfloat2
  • fi_t
  • dfi_t
  • df2
  • vdouble3
  • tdx
  • tdi_t

shibatch avatar May 19 '20 02:05 shibatch

Hi @shibatch ,

thank you for working on this.

Your proposal makes sense to me and is in line with what I was thinking was needed.

I have a question about:

we are going to add 5 setter/getter functions like the following

Am I correct thinking that with what you propose, adding the getters and setters is needed for all the helper header files, and not just the SVE one?

Francesco

fpetrogalli avatar May 19 '20 12:05 fpetrogalli

We can implement the setter and getter functions inside the helper file for SVE only. As for the other vector extensions, we can write them in the current position where the structs are defined.

shibatch avatar May 19 '20 13:05 shibatch

oh, I see. So that you override the common getter and setter with conditional compilation when compiling for SVE. Makes sense! Thanks you. I am looking forward for the PR! :)

Francesco

fpetrogalli avatar May 19 '20 13:05 fpetrogalli

This was solved by #310

blapie avatar Nov 22 '23 17:11 blapie