Blender  V3.3
queue.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #include "device/queue.h"
5 
6 #include "util/algorithm.h"
7 #include "util/log.h"
8 #include "util/time.h"
9 
10 #include <iomanip>
11 
13 
15  : device(device), last_kernels_enqueued_(0), last_sync_time_(0.0)
16 {
17  DCHECK_NE(device, nullptr);
18 }
19 
21 {
23  /* Print kernel execution times sorted by time. */
25  for (const auto &stat : stats_kernel_time_) {
26  stats_sorted.push_back(stat);
27  }
28 
29  sort(stats_sorted.begin(),
30  stats_sorted.end(),
31  [](const pair<DeviceKernelMask, double> &a, const pair<DeviceKernelMask, double> &b) {
32  return a.second > b.second;
33  });
34 
35  VLOG_DEVICE_STATS << "GPU queue stats:";
36  for (const auto &[mask, time] : stats_sorted) {
37  VLOG_DEVICE_STATS << " " << std::setfill(' ') << std::setw(10) << std::fixed
38  << std::setprecision(5) << std::right << time
40  }
41  }
42 }
43 
45 {
48  }
49 
51 }
52 
54 {
56  VLOG_DEVICE_STATS << "GPU queue launch " << device_kernel_as_string(kernel) << ", work_size "
57  << work_size;
58  }
59 
61 }
62 
64 {
66  const double new_time = time_dt();
67  const double elapsed_time = new_time - last_sync_time_;
68  VLOG_DEVICE_STATS << "GPU queue synchronize, elapsed " << std::setw(10) << elapsed_time << "s";
69 
71 
72  last_sync_time_ = new_time;
73  }
74 
76 }
77 
79 {
81 }
82 
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
void sort(btMatrix3x3 &U, btVector3 &sigma, btMatrix3x3 &V, int t)
Helper function of 3X3 SVD for sorting singular values.
void debug_enqueue(DeviceKernel kernel, const int work_size)
Definition: queue.cpp:53
double last_sync_time_
Definition: device/queue.h:172
DeviceKernelMask last_kernels_enqueued_
Definition: device/queue.h:170
void debug_synchronize()
Definition: queue.cpp:63
Device * device
Definition: device/queue.h:157
map< DeviceKernelMask, double > stats_kernel_time_
Definition: device/queue.h:174
string debug_active_kernels()
Definition: queue.cpp:78
virtual ~DeviceQueue()
Definition: queue.cpp:20
void debug_init_execution()
Definition: queue.cpp:44
DeviceQueue(Device *device)
Definition: queue.cpp:14
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
double time
string device_kernel_mask_as_string(DeviceKernelMask mask)
CCL_NAMESPACE_BEGIN const char * device_kernel_as_string(DeviceKernel kernel)
SyclQueue void void size_t num_bytes SyclQueue void const char void *memory_device_pointer KernelContext int kernel
ccl_gpu_kernel_postfix ccl_global const int ccl_global float const int work_size
DeviceKernel
#define VLOG_DEVICE_STATS_IS_ON
Definition: log.h:84
#define VLOG_DEVICE_STATS
Definition: log.h:83
#define DCHECK_NE(a, b)
Definition: log.h:63
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
unsigned __int64 uint64_t
Definition: stdint.h:90
CCL_NAMESPACE_BEGIN double time_dt()
Definition: time.cpp:35