MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / Measurement

Class Measurement

examples/gemm_tuner/GemmTuner.py:134–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132
133# Measurement we take from the benchmark result.
134class Measurement(NamedTuple):
135 opencl_timer_ms_reshape: float
136 opencl_timer_ms_kernel: float
137
138 def get_total_ms(self):
139 return self.opencl_timer_ms_reshape + self.opencl_timer_ms_kernel
140
141 def is_close_to(self, other, tol):
142 return math.fabs(self.get_total_ms() - other.get_total_ms()) < tol
143
144 def is_better_than(self, other, tol):
145 return self.get_total_ms() < other.get_total_ms() and not self.is_close_to(
146 other
147 )
148
149 def __add__(self, other):
150 return Measurement(
151 self.opencl_timer_ms_reshape + other.opencl_timer_ms_reshape,
152 self.opencl_timer_ms_kernel + other.opencl_timer_ms_kernel,
153 )
154
155 def __sub__(self, other):
156 return Measurement(
157 self.opencl_timer_ms_reshape - other.opencl_timer_ms_reshape,
158 self.opencl_timer_ms_kernel - other.opencl_timer_ms_kernel,
159 )
160
161 def __mul__(self, other):
162 return Measurement(
163 self.opencl_timer_ms_reshape * other.opencl_timer_ms_reshape,
164 self.opencl_timer_ms_kernel * other.opencl_timer_ms_kernel,
165 )
166
167 def __floordiv__(self, other):
168 return Measurement(
169 self.opencl_timer_ms_reshape // other.opencl_timer_ms_reshape,
170 self.opencl_timer_ms_kernel // other.opencl_timer_ms_kernel,
171 )
172
173 def __truediv__(self, other):
174 return Measurement(
175 self.opencl_timer_ms_reshape / other.opencl_timer_ms_reshape,
176 self.opencl_timer_ms_kernel / other.opencl_timer_ms_kernel,
177 )
178
179 def __pow__(self, power):
180 return Measurement(
181 self.opencl_timer_ms_reshape ** power, self.opencl_timer_ms_kernel ** power
182 )
183
184 def __str__(self):
185 return ",".join(map(str, self))
186
187
188# GEMMConfig Type

Callers 7

__add__Method · 0.70
__sub__Method · 0.70
__mul__Method · 0.70
__floordiv__Method · 0.70
__truediv__Method · 0.70
__pow__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected