Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
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 @@ -114,7 +114,7 @@ def set_dace_config(
dace.Config.set("compiler.cuda.backend", value="cuda")

# Instrumentation of SDFG timers
dace.Config.set("instrumentation", "report_each_invocation", value=True)
dace.Config.set("instrumentation", "report_each_invocation", value=False)

# we are not interested in storing the history of SDFG transformations.
dace.Config.set("store_history", value=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,18 @@ def add_instrumentation(sdfg: dace.SDFG, gpu: bool) -> None:
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
): # Add ranges to scopes and maps that are NOT scheduled to the GPU
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.
# Normally, we do not call `SDFGState.add_tasklet()` directly, instead we call
# the wrapper provided by `DataflowBuilder`, that modifies the tasklet connectors
# to avoid name conflicts with program symbols. However, this method is not
Expand Down
Loading