Skip to content

Commit

Permalink
remove dubious locks
Browse files Browse the repository at this point in the history
  • Loading branch information
pvelesko committed Sep 4, 2024
1 parent f9259fd commit 89aafbc
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 31 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions chipStarConfig.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/CHIPBackend.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1857,11 +1857,6 @@ public:
*/
virtual void trackEvent(const std::shared_ptr<chipstar::Event> &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;
Expand Down
9 changes: 0 additions & 9 deletions src/backend/Level0/CHIPBackendLevel0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
14 changes: 0 additions & 14 deletions src/backend/OpenCL/CHIPBackendOpenCL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -1431,9 +1426,6 @@ CHIPQueueOpenCL::memCopyAsyncImpl(void *Dst, const void *Src, size_t Size,
std::static_pointer_cast<CHIPEventOpenCL>(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<cl_event> SyncQueuesEventHandles =
getOpenCLHandles(EventsToWait);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1627,9 +1616,6 @@ CHIPQueueOpenCL::memPrefetchImpl(const void *Ptr, size_t Count) {

std::shared_ptr<chipstar::Event> CHIPQueueOpenCL::enqueueBarrierImpl(
const std::vector<std::shared_ptr<chipstar::Event>> &EventsToWaitFor) {
#ifdef CHIP_DUBIOUS_LOCKS
LOCK(Backend->DubiousLockOpenCL)
#endif
std::shared_ptr<chipstar::Event> Event =
static_cast<CHIPBackendOpenCL *>(Backend)->createEventShared(
this->ChipContext_);
Expand Down

0 comments on commit 89aafbc

Please sign in to comment.