Skip to content

Commit

Permalink
Read from dataclass fields
Browse files Browse the repository at this point in the history
Summary: We can remove hardcoding the builtin metrics set by reading from the dataclass fields.

Reviewed By: int3

Differential Revision: D59989273

fbshipit-source-id: 76963617cc58395cdd853468970a96f101f86288
  • Loading branch information
xuzhao9 authored and facebook-github-bot committed Jul 23, 2024
1 parent 53d98e3 commit 6af4bd9
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions torchbenchmark/util/triton_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,6 @@
REGISTERED_METRICS: Dict[str, List[str]] = {}
REGISTERED_X_VALS: Dict[str, str] = {}
BASELINE_BENCHMARKS: Dict[str, str] = {}
BUILTIN_METRICS = [
"latency",
"tflops",
"speedup",
"accuracy",
"compile_time",
"ncu_trace",
"ncu_rep",
"kineto_trace",
"cpu_peak_mem",
"gpu_peak_mem",
"hw_roofline",
"best_config",
]
BASELINE_SKIP_METRICS = set(["speedup", "accuracy"])
X_ONLY_METRICS = set(["hw_roofline"])
PRECISION_DTYPE_MAPPING = {
Expand Down Expand Up @@ -202,6 +188,7 @@ class BenchmarkOperatorMetrics:
# extra metrics
extra_metrics: Optional[Dict[str, float]] = None

BUILTIN_METRICS = set(map(lambda x: x.name, fields(BenchmarkOperatorMetrics))) - {"extra_metrics"}

@dataclass
class BenchmarkOperatorResult:
Expand Down

0 comments on commit 6af4bd9

Please sign in to comment.