Problem
Currently, the derive_metrics function only supports returning a single derived metric value. This limitation prevents users from computing multiple custom metrics in a single profiling run.
# Only one derived metric can be returned
def derive_metrics(a, b, c):
return a + b # single value only
Desired Behavior
Allow derive_metrics to return multiple values, either as:
- A tuple/list of values
- A dictionary of named metrics
# Option 1: Tuple/list return
def derive_metrics(a, b, c):
return a + b, a * b, a / b # multiple metrics
# Option 2: Dict return (named metrics)
def derive_metrics(a, b, c):
return {"sum": a + b, "product": a * b, "ratio": a / b}
Use Cases
- Compute multiple related metrics (e.g., arithmetic intensity + bandwidth utilization)
- Return both absolute and normalized values