Skip to content

Commit f45c1e7

Browse files
committed
Revert "[SYCL][XPTI] Revisit resource management strategy (intel#4494)"
This reverts commit c91b3b8.
1 parent cae872b commit f45c1e7

File tree

6 files changed

+65
-205
lines changed

6 files changed

+65
-205
lines changed

sycl/source/detail/pi.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,6 @@ static void initializePlugins(std::vector<plugin> &Plugins) {
435435
}
436436

437437
#ifdef XPTI_ENABLE_INSTRUMENTATION
438-
GlobalHandler::instance().getXPTIRegistry().initializeFrameworkOnce();
439-
440438
if (!(xptiTraceEnabled() && !XPTIInitDone))
441439
return;
442440
// Not sure this is the best place to initialize the framework; SYCL runtime

sycl/source/detail/xpti_registry.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#pragma once
1010

11-
#include <mutex>
1211
#include <string>
1312
#include <unordered_set>
1413

@@ -32,12 +31,6 @@ inline constexpr const char *SYCL_PIDEBUGCALL_STREAM_NAME = "sycl.pi.debug";
3231

3332
class XPTIRegistry {
3433
public:
35-
void initializeFrameworkOnce() {
36-
#ifdef XPTI_ENABLE_INSTRUMENTATION
37-
std::call_once(MInitialized, [] { xptiFrameworkInitialize(); });
38-
#endif
39-
}
40-
4134
/// Notifies XPTI subscribers about new stream.
4235
///
4336
/// \param StreamName is a name of newly initialized stream.
@@ -57,13 +50,11 @@ class XPTIRegistry {
5750
for (const auto &StreamName : MActiveStreams) {
5851
xptiFinalize(StreamName.c_str());
5952
}
60-
xptiFrameworkFinalize();
6153
#endif // XPTI_ENABLE_INSTRUMENTATION
6254
}
6355

6456
private:
6557
std::unordered_set<std::string> MActiveStreams;
66-
std::once_flag MInitialized;
6758
};
6859
} // namespace detail
6960
} // namespace sycl

xpti/include/xpti/xpti_trace_framework.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,6 @@
3535

3636
extern "C" {
3737

38-
/// @brief Initializes XPTI framework.
39-
/// @details Initialize XPTI framework resources. Each user of XPTI must call
40-
/// this function prior to any other XPTI API call. It is framework's
41-
/// responsibility to ensure that resources are initialized once. Each call to
42-
/// this function must have corresponding call to xptiFrameworkFinalize() to
43-
/// ensure resources are freed.
44-
XPTI_EXPORT_API void xptiFrameworkInitialize();
45-
46-
/// @brief Deinitializes XPTI framework.
47-
/// @details Call to this function decrements framework's internal reference
48-
/// counter. Once its value is equal to zero, XPTI framework can release
49-
/// resources and unload subscribers.
50-
XPTI_EXPORT_API void xptiFrameworkFinalize();
51-
5238
/// @brief Initialization function that is called when a new stream is generated
5339
/// @details When a runtime or application that uses XPTI instrumentation API
5440
/// starts to generate a new stream, a call to xptiInitialize() must be made to
@@ -428,8 +414,6 @@ XPTI_EXPORT_API void xptiReset();
428414
/// The proxy/stub library does not implement this function.
429415
XPTI_EXPORT_API void xptiForceSetTraceEnabled(bool yesOrNo);
430416

431-
typedef xpti::result_t (*xpti_framework_initialize_t)();
432-
typedef xpti::result_t (*xpti_framework_finalize_t)();
433417
typedef xpti::result_t (*xpti_initialize_t)(const char *, uint32_t, uint32_t,
434418
const char *);
435419
typedef void (*xpti_finalize_t)(const char *);

xpti/include/xpti/xpti_trace_framework.hpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//
88
#pragma once
99

10-
#include <atomic>
1110
#include <cstdint>
1211
#include <memory>
1312
#include <sstream>
@@ -274,20 +273,6 @@ class PlatformHelper {
274273
return false;
275274
}
276275
};
277-
278-
/// This is an implementation of a SpinLock synchronization primitive, that has
279-
/// trivial constructor and destructor.
280-
class SpinLock {
281-
public:
282-
void lock() {
283-
while (MLock.test_and_set(std::memory_order_acquire))
284-
std::this_thread::yield();
285-
}
286-
void unlock() { MLock.clear(std::memory_order_release); }
287-
288-
private:
289-
std::atomic_flag MLock = ATOMIC_FLAG_INIT;
290-
};
291276
} // namespace utils
292277

293278
namespace framework {

0 commit comments

Comments
 (0)