HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CE_Tracing.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CE_Tracing.h ( CE Library, C++)
7  *
8  * COMMENTS: Tracy OpenCL tracing macros.
9  */
10 
11 #ifndef __CE_Tracing__
12 #define __CE_Tracing__
13 
14 #include <UT/UT_Tracing.h>
15 
16 #ifdef TRACY_ENABLE
17 
18 #include <tracy/TracyOpenCL.hpp>
19 
20 typedef tracy::OpenCLCtx *ceTraceCtx;
21 
22 #define ceTraceContext(c, x) TracyCLContext(c, x)
23 #define ceTraceDestroy(c) TracyCLDestroy(c)
24 
25 #define ceTraceZoneSetEvent(e) TracyCLZoneSetEvent(e)
26 #define ceTraceCollect(c) if (utTraceFlag(CL_MEMORY) || utTraceFlag(CL_KERNELS)) TracyCLCollect(c)
27 
28 #define ceTraceZoneKernel(c, x) TracyCLNamedZone(c, __tracy_gpu_zone, x, utTraceFlag(CL_KERNELS))
29 #define ceTraceZoneKernelC(c, x, y) TracyCLNamedZoneC(c, __tracy_gpu_zone, x, y, utTraceFlag(CL_KERNELS))
30 #define ceTraceZoneKernelTransient(c, x) TracyCLZoneTransient(c, __tracy_gpu_zone, x, utTraceFlag(CL_KERNELS))
31 #define ceTraceZoneMem(c, x) TracyCLNamedZone(c, __tracy_gpu_zone, x, utTraceFlag(CL_MEMORY))
32 #define ceTraceZoneMemC(c, x, y) TracyCLNamedZoneC(c, __tracy_gpu_zone, x, y, utTraceFlag(CL_MEMORY))
33 
34 #ifdef TRACY_ON_DEMAND
35 #define ceTraceMemEvent nullptr,(utTraceFlag(CL_MEMORY) && utTraceIsConnected ? &event : nullptr)
36 #else
37 #define ceTraceMemEvent nullptr,&event
38 #endif
39 
40 #ifdef TRACY_HAS_CALLSTACK
41 
42 #define ceTraceZoneKernelS(c, x, d) TracyCLNamedZoneS(c, __tracy_gpu_zone, x, d, utTraceFlag(CL_KERNELS))
43 #define ceTraceZoneKernelCS(c, x, y, d) TracyCLNamedZoneS(c, __tracy_gpu_zone, x, d, utTraceFlag(CL_KERNELS))
44 #define ceTraceZoneKernelTransientS(c, x, d) TracyCLZoneTransientS(c, __tracy_gpu_zone, x, d, utTraceFlag(CL_KERNELS))
45 #define ceTraceZoneMemS(c, x, d) TracyCLNamedZoneCS(c, __tracy_gpu_zone, x, d, utTraceFlag(CL_MEMORY))
46 #define ceTraceZoneMemCS(c, x, y, d) TracyCLNamedZoneCS(c, __tracy_gpu_zone, x, y, d, utTraceFlag(CL_MEMORY))
47 
48 #else
49 
50 #define ceTraceZoneKernelS(c, x, d) ceTraceZoneKernel(c, x)
51 #define ceTraceZoneKernelCS(c, x, y, d) ceTraceZoneKernelC(c, x, y)
52 #define ceTraceZoneKernelTransientS(c, x, d) ceTraceZoneKernelTransient(c, x)
53 #define ceTraceZoneMemS(c, x, d) ceTraceZoneMem(c, x)
54 #define ceTraceZoneMemCS(c, x, y, d) ceTraceZoneMemC(c, x, y)
55 #endif
56 
57 #else
58 
59 typedef void *ceTraceCtx;
60 
61 #define ceTraceContext(c, x) nullptr
62 #define ceTraceDestroy(c)
63 
64 #define ceTraceZoneSetEvent(e)
65 #define ceTraceCollect(c)
66 
67 #define ceTraceZoneKernel(c, x)
68 #define ceTraceZoneKernelC(c, x, y)
69 #define ceTraceZoneKernelTransient(c, x)
70 #define ceTraceZoneMem(c, x)
71 #define ceTraceZoneMemC(c, x, y)
72 
73 #define ceTraceMemEvent nullptr,nullptr
74 
75 #define ceTraceZoneKernelS(c, x, d)
76 #define ceTraceZoneKernelCS(c, x, y, d)
77 #define ceTraceZoneKernelTransientS(c, x, d)
78 #define ceTraceZoneMemS(c, x, d)
79 #define ceTraceZoneMemCS(c, x, y, d)
80 
81 #endif
82 
83 
84 #endif
85 
void * ceTraceCtx
Definition: CE_Tracing.h:59