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 ceTraceZoneMem(c, x) TracyCLNamedZone(c, __tracy_gpu_zone, x, utTraceFlag(CL_MEMORY))
31 #define ceTraceZoneMemC(c, x, y) TracyCLNamedZoneC(c, __tracy_gpu_zone, x, y, utTraceFlag(CL_MEMORY))
32 
33 #ifdef TRACY_ON_DEMAND
34 #define ceTraceMemEvent nullptr,(utTraceFlag(CL_MEMORY) && utTraceIsConnected ? &event : nullptr)
35 #else
36 #define ceTraceMemEvent nullptr,&event
37 #endif
38 
39 #ifdef TRACY_HAS_CALLSTACK
40 
41 #define ceTraceZoneKernelS(c, x, d) TracyCLNamedZoneS(c, __tracy_gpu_zone, x, d, utTraceFlag(CL_KERNELS))
42 #define ceTraceZoneKernelCS(c, x, y, d) TracyCLNamedZoneS(c, __tracy_gpu_zone, x, d, utTraceFlag(CL_KERNELS))
43 #define ceTraceZoneMemS(c, x, d) TracyCLNamedZoneCS(c, __tracy_gpu_zone, x, d, utTraceFlag(CL_MEMORY))
44 #define ceTraceZoneMemCS(c, x, y, d) TracyCLNamedZoneCS(c, __tracy_gpu_zone, x, y, d, utTraceFlag(CL_MEMORY))
45 
46 #else
47 
48 #define ceTraceZoneKernelS(c, x, d) ceTraceZoneKernel(c, x)
49 #define ceTraceZoneKernelCS(c, x, y, d) ceTraceZoneKernelC(c, x, y)
50 #define ceTraceZoneMemS(c, x, d) ceTraceZoneMem(c, x)
51 #define ceTraceZoneMemCS(c, x, y, d) ceTraceZoneMemC(c, x, y)
52 #endif
53 
54 #else
55 
56 typedef void *ceTraceCtx;
57 
58 #define ceTraceContext(c, x) nullptr
59 #define ceTraceDestroy(c)
60 
61 #define ceTraceZoneSetEvent(e)
62 #define ceTraceCollect(c)
63 
64 #define ceTraceZoneKernel(c, x)
65 #define ceTraceZoneKernelC(c, x, y)
66 #define ceTraceZoneMem(c, x)
67 #define ceTraceZoneMemC(c, x, y)
68 
69 #define ceTraceMemEvent nullptr,nullptr
70 
71 #define ceTraceZoneKernelS(c, x, d)
72 #define ceTraceZoneKernelCS(c, x, y, d)
73 #define ceTraceZoneMemS(c, x, d)
74 #define ceTraceZoneMemCS(c, x, y, d)
75 
76 #endif
77 
78 
79 #endif
80 
void * ceTraceCtx
Definition: CE_Tracing.h:56