mattkretz / wg21-papers

my papers to WG21 — the C++ committee
5 stars 7 forks source link

Can I have `abi_for_efficient_mask_conversions`? #13

Closed mattkretz closed 7 years ago

mattkretz commented 7 years ago

@jensmaurer:

(23) For the Mandelbrot stuff, the main computation is using a float datapar of native size. I also need a datapar on an integral type for counting. The actual integral type used is irrelevant, but the masks should have the same byte-size so that costly conversions are avoided. There's a type transformation missing for this; we only have abi_for_size.

(BTW, it can be quite efficient to use float for counting iterations.)

Interesting feature request. What would you expect on an AVX target, where float vectors use ymm registers and integral vectors use xmm registers? IIRC Blue Gene only has float SIMD, integers are all scalar. I'll be happy to incorporate this if you have a good idea how this needs to work.

jensmaurer commented 7 years ago

Good idea to use float for the counting.

On SSE2, I want "int" for datapar<float>. On AVX, I want "short" for datapar<float>, because datapar::size() == datapar::size(). Hm.. I agree that still requires some sort of register-juggling when converting masks. When datapar is a scalar, I guess I want a compile-time error.

Put differently, given a floating-point T, return a [signed / unsigned] integer type U such that datapar::size() == datapar::size(). If no such U exists, the program is ill-formed.

But maybe this feature request is just misguided, and I should use datapar for counting, because that avoids both the original question and the mask incompatibility. Let's leave it out for pre-Kona.

mattkretz commented 7 years ago

Hmm. I don't think there will be many users out there that can accept a widely different value range for integral types, just to get a native datapar that matches the float size. Such a user is free to write the necessary template magic himself, IMHO.

I'll close this, until you have more motivation for me. :-)