timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::component::hip_event Struct Reference

Records the time interval between two points in a HIP stream. Less accurate than 'cupti_activity' for kernel timing but does not require linking to the HIP driver. More...

#include "timemory/components/hip/components.hpp"

+ Collaboration diagram for tim::component::hip_event:

Classes

struct  explicit_streams_only
 
struct  marker
 

Public Types

using value_type = float
 
using base_type = base< hip_event, value_type >
 
using marker_list_t = std::vector< marker >
 
using storage_type = empty_storage
 

Public Member Functions

 hip_event (hip::stream_t _stream)
 
float get_display () const
 
float get () const
 
void store (explicit_streams_only, bool _v)
 
void start ()
 
void stop ()
 
void sync ()
 
void set_stream (hip::stream_t _stream)
 
auto get_stream ()
 
void mark_begin ()
 
void mark_end ()
 
void mark_begin (hip::stream_t _stream)
 
void mark_end (hip::stream_t _stream)
 

Static Public Member Functions

static std::string label ()
 
static std::string description ()
 
static value_type record ()
 
static uint64_t & get_batched_marker_size ()
 
template<typename... Args>
static opaque get_opaque (Args &&...)
 

Protected Member Functions

void append_marker_list (const uint64_t nsize)
 

Detailed Description

Records the time interval between two points in a HIP stream. Less accurate than 'cupti_activity' for kernel timing but does not require linking to the HIP driver.

Definition at line 64 of file components.hpp.


Class Documentation

◆ tim::component::hip_event::explicit_streams_only

struct tim::component::hip_event::explicit_streams_only

Definition at line 123 of file components.hpp.

+ Collaboration diagram for tim::component::hip_event::explicit_streams_only:

Member Typedef Documentation

◆ base_type

◆ marker_list_t

Definition at line 107 of file components.hpp.

◆ storage_type

Definition at line 66 of file declaration.hpp.

◆ value_type

Definition at line 105 of file components.hpp.

Constructor & Destructor Documentation

◆ hip_event()

tim::component::hip_event::hip_event ( hip::stream_t  _stream)
inlineexplicit

Definition at line 129 of file components.hpp.

130 : m_stream(_stream)
131 {}

Member Function Documentation

◆ append_marker_list()

void tim::component::hip_event::append_marker_list ( const uint64_t  nsize)
inlineprotected

Definition at line 206 of file components.hpp.

207 {
208 m_markers.reserve(m_markers.size() + nsize);
209 for(uint64_t i = 0; i < nsize; ++i)
210 m_markers.emplace_back(marker{});
211 }

Referenced by mark_begin().

◆ description()

static std::string tim::component::hip_event::description ( )
inlinestatic

Definition at line 110 of file components.hpp.

111 {
112 return "Records the time interval between two points in a HIP stream. Less "
113 "accurate than 'roctracer' for kernel timing";
114 }

◆ get()

float tim::component::hip_event::get ( ) const
inline

Definition at line 135 of file components.hpp.

135{ return load() / static_cast<float>(base_type::get_unit()); }
static int64_t get_unit()

References tim::component::base< Tp, Value >::get_unit(), and tim::component::base< hip_event, float >::load().

Referenced by get_display().

◆ get_batched_marker_size()

static uint64_t & tim::component::hip_event::get_batched_marker_size ( )
inlinestatic

Definition at line 117 of file components.hpp.

118 {
119 static uint64_t _instance = settings::cuda_event_batch_size();
120 return _instance;
121 }
cuda_event_batch_size
Definition: settings.cpp:1719

References tim::cuda_event_batch_size.

◆ get_display()

float tim::component::hip_event::get_display ( ) const
inline

Definition at line 133 of file components.hpp.

133{ return get(); }

References get().

◆ get_opaque()

template<typename... Args>
static opaque tim::component::empty_base::get_opaque ( Args &&  ...)
inlinestaticinherited

Definition at line 72 of file declaration.hpp.

73 {
74 return opaque{};
75 }

◆ get_stream()

