Skip to content

Commit a684627

Browse files
committed
[SYCL] remove spin lock from usm_allocator
since TotalSize is now updated atomically, there is no need for additional lock. All other (per-bucket) stats are protected by a per-bucket lock.
1 parent 0e28d38 commit a684627

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

sycl/plugins/unified_runtime/ur/usm_allocator.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,6 @@ class USMAllocContext::USMAllocImpl {
272272
// Configuration for this instance
273273
USMAllocatorParameters params;
274274

275-
// Protects the capacity checking of the pool.
276-
SpinLock PoolLock;
277-
278275
public:
279276
USMAllocImpl(std::unique_ptr<SystemMemory> SystemMemHandle,
280277
USMAllocatorParameters params)
@@ -309,8 +306,6 @@ class USMAllocContext::USMAllocImpl {
309306
void printStats(bool &TitlePrinted, size_t &HighBucketSize,
310307
size_t &HighPeakSlabsInUse, const std::string &Label);
311308

312-
SpinLock &getLock() { return PoolLock; }
313-
314309
private:
315310
Bucket &findBucket(size_t Size);
316311
};
@@ -582,7 +577,6 @@ void Bucket::onFreeChunk(Slab &Slab, bool &ToPool) {
582577
}
583578

584579
bool Bucket::CanPool(bool &ToPool) {
585-
std::lock_guard<SpinLock> Lock{OwnAllocCtx.getLock()};
586580
size_t NewFreeSlabsInBucket;
587581
// Check if this bucket is used in chunked form or as full slabs.
588582
bool chunkedBucket = getSize() <= ChunkCutOff();

0 commit comments

Comments
 (0)