[PATCH] D26420: Encode duplication factor from loop vectorization and loop unrolling to discriminator.

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 15:34:18 PST 2016


hfinkel added a comment.

In https://reviews.llvm.org/D26420#601874, @danielcdh wrote:

> Thanks for the review.
>
> Any update comments about the proposed encoding before it's ready to land?


Could we be smarter about the encoding so that the distinct-copies case did not take up so much space? It seems like the design right now gives a fixed number of low bits to the duplication factor. Could we use a variable number of bits? For example, because of the underlying LEB128 encoding, we could use some of the lowest-order bits as indicators, or better, use a variable-length code:

low: < duplication factor > < copy id > : high

where each factor is a variable-length code (e.g. a prefix code: https://en.wikipedia.org/wiki/Prefix_code). For example, the Fibonacci code (https://en.wikipedia.org/wiki/Fibonacci_coding) is a well-known code which is good when the encoded numbers are likely to be small. In short, we might encode:

bitreverse( Fibonacci(copy-id + 1) | Fibonacci(dup-factor + 1) )

In this case, if either field is empty, then we waste only 2 bits encoding that field. Small numbers take only a small number of bits. What do you think?

> Thanks,
> Dehao




https://reviews.llvm.org/D26420





More information about the llvm-commits mailing list