auto tim::component::hip_event::get_stream ( )
inline

Definition at line 181 of file components.hpp.

181{ return m_stream; }

◆ label()

static std::string tim::component::hip_event::label ( )
inlinestatic

Definition at line 109 of file components.hpp.

109{ return "hip_event"; }

◆ mark_begin() [1/2]

void tim::component::hip_event::mark_begin ( )
inline

Definition at line 183 of file components.hpp.

184 {
185 m_markers_synced = false;
186 m_current_marker = m_num_markers++;
187 if(m_current_marker >= m_markers.size())
188 append_marker_list(std::max<uint64_t>(m_marker_batch_size, 1));
189 m_markers[m_current_marker].start(m_stream);
190 }
void append_marker_list(const uint64_t nsize)
Definition: components.hpp:206

References append_marker_list().

◆ mark_begin() [2/2]

void tim::component::hip_event::mark_begin ( hip::stream_t  _stream)
inline

Definition at line 194 of file components.hpp.

195 {
196 m_markers_synced = false;
197 m_current_marker = m_num_markers++;
198 if(m_current_marker >= m_markers.size())
199 append_marker_list(std::max<uint64_t>(m_marker_batch_size, 1));
200 m_markers[m_current_marker].start(_stream);
201 }

References append_marker_list().

◆ mark_end() [1/2]

void tim::component::hip_event::mark_end ( )
inline

Definition at line 192 of file components.hpp.

192{ m_markers[m_current_marker].stop(m_stream); }

◆ mark_end() [2/2]

void tim::component::hip_event::mark_end ( hip::stream_t  _stream)
inline

Definition at line 203 of file components.hpp.

203{ m_markers[m_current_marker].stop(_stream); }

◆ record()

static value_type tim::component::hip_event::record ( )
inlinestatic

Definition at line 115 of file components.hpp.

115{ return 0.0f; }

◆ set_stream()

void tim::component::hip_event::set_stream ( hip::stream_t  _stream)
inline

Definition at line 180 of file components.hpp.

180{ m_stream = _stream; }

◆ start()

void tim::component::hip_event::start ( )
inline

Definition at line 139 of file components.hpp.

140 {
141 if(!m_explicit_only || m_stream != hip::default_stream_v)
142 {
143 m_global_synced = false;
144 m_global.start(m_stream);
145 }
146 }
void start(hip::stream_t &stream)
Definition: components.hpp:77

References tim::component::hip_event::marker::start().

◆ stop()

void tim::component::hip_event::stop ( )
inline

Definition at line 148 of file components.hpp.

149 {
150 for(uint64_t i = 0; i < m_num_markers; ++i)
151 m_markers[i].stop(m_stream);
152 if(m_current_marker == 0 && m_num_markers == 0)
153 m_global.stop(m_stream);
154 sync();
155 }
void stop(hip::stream_t &stream)
Definition: components.hpp:86

References stop(), tim::component::hip_event::marker::stop(), and sync().

Referenced by stop().

◆ store()

void tim::component::hip_event::store ( explicit_streams_only  ,
bool  _v 
)
inline

Definition at line 137 of file components.hpp.

137{ m_explicit_only = _v; }

◆ sync()

void tim::component::hip_event::sync ( )
inline

Definition at line 157 of file components.hpp.

158 {
159 if(m_current_marker == 0 && m_num_markers == 0)
160 {
161 if(!m_global_synced)
162 {
163 float tmp = m_global.sync();
164 m_global_synced = true;
165 accum += tmp;
166 value = tmp;
167 }
168 }
169 else if(m_current_marker > m_synced_markers)
170 {
171 float tmp = 0.0;
172 for(uint64_t i = m_synced_markers; i < m_num_markers; ++i, ++m_synced_markers)
173 tmp += m_markers[i].sync();
174 m_markers_synced = true;
175 accum += tmp;
176 value = tmp;
177 }
178 }

References tim::component::hip_event::marker::sync(), and sync().

Referenced by stop(), and sync().


The documentation for this struct was generated from the following file: