-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move all NVTX infrastructure into core and create DALI domain #2472
Conversation
!build |
CI MESSAGE: [1803789]: BUILD STARTED |
CI MESSAGE: [1803789]: BUILD FAILED |
- libdali_core now provides NVTX ranges functionality - core is responsible for creating one DALI domain - regular DALI code should use DomainTimeRange from core lib - plain TimeRange is still header-only and should be used only for the development Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
!build |
CI MESSAGE: [1803930]: BUILD STARTED |
CI MESSAGE: [1803930]: BUILD PASSED |
dali/operators/reader/reader_op.h
Outdated
@@ -80,7 +81,8 @@ class DataReader : public Operator<Backend> { | |||
// perform the prefetching operation | |||
virtual void Prefetch() { | |||
// We actually prepare the next batch | |||
TimeRange tr("DataReader::Prefetch #" + to_string(curr_batch_producer_), TimeRange::kRed); | |||
DomainTimeRange tr("[DALI] DataReader::Prefetch #" + to_string(curr_batch_producer_), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make them
DomainTimeRange tr("[DALI] DataReader::Prefetch #" + to_string(curr_batch_producer_), | |
DomainTimeRange tr("[DALI][DataReader] Prefetch #" + to_string(curr_batch_producer_), |
and so on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
dali/core/nvtx.cc
Outdated
nvtxEventAttributes_t att = {}; | ||
att.version = NVTX_VERSION; | ||
att.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; | ||
att.colorType = NVTX_COLOR_ARGB; | ||
att.color = rgb | 0xff000000; | ||
att.messageType = NVTX_MESSAGE_TYPE_ASCII; | ||
att.message.ascii = name.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe deduplicate filling the attributes?
But I don't know if it's worth, maybe until it doesn't need to diverge, we can put it in the base class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
!build |
CI MESSAGE: [1805949]: BUILD STARTED |
Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
!build |
CI MESSAGE: [1805976]: BUILD STARTED |
CI MESSAGE: [1805976]: BUILD PASSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok, apart maybe from the stylistic choice of using RangeBase for colors.
A nice followup would be some .rst mentioning existence of those ranges.
// perform an initial buffer fill if it hasn't already happened | ||
if (!initial_buffer_filled_) { | ||
TimeRange tr("[Loader] Filling initial buffer", TimeRange::kBlue1); | ||
DomainTimeRange tr("[DALI][Loader] Filling initial buffer", RangeBase::kBlue1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, my only nitpick would be that we use RangeBase instead of DomainTimeRange::kBlue... directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
include/dali/core/nvtx.h
Outdated
|
||
namespace dali { | ||
|
||
inline void FillAtrbs(nvtxEventAttributes_t &att, const std::string &name, const uint32_t rgb) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a free function and not something in the base class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
!build |
CI MESSAGE: [1806284]: BUILD STARTED |
include/dali/core/nvtx.h
Outdated
static const uint32_t kGreen1 = 0x859900; | ||
static const uint32_t knvGreen = 0x76B900; | ||
|
||
inline void FillAtrbs(nvtxEventAttributes_t &att, const std::string &name, const uint32_t rgb) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline void FillAtrbs(nvtxEventAttributes_t &att, const std::string &name, const uint32_t rgb) { | |
inline void FillAtrbs(nvtxEventAttributes_t &att, const char *name, const uint32_t rgb) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
include/dali/core/nvtx.h
Outdated
}; | ||
|
||
struct DomainTimeRange : RangeBase { | ||
explicit DomainTimeRange(const std::string &name, const uint32_t rgb = kBlue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An overload with a const char *name
would be welcome - we really don't have to create std::strings
each time we enter a time range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
include/dali/core/nvtx.h
Outdated
|
||
// Basic timerange for profiling | ||
struct TimeRange : RangeBase { | ||
TimeRange(const std::string name, const uint32_t rgb = kBlue) { // NOLINT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TimeRange(const std::string name, const uint32_t rgb = kBlue) { // NOLINT | |
TimeRange(const std::string &name, const uint32_t rgb = kBlue) : TimeRange(name.c_str(), rgb) {} // NOLINT | |
TimeRange(const char *name, const uint32_t rgb = kBlue) { // NOLINT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
dali/core/nvtx.cc
Outdated
}; | ||
#endif | ||
|
||
static DomainTimeRangeImpl range_impl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't compile without NVTX_ENABLED. BTW, perhaps it would be better to make it a signleton? Now we're initializing the object at load time - do we really want that (as opposed to initialize on first use)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
bool started = false; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if NTXT_ENABLED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
explicit DomainTimeRange(const std::string &name, const uint32_t rgb = kBlue); | ||
~DomainTimeRange(); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#else | |
struct DomainTimeRange : RangeBase { | |
using RangeBase::RangeBase; | |
}; | |
#endif |
^^^ this would avoid the costly call to a DLL-exported function when not using NVTX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
CI MESSAGE: [1806284]: BUILD PASSED |
!build |
CI MESSAGE: [1810072]: BUILD STARTED |
Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
!build |
CI MESSAGE: [1810187]: BUILD STARTED |
CI MESSAGE: [1810187]: BUILD PASSED |
Signed-off-by: Janusz Lisiecki jlisiecki@nvidia.com
Why we need this PR?
Pick one, remove the rest
What happened in this PR?
Fill relevant points, put NA otherwise. Replace anything inside []
libdali_core now provides NVTX ranges functionality
core
all modules using NVTX ranges
NA
CI
NA
JIRA TASK: [DALI-1728]