From 4adeb24a4f9656edf0582e714ab50d17e0f30577 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Tue, 12 Dec 2023 14:23:04 -0800 Subject: [PATCH 1/2] stdlib: Remove 'additional_params' value type assert The value of a `WorkloadResource`'s additional parameter may not always be a string. It can be any JSON value (integer, a list, a dict, ect.). For Looppoint resources we have additional parameters such as a List of region start points. The assert inside workloads checking the type of the value breaks certain usecase and is therefore removed in this commit. Change-Id: Iecb1518082c28ab3872a8de888c76f0800261640 --- src/python/gem5/resources/resource.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python/gem5/resources/resource.py b/src/python/gem5/resources/resource.py index 08d046fc01..d6746487ff 100644 --- a/src/python/gem5/resources/resource.py +++ b/src/python/gem5/resources/resource.py @@ -1098,7 +1098,6 @@ def obtain_resource( for key in resource_json["additional_params"].keys(): assert isinstance(key, str) value = resource_json["additional_params"][key] - assert isinstance(value, str) params[key] = value resource_json["parameters"] = params # Once we know what AbstractResource subclass we are using, we create it. From 4eb81296b1c165266a8849d13ec21b70d3735252 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Tue, 12 Dec 2023 14:28:11 -0800 Subject: [PATCH 2/2] stdlib: Add `get_local_path()` call to Looppoint resources Due to a change introduced in https://github.com/gem5/gem5/pull/625, a gem5 resource will not download any external files until `get_local_path()` is called. In the construction of the Looppoint Resources this function was not called, the `local_path` variable was called directly. As such, an error occured. The downside of this fix is the Looppoint resources external files are downloaded when `obtain_resource` is called, thus the bandwidth savings introduced with https://github.com/gem5/gem5/pull/625 will not occur for Looppoint resources. However, https://github.com/gem5/gem5/issues/644 proposes a fix which would supercede the https://github.com/gem5/gem5/pull/625 solution. Change-Id: I52181382a03e492ec1cb58b01e71bc4820af9ccc --- src/python/gem5/resources/resource.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/python/gem5/resources/resource.py b/src/python/gem5/resources/resource.py index d6746487ff..591515a6b9 100644 --- a/src/python/gem5/resources/resource.py +++ b/src/python/gem5/resources/resource.py @@ -578,7 +578,9 @@ class LooppointCsvResource(FileResource, LooppointCsvLoader): resource_version=resource_version, downloader=downloader, ) - LooppointCsvLoader.__init__(self, pinpoints_file=Path(local_path)) + LooppointCsvLoader.__init__( + self, pinpoints_file=Path(self.get_local_path()) + ) def get_category_name(cls) -> str: return "LooppointCsvResource" @@ -606,7 +608,7 @@ class LooppointJsonResource(FileResource, LooppointJsonLoader): downloader=downloader, ) LooppointJsonLoader.__init__( - self, looppoint_file=local_path, region_id=region_id + self, looppoint_file=self.get_local_path(), region_id=region_id ) def get_category_name(cls) -> str: