mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
fix(ocl): Fix callbacks for nested API calls
Prevent from tracing nested API calls (case when similar call is invoked in tracing callback) in OCL. Signed-off-by: Kacper Nowak <kacper.nowak@intel.com> Related-To: NEO-7958
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4e91c4b08f
commit
4ec249cc39
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace HostSideTracing {
|
namespace HostSideTracing {
|
||||||
|
|
||||||
@@ -28,10 +27,15 @@ namespace HostSideTracing {
|
|||||||
#define TRACING_ZERO_CLIENT_COUNTER(state) ((state) & (HostSideTracing::TRACING_STATE_ENABLED_BIT | HostSideTracing::TRACING_STATE_LOCKED_BIT))
|
#define TRACING_ZERO_CLIENT_COUNTER(state) ((state) & (HostSideTracing::TRACING_STATE_ENABLED_BIT | HostSideTracing::TRACING_STATE_LOCKED_BIT))
|
||||||
#define TRACING_GET_CLIENT_COUNTER(state) ((state) & (~(HostSideTracing::TRACING_STATE_ENABLED_BIT | HostSideTracing::TRACING_STATE_LOCKED_BIT)))
|
#define TRACING_GET_CLIENT_COUNTER(state) ((state) & (~(HostSideTracing::TRACING_STATE_ENABLED_BIT | HostSideTracing::TRACING_STATE_LOCKED_BIT)))
|
||||||
|
|
||||||
|
inline thread_local bool tracingInProgress = false;
|
||||||
|
|
||||||
#define TRACING_ENTER(name, ...) \
|
#define TRACING_ENTER(name, ...) \
|
||||||
bool isHostSideTracingEnabled_##name = false; \
|
bool isHostSideTracingEnabled_##name = false; \
|
||||||
|
bool currentlyTracedCall = false; \
|
||||||
HostSideTracing::name##Tracer tracer_##name; \
|
HostSideTracing::name##Tracer tracer_##name; \
|
||||||
if (TRACING_GET_ENABLED_BIT(HostSideTracing::tracingState.load(std::memory_order_acquire))) { \
|
if ((false == HostSideTracing::tracingInProgress) && TRACING_GET_ENABLED_BIT(HostSideTracing::tracingState.load(std::memory_order_acquire))) { \
|
||||||
|
HostSideTracing::tracingInProgress = true; \
|
||||||
|
currentlyTracedCall = true; \
|
||||||
isHostSideTracingEnabled_##name = HostSideTracing::addTracingClient(); \
|
isHostSideTracingEnabled_##name = HostSideTracing::addTracingClient(); \
|
||||||
if (isHostSideTracingEnabled_##name) { \
|
if (isHostSideTracingEnabled_##name) { \
|
||||||
tracer_##name.enter(__VA_ARGS__); \
|
tracer_##name.enter(__VA_ARGS__); \
|
||||||
@@ -39,9 +43,13 @@ namespace HostSideTracing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define TRACING_EXIT(name, ...) \
|
#define TRACING_EXIT(name, ...) \
|
||||||
|
if (currentlyTracedCall) { \
|
||||||
if (isHostSideTracingEnabled_##name) { \
|
if (isHostSideTracingEnabled_##name) { \
|
||||||
tracer_##name.exit(__VA_ARGS__); \
|
tracer_##name.exit(__VA_ARGS__); \
|
||||||
HostSideTracing::removeTracingClient(); \
|
HostSideTracing::removeTracingClient(); \
|
||||||
|
} \
|
||||||
|
HostSideTracing::tracingInProgress = false; \
|
||||||
|
currentlyTracedCall = false; \
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum _tracing_notify_state_t {
|
typedef enum _tracing_notify_state_t {
|
||||||
|
|||||||
Reference in New Issue
Block a user