xflouris / libpll

Phylogenetic Likelihood Library
GNU Affero General Public License v3.0
27 stars 6 forks source link

Vectorization & brief code review #23

Closed stamatak closed 8 years ago

stamatak commented 9 years ago

Just a few comments on the vectorization if you want to make it generic:

  1. Keep in mind that for a truly generic implementation there might be data-types that are not multiples of the vector width, e.g., a 7-state model (this exists for RNA secondary structure models!)
  2. Thus, you may have to use uload for vector words and also need to add additional loops outside the vectorized loops for handling those indexes that don't fit into a vector word.
  3. Alternatively, you can of course use padding, but that may be more complicated to implement
xflouris commented 9 years ago

Hi Alexi, thanks for the comments. The implementation in its current status should work for arbitrary data types. Vectorizing it and keeping its functionality will definitely require some modifications. My very first thought (for vectorization) was to add padding to each CLV entry to get the number of entries to its the next multiple of 2 for SSE, or 4 for AVX -- point 3 in your suggestions.

My impression was that this could be straightforward to implement, but I haven't thought of it thoroughly.

xflouris commented 8 years ago

arbitrary-state data types now work, with vectorization.