Skip to content

Commit

Permalink
Add PI for Conv1D and Conv2D for tensorflow
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Murdaca <fmurdaca@redhat.com>
  • Loading branch information
Francesco Murdaca committed Jul 30, 2019
1 parent f93450f commit c506cb1
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
Binary file modified docs/schema.dia
Binary file not shown.
Binary file modified docs/schema.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 58 additions & 2 deletions thoth/storages/graph/performance.py
Expand Up @@ -177,7 +177,63 @@ class PiMatmul(PerformanceIndicatorBase):


@attr.s(slots=True)
class PiConv(PerformanceIndicatorBase):
class PiConv1D(PerformanceIndicatorBase):
"""A class for representing a conv1D micro-performance test."""

SCHEMA_PARAMETERS = Schema(
{
Required("dtype"): str,
Required("reps"): int,
Required("device"): str,
Required("data_format"): str,
Required("batch"): int,
Required("input_width"): int,
Required("input_channels"): int,
Required("filter_width"): int,
Required("output_channels"): int,
Required("strides"): int,
Required("padding"): int,
}
)

SCHEMA_RESULT = Schema({Required("elapsed"): float, Required("rate"): float})

# Device used during performance indicator run - CPU/GPU/TPU/...
device = model_property(type=str, index="exact")

# Type of item in the tensor.
dtype = model_property(type=str, index="exact")

# Number of repetitions of conv2d performed.
reps = model_property(type=int, index="int")

# Data format NHWC Channel_last or NCHW Channel_first
data_format = model_property(type=str, index="exact")

# INPUT TENSOR
batch = model_property(type=int, index="int")
input_width = model_property(type=int, index="int")
input_channels = model_property(type=int, index="int")

# FILTER
filter_width = model_property(type=int, index="int")
output_channels = model_property(type=int, index="int")

# Stride, the speed by which the filter moves across the image
strides = model_property(type=int, index="int")

# Padding
padding = model_property(type=int, index="int")

# Elapsed seconds.
elapsed = model_property(type=float)

# Final rate gflops/s.
rate = model_property(type=float)


@attr.s(slots=True)
class PiConv2D(PerformanceIndicatorBase):
"""A class for representing a conv2D micro-performance test."""

SCHEMA_PARAMETERS = Schema(
Expand Down Expand Up @@ -236,7 +292,7 @@ class PiConv(PerformanceIndicatorBase):
rate = model_property(type=float)


ALL_PERFORMANCE_MODELS = frozenset((ObservedPerformance, PiMatmul, PiConv))
ALL_PERFORMANCE_MODELS = frozenset((ObservedPerformance, PiMatmul, PiConv1D, PiConv2D))


PERFORMANCE_MODEL_BY_NAME = {model_class.__name__: model_class for model_class in ALL_PERFORMANCE_MODELS}
7 changes: 4 additions & 3 deletions thoth/storages/graph/schema.rdf
Expand Up @@ -132,7 +132,7 @@ package_extract_error: bool .
image_tag: string @index(exact) .
os_id: string @index(exact) .
os_version_id: string @index(exact) .
pi_conv_label: string @count @upsert @index(exact) .
pi_conv1_d_label: string @count @upsert @index(exact) .
framework: string @index(exact) .
version: string @index(exact) .
exit_code: int .
Expand All @@ -157,16 +157,17 @@ dtype: string @index(exact) .
reps: int @index(int) .
data_format: string @index(exact) .
batch: int @index(int) .
input_height: int @index(int) .
input_width: int @index(int) .
input_channels: int @index(int) .
filter_height: int @index(int) .
filter_width: int @index(int) .
output_channels: int @index(int) .
strides: int @index(int) .
padding: int @index(int) .
elapsed: float .
rate: float .
pi_conv2_d_label: string @count @upsert @index(exact) .
input_height: int @index(int) .
filter_height: int @index(int) .
pi_matmul_label: string @count @upsert @index(exact) .
matrix_size: int @index(int) .
provenance_checker_run_label: string @count @upsert @index(exact) .
Expand Down

0 comments on commit c506cb1

Please sign in to comment.