Skip to content

Thread safety of ALP: Should static arrays in encoder be thread_local for multithreaded compression? #41

@deepakg-2203

Description

@deepakg-2203

Hi,
I am using ALP for multithreaded compression and noticed that in "encoder.hpp",the function "encode_simdized()" uses static arrays like this:

`alignas(64) static PT ENCODED_VALUE_ARR[1024];

alignas(64) static PT VALUE_ARR_WITHOUT_SPECIALS[1024];

alignas(64) static UT TMP_INDEX_ARR[1024];`

Since these are static, they are shared between threads and could cause data races during parallel compression.
Would it be correct to change these to thread_local static to make the function thread-safe? Or is there a recommended way to use ALP safely in a multithreaded context?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions