Skip to content

Julia v1.12 breaks threadid based buffers #988

@bclyons12

Description

@bclyons12

Julia already notes that threadid based buffers are dangerous as you can get yield points within loops where the threadid switches. So far we've gotten away with this. In Julia v1.12, Threads.nthreads() reports the number of worker threads, but the worker threads are numbered from nthreads(:interactive) .+ (1:nthreads(:default)). Thus when we allocate a buffer of Threads.nthreads(), but then try to index on Threads.threadid(), we wind up trying to access an element at Threads.nthreads()+1.

We really should find a correct way of doing thread-safe buffer arrays. Perhaps @fredrikekre can help. In the meantime, I think tid = mod(Threads.threadid(), Threads.nthreads()) + 1 would restore existing behavior.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions