ARM-software / astc-encoder

The Arm ASTC Encoder, a compressor for the Adaptive Scalable Texture Compression data format.
https://developer.arm.com/graphics
Apache License 2.0
1.08k stars 241 forks source link

Improve SIMD table abstraction #491

Closed solidpixel closed 3 months ago

solidpixel commented 3 months ago

The current SIMD code exposes tables as as fixed number of vector variables, but exactly how many variables you need for the table depends on the ISA implementation. These results in an untidy implementation where we pass around table variables that unused on some SIMD implementations, and I suspect the abstraction causes a sub-optimal SVE implementation.

We should implement a set of new opaque vfloat_tableN data types, where the concrete type is defined by the SIMD library in use.

solidpixel commented 3 months ago

Optimization idea - currently we do a table lookup of 4 32-bit indices at a time. For cases where we do multiple table lookups we could try and get a result in 16 bits and do two lookups at the same time. Trade-off of cost of pack/unpack vs cost of multiple lookups.