Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/gt4py/next/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# Metric collection levels
DISABLED: Final[int] = 0
MINIMAL: Final[int] = 1
GPU_TX_MARKERS: Final[int] = 2
PERFORMANCE: Final[int] = 10
INFO: Final[int] = 30
VERBOSE: Final[int] = 50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ def add_instrumentation(sdfg: dace.SDFG, gpu: bool) -> None:
dace.Memlet(f"{output}[0]"),
)

if (config.COLLECT_METRICS_LEVEL == metrics.GPU_TX_MARKERS) and gpu:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your current check is at compile time. The check in the instrumentation above is at runtime. I propose to always add NVTX instrumentation, because the config.COLLECT_METRICS_LEVEL value is meant to be a runtime setting. It is still possible to skip SDFG instrumentation by setting use_metrics=False on the dace backend, at compile-time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I would be up to enabling NVTX ranges by default since they will add some (really minimal) overhead to the CPU side. If use_metrics=False can be set by default then it would be fine but it would increase some more complexity for production and profiling runs

sdfg.instrument = dace.dtypes.InstrumentationType.GPU_TX_MARKERS
for node, _ in sdfg.all_nodes_recursive():
if isinstance(node, dace.nodes.MapEntry):
node.instrument = dace.dtypes.InstrumentationType.GPU_TX_MARKERS
elif isinstance(node, dace.sdfg.state.SDFGState):
node.instrument = dace.dtypes.InstrumentationType.GPU_TX_MARKERS

# Check SDFG validity after applying the above changes.
sdfg.validate()

Expand Down