SWDEV-480772 - Remove name variable from amd::Monitor class.

Change-Id: Ie2a4fa44f485786227230f8a892e090e718aa30e
This commit is contained in:
kjayapra-amd authored and Karthik Jayaprakash committed 2024-09-19 11:55:01 -04:00
1 vanhempi cfdc9dfc36
commit 12a39fbf22
27 files changed
+76 -83

No files matched your search

+4 -2
Näytä tiedosto
@@ -301,7 +301,8 @@ std::vector<Device*>* Device::devices_ = nullptr;
AppProfile Device::appProfile_;
Context* Device::glb_ctx_ = nullptr;
Monitor Device::p2p_stage_ops_("P2P Staging Lock", true);
// P2P Staging Lock
Monitor Device::p2p_stage_ops_(true);
Memory* Device::p2p_stage_ = nullptr;
Monitor MemObjMap::AllocatedLock_ ROCCLR_INIT_PRIORITY(101) ("Guards MemObjMap allocation list");
@@ -714,7 +715,8 @@ bool Device::ValidateHsail() {
bool Device::create(const Isa &isa) {
assert(!vaCacheAccess_ && !vaCacheMap_);
isa_ = &isa;
vaCacheAccess_ = new amd::Monitor("VA Cache Ops Lock", true);
// VA Cache Ops Lock
vaCacheAccess_ = new amd::Monitor(true);
if (nullptr == vaCacheAccess_) {
return false;
}
+2 -2
Näytä tiedosto
@@ -1265,7 +1265,7 @@ class VirtualDevice : public amd::HeapObject {
VirtualDevice(amd::Device& device)
: device_(device)
, blitMgr_(NULL)
, execution_("Virtual device execution lock", true)
, execution_(true) /* Virtual device execution lock */
, index_(0) {}
//! Destroy this virtual device.
@@ -2156,7 +2156,7 @@ class Device : public RuntimeObject {
uint64_t stack_size_{1024}; //!< Device stack size
device::Memory* initial_heap_buffer_; //!< Initial heap buffer
uint64_t initial_heap_size_{HIP_INITIAL_DM_SIZE}; //!< Initial device heap size
amd::Monitor activeQueuesLock_ {"Guards access to the activeQueues set"};
amd::Monitor activeQueuesLock_ {}; //!< Guards access to the activeQueues set
std::unordered_set<amd::CommandQueue*> activeQueues; //!< The set of active queues
private:
const Isa *isa_; //!< Device isa
+4 -2
Näytä tiedosto
@@ -69,7 +69,8 @@ inline static std::vector<std::string> splitSpaceSeparatedString(const char *str
}
#if defined(WITH_COMPILER_LIB)
amd::Monitor Program::buildLock_("HSAIL build lock", true);
// HSAIL build lock
amd::Monitor Program::buildLock_(true);
#endif
// ================================================================================================
@@ -2939,7 +2940,8 @@ bool Program::getGlobalVarFromCodeObj(std::vector<std::string>* var_names) const
#endif
}
amd::Monitor Program::initFiniLock_("Init Fini Launch Lock", true);
// Init Fini Launch Lock
amd::Monitor Program::initFiniLock_(true);
bool Program::runInitFiniKernel(kernel_kind_t kind) const {
amd::HostQueue* queue = nullptr;
+1 -1
Näytä tiedosto
@@ -659,7 +659,7 @@ KernelBlitManager::KernelBlitManager(VirtualGPU& gpu, Setup setup)
: DmaBlitManager(gpu, setup),
program_(NULL),
xferBufferSize_(0),
lockXferOps_("Transfer Ops Lock", true) {
lockXferOps_(true) /* Transfer Ops Lock */ {
for (uint i = 0; i < BlitTotal; ++i) {
kernels_[i] = NULL;
}
+7 -7
Näytä tiedosto
@@ -803,13 +803,13 @@ Device::ScopedLockVgpus::~ScopedLockVgpus() {
Device::Device()
: NullDevice(),
numOfVgpus_(0),
lockAsyncOps_("Device Async Ops Lock", true),
lockForInitHeap_("Initialization of Heap Resource", true),
lockPAL_("PAL Ops Lock", true),
vgpusAccess_("Virtual GPU List Ops Lock", true),
scratchAlloc_("Scratch Allocation Lock", true),
mapCacheOps_("Map Cache Lock", true),
lockResourceOps_("Resource List Ops Lock", true),
lockAsyncOps_(true), /* Device Async Ops Lock */
lockForInitHeap_(true), /* Initialization of Heap Resource */
lockPAL_(true), /* PAL Ops Lock */
vgpusAccess_(true), /* Virtual GPU List Ops Lock */
scratchAlloc_(true), /* Scratch Allocation Lock */
mapCacheOps_(true), /* Map Cache Lock */
lockResourceOps_(true), /* Resource List Ops Lock */
xferRead_(nullptr),
mapCache_(nullptr),
resourceCache_(nullptr),
+1 -1
Näytä tiedosto
@@ -259,7 +259,7 @@ class Device : public NullDevice {
amd::Monitor queue_lock_; //!< Queue lock for access
AqlPacketMgmt aql_packet_mgmt_; //!< AQL packets management class for debugger support
QueueRecycleInfo() : counter_(1), engineType_(Pal::EngineTypeCompute), index_(0),
queue_lock_("Queue lock for sharing", true) {}
queue_lock_(true) /* Queue lock for sharing */ {}
//! Returns the aql packet list
uintptr_t AqlPacketList() const {
+1 -1
Näytä tiedosto
@@ -579,7 +579,7 @@ class ResourceCache : public amd::HeapObject {
public:
//! Default constructor
ResourceCache(Device* device, size_t cacheSizeLimit)
: lockCacheOps_("PAL resource cache", true),
: lockCacheOps_(true), /* PAL resource cache */
cacheSize_(0),
lclCacheSize_(0),
persistentCacheSize_(0),
+1 -1
Näytä tiedosto
@@ -872,7 +872,7 @@ KernelBlitManager::KernelBlitManager(VirtualGPU& gpu, Setup setup)
: DmaBlitManager(gpu, setup),
program_(nullptr),
xferBufferSize_(0),
lockXferOps_("Transfer Ops Lock", true) {
lockXferOps_(true) /* Transfer Ops Lock*/ {
for (uint i = 0; i < BlitTotal; ++i) {
kernels_[i] = nullptr;
}
+3 -2
Näytä tiedosto
@@ -181,7 +181,7 @@ Device::Device(hsa_agent_t bkendDevice)
, xferRead_(nullptr)
, xferWrite_(nullptr)
, freeMem_(0)
, vgpusAccess_("Virtual GPU List Ops Lock", true)
, vgpusAccess_(true) /* Virtual GPU List Ops Lock */
, hsa_exclusive_gpu_access_(false)
, queuePool_(QueuePriority::Total)
, coopHostcallBuffer_(nullptr)
@@ -809,7 +809,8 @@ bool Device::create() {
return false;
}
mapCacheOps_ = new amd::Monitor("Map Cache Lock", true);
// Map Cache Lock
mapCacheOps_ = new amd::Monitor(true);
if (nullptr == mapCacheOps_) {
return false;
}
+1 -1
Näytä tiedosto
@@ -98,7 +98,7 @@ public:
ProfilingSignal()
: ts_(nullptr)
, engine_(HwQueueEngine::Compute)
, lock_("Signal Ops Lock", true)
, lock_(true) /* Signal Ops Lock */
, isPacketDispatch_(false)
{
signal_.handle = 0;
+1 -1
Näytä tiedosto
@@ -124,7 +124,7 @@ class Timestamp : public amd::ReferenceCountedObject {
, command_(command)
, parsedCommand_(nullptr)
, callback_signal_(hsa_signal_t{})
, lock_("Timestamp lock", true) {}
, lock_(true) /* Timestamp lock */ {}
~Timestamp() {}
+2 -2
Näytä tiedosto
@@ -96,7 +96,7 @@ Memory::Memory(Context& context, Type type, Flags flags, size_t size, void* svmP
svmHostAddress_(svmPtr),
resOffset_(0),
flagsEx_(0),
lockMemoryOps_("Memory Ops Lock", true) {
lockMemoryOps_(true) /* Memory Ops Lock */ {
svmPtrCommited_ = (flags & CL_MEM_SVM_FINE_GRAIN_BUFFER) ? true : false;
canBeCached_ = true;
}
@@ -120,7 +120,7 @@ Memory::Memory(Memory& parent, Flags flags, size_t origin, size_t size, Type typ
svmHostAddress_(parent.getSvmPtr()),
resOffset_(0),
flagsEx_(0),
lockMemoryOps_("Memory Ops Lock", true) {
lockMemoryOps_(true) /* Memory Ops Lock */ {
svmPtrCommited_ = parent.isSvmPtrCommited();
canBeCached_ = true;
parent_->retain();
+1 -1
Näytä tiedosto
@@ -195,7 +195,7 @@ struct Coord3D {
template <class T>
class SysmemPool {
public:
SysmemPool(): chunk_access_("Sysmem Pool Lock", true) {}
SysmemPool(): chunk_access_(true) /* Sysmem Pool Lock */ {}
~SysmemPool() {
// Release current chunk
if (chunks_.size() == 1) {
+2 -2
Näytä tiedosto
@@ -137,7 +137,7 @@ class Program : public RuntimeObject {
language_(language),
symbolTable_(NULL),
programLog_(),
programLock_("Program lock", true) {
programLock_(true) /* Program lock */ {
for (auto i = 0; i != numHeaders; ++i) {
headers_.emplace_back(headers[i]);
headerNames_.emplace_back(headerNames[i]);
@@ -148,7 +148,7 @@ class Program : public RuntimeObject {
Program(Context& context, Language language = Binary)
: context_(context), language_(language),
symbolTable_(NULL),
programLock_("Program lock", true) {}
programLock_(true) /* Program lock */ {}
//! Returns context, associated with the current program.
const Context& context() const { return context_(); }
+2 -11
Näytä tiedosto
@@ -33,17 +33,8 @@ MonitorBase::~MonitorBase() {}
namespace legacy_monitor {
Monitor::Monitor(const char* name, bool recursive)
: contendersList_(0), onDeck_(0), waitersList_(NULL), owner_(NULL), recursive_(recursive) {
if (name == NULL) {
const char unknownName[] = "@unknown@";
assert(sizeof(unknownName) < sizeof(name_) && "just checking");
::strncpy(name_, unknownName, sizeof(name_) - 1);
} else {
::strncpy(name_, name, sizeof(name_) - 1);
}
name_[sizeof(name_) - 1] = '\0';
}
Monitor::Monitor(bool recursive)
: contendersList_(0), onDeck_(0), waitersList_(NULL), owner_(NULL), recursive_(recursive) {}
bool Monitor::trySpinLock() {
if (tryLock()) {
+5 -25
Näytä tiedosto
@@ -80,7 +80,6 @@ public:
virtual void wait() = 0;
virtual void notify() = 0;
virtual void notifyAll() = 0;
virtual const char* name() const = 0;
};
namespace legacy_monitor {
@@ -97,8 +96,6 @@ class Monitor final: public HeapObject, public MonitorBase {
* and main lock.
*/
std::atomic_intptr_t contendersList_;
//! The Mutex's name
char name_[64];
//! Semaphore of the next thread to contend for the lock.
std::atomic_intptr_t onDeck_;
@@ -135,7 +132,7 @@ class Monitor final: public HeapObject, public MonitorBase {
void setOwner(Thread* thread) { owner_ = thread; }
public:
explicit Monitor(const char* name = NULL, bool recursive = false);
explicit Monitor(bool recursive = false);
~Monitor() {}
//! Try to acquire the lock, return true if successful.
@@ -165,9 +162,6 @@ class Monitor final: public HeapObject, public MonitorBase {
* \note The monitor must be owned before calling notifyAll().
*/
void notifyAll();
//! Return this lock's name.
const char* name() const { return name_; }
};
@@ -176,17 +170,8 @@ class Monitor final: public HeapObject, public MonitorBase {
namespace mutex_monitor {
class Monitor final: public HeapObject, public MonitorBase {
public:
explicit Monitor(const char* name = nullptr, bool recursive = false)
explicit Monitor(bool recursive = false)
: recursive_(recursive) {
if (name == NULL) {
const char unknownName[] = "@unknown@";
assert(sizeof(unknownName) < sizeof(name_) && "just checking");
::strncpy(name_, unknownName, sizeof(name_) - 1);
} else {
::strncpy(name_, name, sizeof(name_) - 1);
}
name_[sizeof(name_) - 1] = '\0';
if (recursive)
new (&rec_mutex_) std::recursive_mutex();
else
@@ -244,16 +229,12 @@ class Monitor final: public HeapObject, public MonitorBase {
*/
void notifyAll() { cv_.notify_all(); }
//! Return this lock's name.
const char* name() const { return name_; }
private:
union {
std::mutex mutex_;
std::recursive_mutex rec_mutex_;
};
std::condition_variable cv_; //!< The condition variable for sync on the mutex
char name_[64]; //!< The mutex's name
const bool recursive_; //!< True if this is a recursive mutex, false otherwise.
};
} // namespace mutex_monitor
@@ -261,12 +242,12 @@ class Monitor final: public HeapObject, public MonitorBase {
// Monitor API wrapper to user
class Monitor {
public:
explicit Monitor(const char* name = nullptr, bool recursive = false) {
explicit Monitor(bool recursive = false) {
if (DEBUG_CLR_USE_STDMUTEX_IN_AMD_MONITOR) {
monitor_ = new mutex_monitor::Monitor(name, recursive);
monitor_ = new mutex_monitor::Monitor(recursive);
}
else {
monitor_ = new legacy_monitor::Monitor(name, recursive);
monitor_ = new legacy_monitor::Monitor(recursive);
}
}
inline ~Monitor() { delete monitor_; };
@@ -276,7 +257,6 @@ public:
inline void wait() { monitor_->wait(); }
inline void notify() { monitor_->notify(); }
inline void notifyAll() { monitor_->notifyAll(); }
inline const char* name() { return monitor_->name(); }
private:
MonitorBase* monitor_;