Only check lock if counter collection is used
Only check the lock if counter collection is being
attempted by the profiler. Not when it is loaded.
SWDEV-474455
Change-Id: Ie14de3c8db57e0cbd279ffca51c333a375ca8654
Signed-off-by: Benjamin Welton <bewelton@amd.com>
[ROCm/rocprofiler commit: 0be3e07388]
Cette révision appartient à :
révisé par
Saurabh Verma
Parent
1c897ae070
révision
9f222d2fd0
@@ -229,6 +229,9 @@
|
||||
<metric name="TOTAL_16_OPS" expr=(SQ_INSTS_VALU_FMA_F16*2+SQ_INSTS_VALU_ADD_F16+SQ_INSTS_VALU_MUL_F16+SQ_INSTS_VALU_TRANS_F16)*64+((SQ_INSTS_VALU_MFMA_MOPS_F16+SQ_INSTS_VALU_MFMA_MOPS_BF16)*512) descr="The number of 16 bits OPS executed"></metric>
|
||||
<metric name="TOTAL_32_OPS" expr=(SQ_INSTS_VALU_FMA_F32*2+SQ_INSTS_VALU_INT32+SQ_INSTS_VALU_ADD_F32+SQ_INSTS_VALU_MUL_F32+SQ_INSTS_VALU_TRANS_F32)*64+(SQ_INSTS_VALU_MFMA_MOPS_F32*512) descr="The number of 32 bits OPS executed"></metric>
|
||||
<metric name="TOTAL_64_OPS" expr=(SQ_INSTS_VALU_FMA_F64*2+SQ_INSTS_VALU_INT64+SQ_INSTS_VALU_ADD_F64+SQ_INSTS_VALU_MUL_F64)*64+(SQ_INSTS_VALU_MFMA_MOPS_F64*512) descr="The number of 64 bits OPS executed"></metric>
|
||||
<metric name="ACTIVE_CYCLES" expr=GRBM_GUI_ACTIVE descr="Active Cycles"></metric>
|
||||
<metric name="ELAPSED_CYCLES" expr=GRBM_COUNT descr="Elapsed Cycles"></metric>
|
||||
<metric name="ACTIVE_WAVES" expr=SQ_WAVES descr="Active Waves"></metric>
|
||||
|
||||
<metric name="AggSysCycles" expr=GRBM_GUI_ACTIVE*CU_NUM descr="Unit: cycles"></metric>
|
||||
## IP Block Utilization Metrics
|
||||
@@ -482,6 +485,9 @@
|
||||
<metric name="TOTAL_16_OPS" expr=(SQ_INSTS_VALU_FMA_F16*2+SQ_INSTS_VALU_ADD_F16+SQ_INSTS_VALU_MUL_F16+SQ_INSTS_VALU_TRANS_F16)*64+((SQ_INSTS_VALU_MFMA_MOPS_F16+SQ_INSTS_VALU_MFMA_MOPS_BF16)*512) descr="The number of 16 bits OPS executed"></metric>
|
||||
<metric name="TOTAL_32_OPS" expr=(SQ_INSTS_VALU_FMA_F32*2+SQ_INSTS_VALU_INT32+SQ_INSTS_VALU_ADD_F32+SQ_INSTS_VALU_MUL_F32+SQ_INSTS_VALU_TRANS_F32)*64+(SQ_INSTS_VALU_MFMA_MOPS_F32*512) descr="The number of 32 bits OPS executed"></metric>
|
||||
<metric name="TOTAL_64_OPS" expr=(SQ_INSTS_VALU_FMA_F64*2+SQ_INSTS_VALU_INT64+SQ_INSTS_VALU_ADD_F64+SQ_INSTS_VALU_MUL_F64)*64+(SQ_INSTS_VALU_MFMA_MOPS_F64*512) descr="The number of 64 bits OPS executed"></metric>
|
||||
<metric name="ACTIVE_CYCLES" expr=GRBM_GUI_ACTIVE/XCC_NUM descr="Active Cycles"></metric>
|
||||
<metric name="ELAPSED_CYCLES" expr=GRBM_COUNT/XCC_NUM descr="Elapsed Cycles"></metric>
|
||||
<metric name="ACTIVE_WAVES" expr=SQ_WAVES descr="Active Waves"></metric>
|
||||
</gfx940_expr>
|
||||
|
||||
<gfx10_expr>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include <sstream>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include "util/exception.h"
|
||||
#include "profiling_lock.h"
|
||||
#include <stdexcept>
|
||||
|
||||
#define ROCPROFILER_LOCK_FILE "/tmp/rocprofiler_process.lock"
|
||||
#define ROCPROFILER_PID_FILE "/tmp/rocprofiler.pid"
|
||||
@@ -67,12 +67,12 @@ bool check_process_exists(int pid) {
|
||||
}
|
||||
|
||||
void terminate_current_profiler_instance() {
|
||||
EXC_RAISING(
|
||||
0,
|
||||
"\nA profiling instance already exists! Multiple profiling instances are not "
|
||||
"allowed.\nCheck "
|
||||
<< ROCPROFILER_PID_FILE
|
||||
<< " and kill the process, delete this .pid file and try again.\nTerminating ...\n");
|
||||
std::stringstream oss;
|
||||
oss << "\nA profiling instance already exists! Multiple profiling instances are not "
|
||||
<< "allowed.\nCheck " << ROCPROFILER_PID_FILE
|
||||
<< " and kill the process, delete this .pid file and try again.\nTerminating "
|
||||
"...\n";
|
||||
throw std::runtime_error(oss.str());
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,8 @@ void ProfilingLock::Lock(LockMode mode) {
|
||||
bool is_standalone_mode_v1 = check_standalone_mode() && (mode == PROFILER_V1_LOCK);
|
||||
|
||||
ProfilingLock* profiling_lock = Instance();
|
||||
// Check if we have already locked in this process
|
||||
if (profiling_lock->already_locked.exchange(true)) return;
|
||||
if (file_exists(profiling_lock->pid_file)) {
|
||||
profiling_lock->lock = acquire_lock(profiling_lock->lock_file);
|
||||
if (profiling_lock->lock < 1) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
#ifndef _SRC_CORE_PROFILING_LOCK_H
|
||||
#define _SRC_CORE_PROFILING_LOCK_H
|
||||
#include <atomic>
|
||||
|
||||
enum LockMode{
|
||||
PROFILER_V1_LOCK,
|
||||
@@ -18,6 +19,7 @@ private:
|
||||
|
||||
const char *lock_file;
|
||||
const char *pid_file;
|
||||
std::atomic<bool> already_locked{false};
|
||||
int lock;
|
||||
};
|
||||
|
||||
|
||||
@@ -394,7 +394,6 @@ ROCPROFILER_EXPORT extern const uint32_t HSA_AMD_TOOL_PRIORITY = 25;
|
||||
PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count,
|
||||
const char* const* failed_tool_names) {
|
||||
ONLOAD_TRACE_BEG();
|
||||
ProfilingLock::Lock(PROFILER_V1_LOCK);
|
||||
rocprofiler::SaveHsaApi(table);
|
||||
rocprofiler::ProxyQueue::InitFactory();
|
||||
|
||||
@@ -488,6 +487,7 @@ PUBLIC_API hsa_status_t rocprofiler_open(hsa_agent_t agent, rocprofiler_feature_
|
||||
uint32_t feature_count, rocprofiler_t** handle,
|
||||
uint32_t mode, rocprofiler_properties_t* properties) {
|
||||
API_METHOD_PREFIX
|
||||
ProfilingLock::Lock(PROFILER_V1_LOCK);
|
||||
rocprofiler::util::HsaRsrcFactory* hsa_rsrc = &rocprofiler::util::HsaRsrcFactory::Instance();
|
||||
const rocprofiler::util::AgentInfo* agent_info = hsa_rsrc->GetAgentInfo(agent);
|
||||
if (agent_info == NULL) {
|
||||
@@ -673,6 +673,7 @@ rocprofiler_pool_open(hsa_agent_t agent, // GPU handle
|
||||
rocprofiler_pool_properties_t* properties) // pool properties
|
||||
{
|
||||
API_METHOD_PREFIX
|
||||
ProfilingLock::Lock(PROFILER_V1_LOCK);
|
||||
rocprofiler::util::HsaRsrcFactory* hsa_rsrc = &rocprofiler::util::HsaRsrcFactory::Instance();
|
||||
const rocprofiler::util::AgentInfo* agent_info = hsa_rsrc->GetAgentInfo(agent);
|
||||
if (agent_info == NULL) {
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur