From e93f498aac657cee0e457665b7865cb3973dfaea Mon Sep 17 00:00:00 2001 From: Jason Lowe-Power Date: Thu, 31 Oct 2024 16:18:00 -0700 Subject: [PATCH] stdlib: Add get_devices to abstract board This function returns the GPUs (for now, possibly other devices in the future). It needs to be in the abstract board so the GPU-specific cache hierarchies can be used with non-GPU boards. Signed-off-by: Jason Lowe-Power --- src/python/gem5/components/boards/abstract_board.py | 9 +++++++++ src/python/gem5/prebuilt/viper/board.py | 1 + 2 files changed, 10 insertions(+) diff --git a/src/python/gem5/components/boards/abstract_board.py b/src/python/gem5/components/boards/abstract_board.py index cd6f559937..7461a29676 100644 --- a/src/python/gem5/components/boards/abstract_board.py +++ b/src/python/gem5/components/boards/abstract_board.py @@ -160,6 +160,15 @@ class AbstractBoard: """ return self.cache_line_size + def get_devices(self): + """Get the devices connected to the board. + + Currently, this is only used for GPUs by the ViperBoard. + + :returns: The devices connected to the board or None. + """ + return None + def connect_system_port(self, port: Port) -> None: self.system_port = port diff --git a/src/python/gem5/prebuilt/viper/board.py b/src/python/gem5/prebuilt/viper/board.py index bb13e92ed1..c9a0946056 100644 --- a/src/python/gem5/prebuilt/viper/board.py +++ b/src/python/gem5/prebuilt/viper/board.py @@ -73,6 +73,7 @@ class ViperBoard(X86Board): self._gpus = gpus + @overrides(AbstractBoard) def get_devices(self): return self._gpus