-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from JiacongSun/master
New feature: Allows the output data of a layer to remain in the low-level memory for later use when possible
- Loading branch information
Showing
16 changed files
with
987 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,4 @@ | |
) | ||
|
||
# Launch the MainStage | ||
mainstage.run() | ||
mainstage.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,4 +45,4 @@ | |
) | ||
|
||
# Launch the MainStage | ||
mainstage.run() | ||
mainstage.run() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
|
||
from zigzag.api import get_hardware_performance_zigzag_without_unused_memory | ||
|
||
workloads = ( | ||
"zigzag/inputs/examples/workload/alexnet.onnx", | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx", | ||
"zigzag/inputs/examples/workload/resnet18.onnx", | ||
"zigzag.inputs.examples.workload.resnet18", | ||
) | ||
|
||
# Expected energy and latency for each workload defined above | ||
ens_lats = { | ||
"zigzag/inputs/examples/workload/alexnet.onnx": (5649555894.9, 8637780), | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx": (1881386179.71, 6486685), | ||
"zigzag/inputs/examples/workload/resnet18.onnx": (1709089377.83, 3583047), | ||
"zigzag.inputs.examples.workload.resnet18": (2243493483.15, 4657130), | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def mapping(): | ||
return "zigzag.inputs.examples.mapping.ascend_like" | ||
|
||
|
||
@pytest.fixture | ||
def accelerator(): | ||
return "zigzag.inputs.examples.hardware.Ascend_like" | ||
|
||
|
||
@pytest.mark.parametrize("workload", workloads) | ||
def test_api(workload, accelerator, mapping): | ||
(energy, latency, cmes) = get_hardware_performance_zigzag_without_unused_memory( | ||
workload, accelerator, mapping | ||
) | ||
(expected_energy, expected_latency) = ens_lats[workload] | ||
assert energy == pytest.approx(expected_energy) | ||
assert latency == pytest.approx(expected_latency) |
38 changes: 38 additions & 0 deletions
38
tests/main/test_without_unused_memory/test_edge_tpu_like.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
|
||
from zigzag.api import get_hardware_performance_zigzag_without_unused_memory | ||
|
||
workloads = ( | ||
"zigzag/inputs/examples/workload/alexnet.onnx", | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx", | ||
"zigzag/inputs/examples/workload/resnet18.onnx", | ||
"zigzag.inputs.examples.workload.resnet18", | ||
) | ||
|
||
# Expected energy and latency for each workload defined above | ||
ens_lats = { | ||
"zigzag/inputs/examples/workload/alexnet.onnx": (5568602396.684999, 8134431), | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx": (751128562.4699999, 2427487), | ||
"zigzag/inputs/examples/workload/resnet18.onnx": (1784539639.4349997, 3176546), | ||
"zigzag.inputs.examples.workload.resnet18": (2115122870.395, 3884789), | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def mapping(): | ||
return "zigzag.inputs.examples.mapping.edge_tpu_like" | ||
|
||
|
||
@pytest.fixture | ||
def accelerator(): | ||
return "zigzag.inputs.examples.hardware.Edge_TPU_like" | ||
|
||
|
||
@pytest.mark.parametrize("workload", workloads) | ||
def test_api(workload, accelerator, mapping): | ||
(energy, latency, cmes) = get_hardware_performance_zigzag_without_unused_memory( | ||
workload, accelerator, mapping | ||
) | ||
(expected_energy, expected_latency) = ens_lats[workload] | ||
assert energy == pytest.approx(expected_energy) | ||
assert latency == pytest.approx(expected_latency) |
38 changes: 38 additions & 0 deletions
38
tests/main/test_without_unused_memory/test_meta_prototype_like.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
|
||
from zigzag.api import get_hardware_performance_zigzag_without_unused_memory | ||
|
||
workloads = ( | ||
"zigzag/inputs/examples/workload/alexnet.onnx", | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx", | ||
"zigzag/inputs/examples/workload/resnet18.onnx", | ||
"zigzag.inputs.examples.workload.resnet18", | ||
) | ||
|
||
# Expected energy and latency for each workload defined above | ||
ens_lats = { | ||
"zigzag/inputs/examples/workload/alexnet.onnx": (5679695605.4400015, 8299150), | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx": (901092009.6000001, 2610609), | ||
"zigzag/inputs/examples/workload/resnet18.onnx": (1730672410.3200004, 3262009), | ||
"zigzag.inputs.examples.workload.resnet18": (2265438430.2299995, 4017227), | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def mapping(): | ||
return "zigzag.inputs.examples.mapping.meta_prototype_like" | ||
|
||
|
||
@pytest.fixture | ||
def accelerator(): | ||
return "zigzag.inputs.examples.hardware.Meta_prototype" | ||
|
||
|
||
@pytest.mark.parametrize("workload", workloads) | ||
def test_api(workload, accelerator, mapping): | ||
(energy, latency, cmes) = get_hardware_performance_zigzag_without_unused_memory( | ||
workload, accelerator, mapping | ||
) | ||
(expected_energy, expected_latency) = ens_lats[workload] | ||
assert energy == pytest.approx(expected_energy) | ||
assert latency == pytest.approx(expected_latency) |
38 changes: 38 additions & 0 deletions
38
tests/main/test_without_unused_memory/test_tesla_npu_like.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
|
||
from zigzag.api import get_hardware_performance_zigzag_without_unused_memory | ||
|
||
workloads = ( | ||
"zigzag/inputs/examples/workload/alexnet.onnx", | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx", | ||
"zigzag/inputs/examples/workload/resnet18.onnx", | ||
"zigzag.inputs.examples.workload.resnet18", | ||
) | ||
|
||
# Expected energy and latency for each workload defined above | ||
ens_lats = { | ||
"zigzag/inputs/examples/workload/alexnet.onnx": (6040086796.366001, 8389669), | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx": (930702060.6110002, 1965457), | ||
"zigzag/inputs/examples/workload/resnet18.onnx": (1724869681.4799998, 3257898), | ||
"zigzag.inputs.examples.workload.resnet18": (2220861655.6660004, 3934616), | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def mapping(): | ||
return "zigzag.inputs.examples.mapping.tesla_npu_like" | ||
|
||
|
||
@pytest.fixture | ||
def accelerator(): | ||
return "zigzag.inputs.examples.hardware.Tesla_NPU_like" | ||
|
||
|
||
@pytest.mark.parametrize("workload", workloads) | ||
def test_api(workload, accelerator, mapping): | ||
(energy, latency, cmes) = get_hardware_performance_zigzag_without_unused_memory( | ||
workload, accelerator, mapping | ||
) | ||
(expected_energy, expected_latency) = ens_lats[workload] | ||
assert energy == pytest.approx(expected_energy) | ||
assert latency == pytest.approx(expected_latency) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
|
||
from zigzag.api import get_hardware_performance_zigzag_without_unused_memory | ||
|
||
workloads = ( | ||
"zigzag/inputs/examples/workload/alexnet.onnx", | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx", | ||
"zigzag/inputs/examples/workload/resnet18.onnx", | ||
"zigzag.inputs.examples.workload.resnet18", | ||
) | ||
|
||
# Expected energy and latency for each workload defined above | ||
ens_lats = { | ||
"zigzag/inputs/examples/workload/alexnet.onnx": (5475639384.492001, 8979956), | ||
"zigzag/inputs/examples/workload/mobilenetv2.onnx": (952688145.0069999, 21873214), | ||
"zigzag/inputs/examples/workload/resnet18.onnx": (1659252422.016, 4000289), | ||
"zigzag.inputs.examples.workload.resnet18": (1982830786.5119998, 4509235), | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def mapping(): | ||
return "zigzag.inputs.examples.mapping.tpu_like" | ||
|
||
|
||
@pytest.fixture | ||
def accelerator(): | ||
return "zigzag.inputs.examples.hardware.TPU_like" | ||
|
||
|
||
@pytest.mark.parametrize("workload", workloads) | ||
def test_api(workload, accelerator, mapping): | ||
(energy, latency, cmes) = get_hardware_performance_zigzag_without_unused_memory( | ||
workload, accelerator, mapping | ||
) | ||
(expected_energy, expected_latency) = ens_lats[workload] | ||
assert energy == pytest.approx(expected_energy) | ||
assert latency == pytest.approx(expected_latency) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.