From 89aafbc3dbb712559f610454c5de0546834d64b9 Mon Sep 17 00:00:00 2001 From: Paulius Velesko Date: Wed, 4 Sep 2024 07:09:28 +0300 Subject: [PATCH] remove dubious locks --- CMakeLists.txt | 1 - chipStarConfig.hh.in | 2 -- src/CHIPBackend.hh | 5 ----- src/backend/Level0/CHIPBackendLevel0.cc | 9 --------- src/backend/OpenCL/CHIPBackendOpenCL.cc | 14 -------------- 5 files changed, 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3db1c018..6c40a19c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,7 +212,6 @@ option(CHIP_SET_RPATH "Add CMAKE_INSTALL_PREFIX/lib to the RPATH for chipStar ex option(CHIP_ENABLE_UNCOMPILABLE_TESTS "Enable tests which are known to not compile" OFF) option(CHIP_BUILD_TESTS "Enable build_tests target" ON) option(CHIP_BUILD_SAMPLES "Build samples" ON) -option(CHIP_DUBIOUS_LOCKS "Enable locks that don't seem necessary but make a lot of valgrind issues go away" OFF) option(CHIP_USE_EXTERNAL_HIP_TESTS "Use Catch2 tests from the hip-tests submodule" OFF) option(CHIP_ENABLE_NON_COMPLIANT_DEVICELIB_CODE "Enable non-compliant devicelib code such as calling LLVM builtins from inside kernel code. Enables certain unsigned long devicelib func variants" OFF) option(CHIP_FAST_MATH "Use native_ OpenCL functions which are fast but their precision is implementation defined" OFF) diff --git a/chipStarConfig.hh.in b/chipStarConfig.hh.in index 542010324..f31e36cc8 100644 --- a/chipStarConfig.hh.in +++ b/chipStarConfig.hh.in @@ -51,8 +51,6 @@ #cmakedefine CHIP_USE_INTEL_USM -#cmakedefine CHIP_DUBIOUS_LOCKS - #cmakedefine CHIP_L0_FIRST_TOUCH #cmakedefine CHIP_ENABLE_NON_COMPLIANT_DEVICELIB_CODE diff --git a/src/CHIPBackend.hh b/src/CHIPBackend.hh index 1ed2e6749..ae5ab5966 100644 --- a/src/CHIPBackend.hh +++ b/src/CHIPBackend.hh @@ -1857,11 +1857,6 @@ public: */ virtual void trackEvent(const std::shared_ptr &Event); -#ifdef CHIP_DUBIOUS_LOCKS - std::mutex DubiousLockOpenCL; - std::mutex DubiousLockLevel0; -#endif - virtual chipstar::ExecItem *createExecItem(dim3 GirdDim, dim3 BlockDim, size_t SharedMem, hipStream_t ChipQueue) = 0; diff --git a/src/backend/Level0/CHIPBackendLevel0.cc b/src/backend/Level0/CHIPBackendLevel0.cc index 527c2bef2..972501bcf 100644 --- a/src/backend/Level0/CHIPBackendLevel0.cc +++ b/src/backend/Level0/CHIPBackendLevel0.cc @@ -808,9 +808,6 @@ CHIPQueueLevel0::~CHIPQueueLevel0() { // The application must not call this function from // simultaneous threads with the same command queue handle. // Done. Destructor should not be called by multiple threads -#ifdef CHIP_DUBIOUS_LOCKS - LOCK(Backend->DubiousLockLevel0) -#endif if (zeCmdQOwnership_) { zeStatus = zeCommandQueueDestroy(ZeCmdQ_); } else { @@ -972,9 +969,6 @@ CHIPQueueLevel0::CHIPQueueLevel0(CHIPDeviceLevel0 *ChipDev, ZeDev_ = ChipDevLz_->get(); logTrace("CHIPQueueLevel0 constructor called via Flags and Priority"); -#ifdef CHIP_DUBIOUS_LOCKS - LOCK(Backend->DubiousLockLevel0) -#endif zeStatus = zeCommandQueueCreate(ZeCtx_, ZeDev_, &QueueDescriptor_, &ZeCmdQ_); CHIPERR_CHECK_LOG_AND_THROW_TABLE(zeCommandQueueCreate); @@ -1462,9 +1456,6 @@ CHIPQueueLevel0::memCopyAsyncImpl(void *Dst, const void *Src, size_t Size, } void CHIPQueueLevel0::finish() { -#ifdef CHIP_DUBIOUS_LOCKS - LOCK(Backend->DubiousLockLevel0) -#endif auto LastEvent = getLastEvent(); if (LastEvent) LastEvent->wait(); diff --git a/src/backend/OpenCL/CHIPBackendOpenCL.cc b/src/backend/OpenCL/CHIPBackendOpenCL.cc index 17aa8fa29..79ed6b163 100644 --- a/src/backend/OpenCL/CHIPBackendOpenCL.cc +++ b/src/backend/OpenCL/CHIPBackendOpenCL.cc @@ -1285,12 +1285,7 @@ CHIPQueueOpenCL::launchImpl(chipstar::ExecItem *ExecItem) { const size_t Local[NumDims] = {BlockDim.x, BlockDim.y, BlockDim.z}; logTrace("Launch GLOBAL: {} {} {}", Global[0], Global[1], Global[2]); - logTrace("Launch LOCAL: {} {} {}", Local[0], Local[1], Local[2]); -#ifdef CHIP_DUBIOUS_LOCKS - LOCK(Backend->DubiousLockOpenCL); -#endif - auto AllocationsToKeepAlive = annotateIndirectPointers( *OclContext, Kernel->getModule()->getInfo(), KernelHandle); @@ -1431,9 +1426,6 @@ CHIPQueueOpenCL::memCopyAsyncImpl(void *Dst, const void *Src, size_t Size, std::static_pointer_cast(Event)->getNativePtr()); CHIPERR_CHECK_LOG_AND_THROW_TABLE(clEnqueueMarker); } else { -#ifdef CHIP_DUBIOUS_LOCKS - LOCK(Backend->DubiousLockOpenCL) -#endif auto [EventsToWait, EventLocks] = getSyncQueuesLastEvents(Event, false); std::vector SyncQueuesEventHandles = getOpenCLHandles(EventsToWait); @@ -1518,9 +1510,6 @@ CHIPQueueOpenCL::memCopyAsyncImpl(void *Dst, const void *Src, size_t Size, } void CHIPQueueOpenCL::finish() { -#ifdef CHIP_DUBIOUS_LOCKS - LOCK(Backend->DubiousLockOpenCL) -#endif clStatus = get()->finish(); CHIPERR_CHECK_LOG_AND_THROW_TABLE(clFinish); this->LastEvent_ = nullptr; @@ -1627,9 +1616,6 @@ CHIPQueueOpenCL::memPrefetchImpl(const void *Ptr, size_t Count) { std::shared_ptr CHIPQueueOpenCL::enqueueBarrierImpl( const std::vector> &EventsToWaitFor) { -#ifdef CHIP_DUBIOUS_LOCKS - LOCK(Backend->DubiousLockOpenCL) -#endif std::shared_ptr Event = static_cast(Backend)->createEventShared( this->ChipContext_);