VectorType supported sizes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

VectorType supported sizes

Fangrui Song via cfe-dev
Hi folks,

VectorType supports arbitrary vector sizes up to 2047, and nothing above that.
GCC supports sizes up to 2**62, but only powers of 2.
Would it make sense to support e.g. arbitrary sizes up to 256, and powers of two above that?
I'm not familiar with all the ways vector types are used, but want to reduce pressure on the size of the bitfields.

Currently VectorType stores its size in "all the remaining bits" left by Type.
This was 11 bits, so clang supported sizes <2048. We accidentally regressed this to 10 bits <1024 in 6f428e09 when adding another bit to Type, and it turns out people have code with vector_size(1024). https://bugs.llvm.org/show_bug.cgi?id=45387

If it would be useful, my proposal is to store a "largesize" flag and an 8-bit size. If largesize is set then the real size is 1<<size. This would save an additional bit and support big sizes.
If that _doesn't_ make sense, I'd probably just start treating size=0 as 1024, with the assumption that nobody was making use of sizes 1025-2043.

Cheers, Sam

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: VectorType supported sizes

Fangrui Song via cfe-dev
Sent https://reviews.llvm.org/D77313 - I was guessing as to reviewers, feel free to jump on this (especially) if you know something about this topic.

On Thu, Apr 2, 2020 at 1:51 PM Sam McCall <[hidden email]> wrote:
Hi folks,

VectorType supports arbitrary vector sizes up to 2047, and nothing above that.
GCC supports sizes up to 2**62, but only powers of 2.
Would it make sense to support e.g. arbitrary sizes up to 256, and powers of two above that?
I'm not familiar with all the ways vector types are used, but want to reduce pressure on the size of the bitfields.

Currently VectorType stores its size in "all the remaining bits" left by Type.
This was 11 bits, so clang supported sizes <2048. We accidentally regressed this to 10 bits <1024 in 6f428e09 when adding another bit to Type, and it turns out people have code with vector_size(1024). https://bugs.llvm.org/show_bug.cgi?id=45387

If it would be useful, my proposal is to store a "largesize" flag and an 8-bit size. If largesize is set then the real size is 1<<size. This would save an additional bit and support big sizes.
If that _doesn't_ make sense, I'd probably just start treating size=0 as 1024, with the assumption that nobody was making use of sizes 1025-2043.

Cheers, Sam

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev