Comments (8)
I have some code written to implement those macros. Just need to test it before I submit it for review.
from nvtx.
The other thing this would require is for the default ctor of movable_domain_thread_range
to emit no range. I think we avoid introducing a whole new range type and avoid making thread_range
movable by using an IILE and introducing a tag type in domain_thread_range::no_range
with a domain_thread_range::domain_thread_range(domain_thread_range::no_range)
ctor that emits no range. Something like this:
#define NVTX3_V1_FUNC_RANGE_IF_IN(C, D) \
::nvtx3::v1::movable_domain_thread_range<D> const nvtx3_range__ = [&](){
if (C) { \
static ::nvtx3::v1::registered_string<D> const nvtx3_func_name__{__func__}; \
static ::nvtx3::v1::event_attributes const nvtx3_func_attr__{nvtx3_func_name__}; \
return ::nvtx3::v1::domain_thread_range<D>{nvtx3_func_attr__}; \
} else{
return ::nvtx3::v1::domain_thread_range<D>{::nvtx3::v1::domain_thread_range::no_range};
}
};
}
from nvtx.
Hm, on second thought, my IILE idea won't work because it still requires the object to be movable...
Can we just use start_range/end_range
here instead?
from nvtx.
Hm, on second thought, my IILE idea won't work because it still requires the object to be movable...
If we don't touch domain_thread_range
and add the movable_domain_thread_range
this might not be an issue. What do you think?
Can we just use start_range/end_range here instead?
I would rather not for three reasons:
- Tool might process and visualize push/pop and start/end ranges differently. This is the case for Nsight Systems
- Semantically,
NVTX3_V1_FUNC_RANGE
andNVTX3_V1_FUNC_RANGE_IN
represent a thread range, not a process range. So it would be weird to rely ondomain_process_range
for theIF
variant - The overhead for start/end might be slightly higher than for push/pop. This is the case for Nsight Systems
from nvtx.
If we don't touch
domain_thread_range
and add themovable_domain_thread_range
this might not be an issue. What do you think?
Adding a whole additional type for this one use case is kind of a lot of code.
from nvtx.
Adding a whole additional type for this one use case is kind of a lot of code.
We can create a base domain_thread_range_base
class which contains most of the shared code (relevant constructors & deleted operators). The domain_thread_range
and movable_domain_thread_range
could inherit from it and only implemented the pieces specific to their class (move ctor/operator, destructor)
from nvtx.
I still don't love adding a new range type if we can avoid it. Here's how we can do it just by adding a tag type to pass to domain_thread_range
that indicates no range should be generated: https://godbolt.org/z/v9MYzc
from nvtx.
Also, I'm wondering about if nvtx3.hpp
really needs to provide this macro. I'm not doubting if it's useful, I'm just questioning if it really needs to be provided by the library.
There are no doubt numerous variants of this macro some people would find useful, e.g., variants that allow specifying parts of the event_attributes
. The lack of overloading on macros makes this nasty as we then have to have different names for all of them. As a rule, I think nvtx3.hpp
should provide the bare minimum number of convenience macros to avoid bloat and complexity. The question is, do we think NVTX3_FUNC_RANGE_IF
and NVTX3_FUNC_RANGE_IF_IN
are essential enough to be considered bare minimum.
Also the naming of NVTX3_FUNC_RANGE_IF_IN
is potentially confusing. It sounds like the range would only be generated if it's in something.
from nvtx.
Related Issues (20)
- `end_range` should be templated with the domain and use `nvtxDomainRangeEnd` HOT 10
- Functions missing the `noexcept` specifier
- Deleting the default constructor of some classes HOT 3
- Implement `domain_process_range` without storing the handle in `std::unique_ptr` HOT 1
- Compilation error when if `NVTX_DISABLE` is defined
- Rename range classes HOT 2
- Building wheel for nvtx (PEP 517) ... error HOT 13
- error: declaration of template parameter āDā shadows template parameter HOT 1
- Installing NVTX on python fails in nvidia docker image. HOT 11
- NVTX C++ availability HOT 2
- Failed to build nvtx HOT 3
- scoped_range does not work with domain::global HOT 1
- `nvToolsExt.h` defines min/max macros on Windows HOT 2
- NvToolExt_LIBRARIES-NOTFOUND
- how can i get nvToolsExt64_1.dll and nvToolsExt64_1.lib
- Python 3.11 support HOT 3
- PyPi README missing
- pip install nvtx on macOs HOT 3
- Wheels for Mac OS and Windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvtx.