Bobby Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/67857?usp=email )
(
14 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: stdlib: Add the LooppointCsvResource resource
......................................................................
stdlib: Add the LooppointCsvResource resource
This resource wraps the LooppointCsvLoader class so it may be obtained
as a specialized resource via gem5 resources.
Relevant tests and config scripts have been updated.
Change-Id: Ib8e5ff5500fb1560951c9c0110e3c3aec8ca3c42
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67857
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M configs/example/gem5_library/looppoints/create-looppoint-checkpoints.py
M src/python/gem5/resources/resource.py
M tests/pyunit/stdlib/resources/pyunit_resource_specialization.py
M tests/pyunit/stdlib/resources/refs/resource-specialization.json
4 files changed, 72 insertions(+), 10 deletions(-)
Approvals:
kokoro: Regressions pass
Bobby Bruce: Looks good to me, approved; Looks good to me, approved
diff --git
a/configs/example/gem5_library/looppoints/create-looppoint-checkpoints.py
b/configs/example/gem5_library/looppoints/create-looppoint-checkpoints.py
index f967aa5..6c23d38 100644
---
a/configs/example/gem5_library/looppoints/create-looppoint-checkpoints.py
+++
b/configs/example/gem5_library/looppoints/create-looppoint-checkpoints.py
@@ -61,7 +61,7 @@
from gem5.simulate.exit_event_generators import (
looppoint_save_checkpoint_generator,
)
-from gem5.resources.looppoint import LooppointCsvLoader
+
import argparse
requires(isa_required=ISA.X86)
@@ -103,15 +103,6 @@
num_cores=9,
)
-looppoint = LooppointCsvLoader(
- # Pass in the LoopPoint data file
- looppoint_file=Path(
- obtain_resource(
- "x86-matrix-multiply-omp-100-8-global-pinpoints"
- ).get_local_path()
- )
-)
-
board = SimpleBoard(
clk_freq="3GHz",
processor=processor,
@@ -119,6 +110,7 @@
cache_hierarchy=cache_hierarchy,
)
+looppoint =
obtain_resource("x86-matrix-multiply-omp-100-8-global-pinpoints")
board.set_se_looppoint_workload(
binary=obtain_resource("x86-matrix-multiply-omp"),
arguments=[100, 8],
diff --git a/src/python/gem5/resources/resource.py
b/src/python/gem5/resources/resource.py
index 678497e..0cf5880 100644
--- a/src/python/gem5/resources/resource.py
+++ b/src/python/gem5/resources/resource.py
@@ -31,6 +31,7 @@
from .downloader import get_resource, get_resources_json_obj
+from .looppoint import LooppointCsvLoader
from ..isas import ISA, get_isa_from_str
from typing import Optional, Dict, Union, Type, Tuple, List
@@ -394,6 +395,26 @@
return warmup_list
+class LooppointCsvResource(FileResource, LooppointCsvLoader):
+ """This Looppoint resource used to create a Looppoint resource from a
+ pinpoints CSV file"""
+
+ def __init__(
+ self,
+ local_path: str,
+ documentation: Optional[str] = None,
+ source: Optional[str] = None,
+ **kwargs,
+ ):
+ FileResource.__init__(
+ self,
+ local_path=local_path,
+ documentation=documentation,
+ source=source,
+ )
+ LooppointCsvLoader.__init__(self, pinpoints_file=Path(local_path))
+
+
class SimpointDirectoryResource(SimpointResource):
"""A Simpoint diretory resource. This Simpoint Resource assumes the
existance of a directory containing a simpoint file and a weight
file."""
@@ -714,4 +735,5 @@
"simpoint": SimpointResource,
"simpoint-directory": SimpointDirectoryResource,
"resource": Resource,
+ "looppoint-pinpoint-csv": LooppointCsvResource,
}
diff --git
a/tests/pyunit/stdlib/resources/pyunit_resource_specialization.py
b/tests/pyunit/stdlib/resources/pyunit_resource_specialization.py
index f31e35d..5c60eb5 100644
--- a/tests/pyunit/stdlib/resources/pyunit_resource_specialization.py
+++ b/tests/pyunit/stdlib/resources/pyunit_resource_specialization.py
@@ -29,6 +29,7 @@
from pathlib import Path
from gem5.resources.resource import *
+from gem5.resources.looppoint import LooppointCsvLoader
from gem5.isas import ISA
@@ -235,3 +236,23 @@
"directory-example documentation.",
resource.get_documentation()
)
self.assertIsNone(resource.get_source())
+
+ def test_looppoint_pinpoints_resource(self) -> None:
+ """Tests the creation of LooppointCreatorCSVResource via a
Looppoint
+ pinpoints csv file."""
+
+ resource = obtain_resource(
+ resource_name="looppoint-pinpoint-csv-resource",
+ resource_directory=self.get_resource_dir(),
+ )
+
+ self.assertIsInstance(resource, LooppointCsvResource)
+
+ # The LooppointCreatorCSVResource should be a subtype of
+ # LooppointCsvLoader.
+ self.assertIsInstance(resource, LooppointCsvLoader)
+
+ self.assertEquals(
+ "A looppoint pinpoints csv file.", resource.get_documentation()
+ )
+ self.assertIsNone(resource.get_source())
diff --git
a/tests/pyunit/stdlib/resources/refs/resource-specialization.json
b/tests/pyunit/stdlib/resources/refs/resource-specialization.json
index 01671b5..bfe0d4a 100644
--- a/tests/pyunit/stdlib/resources/refs/resource-specialization.json
+++ b/tests/pyunit/stdlib/resources/refs/resource-specialization.json
@@ -108,6 +108,15 @@
"warmup_interval": 23445,
"simpoint_list" : [2,3,4,15],
"weight_list" : [0.1, 0.2, 0.4, 0.3]
+ },
+ {
+ "type": "looppoint-pinpoint-csv",
+ "name": "looppoint-pinpoint-csv-resource",
+ "documentation" : "A looppoint pinpoints csv file.",
+ "is_zipped" : false,
+ "md5sum" : "199ab22dd463dc70ee2d034bfe045082",
+ "url":
"http://dist.gem5.org/dist/develop/pinpoints/x86-matrix-multiply-omp-100-8-global-pinpoints-20230127",
+ "source" : null
}
]
}
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/67857?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ib8e5ff5500fb1560951c9c0110e3c3aec8ca3c42
Gerrit-Change-Number: 67857
Gerrit-PatchSet: 16
Gerrit-Owner: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org