mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Issue #451 part 2a - Enable OpenMP parallelization for CopyValues in SelfHosting.cpp
This commit is contained in:
parent
b66a74daf6
commit
d8c48d6830
2 changed files with 21 additions and 4 deletions
|
|
@ -1492,9 +1492,22 @@ CopyValues(SharedMem<To*> dest, SharedMem<From*> src, uint32_t count)
|
|||
|
||||
using namespace jit;
|
||||
|
||||
for (; count > 0; count--) {
|
||||
AtomicOperations::storeSafeWhenRacy(dest++,
|
||||
To(AtomicOperations::loadSafeWhenRacy(src++)));
|
||||
#if defined(_OPENMP)
|
||||
const int64_t openMpCount = int64_t(count);
|
||||
if (openMpCount >= (1 << 14)) {
|
||||
#pragma omp parallel for default(none) shared(dest, src, openMpCount) schedule(static)
|
||||
for (int64_t i = 0; i < openMpCount; i++) {
|
||||
uint32_t index = uint32_t(i);
|
||||
AtomicOperations::storeSafeWhenRacy(dest + index,
|
||||
To(AtomicOperations::loadSafeWhenRacy(src + index)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
AtomicOperations::storeSafeWhenRacy(dest + i,
|
||||
To(AtomicOperations::loadSafeWhenRacy(src + i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue