1// This file defines protos that store the results of autotuning various
2// operations.
3//
4// They are in proto format because we want to log them structured. They offer
5// tremendous statistical, testing, and debugging value.
6syntax = "proto3";
7
8package tensorflow;
9
10import "google/protobuf/any.proto";
11import "google/protobuf/duration.proto";
12
13message CudnnVersion {
14  int32 major = 1;
15  int32 minor = 2;
16  int32 patch = 3;
17}
18
19message ComputeCapability {
20  int32 major = 1;
21  int32 minor = 2;
22}
23
24message AutotuneResult {
25  message SuccessResult {
26    int64 scratch_bytes = 1;
27    google.protobuf.Duration run_time = 2;
28  }
29
30  message ConvKey {
31    int64 algorithm = 1;
32    bool tensor_ops_enabled = 2;
33  }
34
35  // If the conv runs successfully, success will be populated with the
36  // autotuning result. Otherwise, the error message is propagated.
37  oneof result {
38    SuccessResult success = 3;
39    string error_string = 4;
40  }
41
42  oneof key {
43    ConvKey conv = 5;
44  }
45
46  // Sometimes we run a correctness checker during autotuning. It compares the
47  // result buffer content between two algorithms, say, "reference" and "test"
48  // algorithms. The "test" algorithm is the one associated with this
49  // AutotuneResult.
50  //
51  // This field records the reference algorithm used. Notice that naming it
52  // "reference" doesn't mean it's always correct. However, empirically it's
53  // more correct, as it's "algo 0", less fancy than the compared one.
54  //
55  // Notice that the checker_failure may exist even in the success case.
56  // This is because the error string in `result` comes from the underlying
57  // implementation like cuDNN, which isn't aware that it produced an incorrect
58  // result. And even if the checker detects an incorrect result, we can still
59  // retrieve scratch_bytes and runtime_ms.
60  oneof checker_failure {
61    ConvKey reference_conv = 6;
62  }
63}
64
65message AutotuningLog {
66  google.protobuf.Any instr = 1;
67
68  // Records all auto-tuning results per algorithm.
69  repeated AutotuneResult results = 2;
70
71  CudnnVersion cudnn_version = 3;
72  ComputeCapability compute_capability = 4;
73}
74