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 <bbruce@ucdavis.edu> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Bobby Bruce
parent
29b19530ce
commit
4ad1150372
@@ -61,7 +61,7 @@ from pathlib import Path
|
||||
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 @@ processor = SimpleProcessor(
|
||||
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 @@ board = SimpleBoard(
|
||||
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],
|
||||
|
||||
@@ -31,6 +31,7 @@ from m5.util import warn, fatal
|
||||
|
||||
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 @@ class SimpointResource(AbstractResource):
|
||||
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 @@ _get_resource_json_type_map = {
|
||||
"simpoint": SimpointResource,
|
||||
"simpoint-directory": SimpointDirectoryResource,
|
||||
"resource": Resource,
|
||||
"looppoint-pinpoint-csv": LooppointCsvResource,
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from gem5.resources.resource import *
|
||||
from gem5.resources.looppoint import LooppointCsvLoader
|
||||
from gem5.isas import ISA
|
||||
|
||||
|
||||
@@ -235,3 +236,23 @@ class ResourceSpecializationSuite(unittest.TestCase):
|
||||
"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())
|
||||
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user