Skip to content

Commit 41507e5

Browse files
committed
add comment
1 parent b84beb3 commit 41507e5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/gc/ExecutionEngine/GPURuntime/ocl/GpuOclRuntime.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ void DisableProfiling();
2727

2828
class GPUKernelTracer {
2929
public:
30-
static std::shared_ptr<GPUKernelTracer> getInstance() {
31-
std::shared_ptr<GPUKernelTracer> instance =
32-
std::make_shared<GPUKernelTracer>();
30+
static std::unique_ptr<GPUKernelTracer> getInstance() {
31+
std::unique_ptr<GPUKernelTracer> instance =
32+
std::make_unique<GPUKernelTracer>();
3333
return instance;
3434
}
3535

@@ -44,7 +44,13 @@ class GPUKernelTracer {
4444
}
4545
};
4646

47-
static std::shared_ptr<GPUKernelTracer> tracer = GPUKernelTracer::getInstance();
47+
/*
48+
Create a tracer with a static life cycle to trace all device kernel execution
49+
during the program. The unique pointer is used to manage class creation and
50+
recycling. When the pointer is destroyed, the tracer's destructor will be called
51+
and print the profile result.
52+
*/
53+
static std::unique_ptr<GPUKernelTracer> tracer = GPUKernelTracer::getInstance();
4854

4955
#endif
5056

0 commit comments

Comments
 (0)