Compute Library
 21.11
GEMMConfigDistribution Class Reference

Public Member Functions

def __init__ (self)
 
def add
 
def distribution (self)
 
def frequency (self)
 
def best_config (self)
 
def std (self)
 

Detailed Description

A representation of the GEMM Configuration distribution produced by the GEMMBenchmarkResultRecorder.

Definition at line 377 of file GemmTuner.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)
Initializer

Definition at line 381 of file GemmTuner.py.

References GEMMConfigDistribution._gemm_config_freq.

381  def __init__(self):
382  """ Initializer
383  """
384  self._gemm_config_dist: Dict[
385  GEMMConfig, List[Tuple[GEMMParam, Measurement]]
386  ] = defaultdict(list)
387  self._gemm_config_freq = Counter()
388 

Member Function Documentation

◆ add()

def add (   self,
  benchmark_result 
)

Definition at line 389 of file GemmTuner.py.

References GEMMConfigDistribution._gemm_config_freq.

389  def add(self, benchmark_result: BenchmarkResult):
390  """ Add a benchmark result to the distribution
391  """
392  gemm_param, _, gemm_config, measurement = benchmark_result
393  self._gemm_config_dist[gemm_config].append((gemm_param, measurement))
394  self._gemm_config_freq[gemm_config] += 1
395 

◆ best_config()

def best_config (   self)
Get the overall best config, as voted by all benchmark results.

Definition at line 404 of file GemmTuner.py.

References GEMMConfigDistribution._gemm_config_freq.

404  def best_config(self):
405  """ Get the overall best config, as voted by all benchmark results.
406  """
407  return self._gemm_config_freq.most_common(1)
408 

◆ distribution()

def distribution (   self)

Definition at line 396 of file GemmTuner.py.

396  def distribution(self):
397  return self._gemm_config_dist
398 
std::uniform_real_distribution< float > distribution(-5.f, 5.f)

◆ frequency()

def frequency (   self)
Get the frequency of each (best) gemm config recorded

Definition at line 399 of file GemmTuner.py.

References GEMMConfigDistribution._gemm_config_freq.

399  def frequency(self):
400  """ Get the frequency of each (best) gemm config recorded
401  """
402  return self._gemm_config_freq.most_common()
403 

◆ std()

def std (   self)
Get the standard deviation as a measure of dispersion of the distribution. We should aim for higher values
as they indicate there is high variation in the distribution. Thus the evidence of the best config is stronger.

Definition at line 409 of file GemmTuner.py.

References GEMMConfigDistribution._gemm_config_freq.

409  def std(self):
410  """ Get the standard deviation as a measure of dispersion of the distribution. We should aim for higher values
411  as they indicate there is high variation in the distribution. Thus the evidence of the best config is stronger.
412  """
413  freqs = self._gemm_config_freq.values()
414  if len(freqs) == 0:
415  return 0
416  mean_freq = sum(freqs) / len(freqs)
417  return math.sqrt(sum((freq - mean_freq) ** 2 for freq in freqs) / len(freqs))
418 
419 

The documentation for this class was generated from the following file: