stdlib: Add additional warns when get_runtime_isa used

While the `runtime` module's `get_runtime_isa` function throws a warning
to remind user's the function is deprecated, this was not always helpful
to a user when setting a processor without a target ISA.

This change adds additional warnings to the SimpleSwitchableProcessor
and the SimpleProcessor. These warnings explain not explicitly setting
the ISA via the processor's constructor is deprecated behavior.

Change-Id: I994ad8355e0d1c3f07374bebe2b59106fb04d212
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63331
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Bobby R. Bruce
2022-09-08 11:30:14 -07:00
committed by Bobby Bruce
parent 3b832fceb9
commit db8641fd7b
2 changed files with 19 additions and 0 deletions

View File

@@ -25,6 +25,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from m5.util import warn
from .base_cpu_processor import BaseCPUProcessor
from ..processors.simple_core import SimpleCore
@@ -53,6 +54,14 @@ class SimpleProcessor(BaseCPUProcessor):
recommended you explicitly set your ISA via SimpleProcessor
construction.
"""
if not isa:
warn(
"An ISA for the SimpleProcessor was not set. This will "
"result in usage of `runtime.get_runtime_isa` to obtain the "
"ISA. This function is deprecated and will be removed in "
"future releases of gem5. Please explicitly state the ISA "
"via the processor constructor."
)
super().__init__(
cores=[
SimpleCore(cpu_type=cpu_type, core_id=i, isa=isa)

View File

@@ -30,6 +30,7 @@ from ..processors.simple_core import SimpleCore
from ..processors.cpu_types import CPUTypes, get_mem_mode
from .switchable_processor import SwitchableProcessor
from ...isas import ISA
from m5.util import warn
from ...utils.override import *
@@ -65,6 +66,15 @@ class SimpleSwitchableProcessor(SwitchableProcessor):
construction.
"""
if not isa:
warn(
"An ISA for the SimpleSwitchableProcessor was not set. This "
"will result in usage of `runtime.get_runtime_isa` to obtain "
"the ISA. This function is deprecated and will be removed in "
"future releases of gem5. Please explicitly state the ISA "
"via the processor constructor."
)
if num_cores <= 0:
raise AssertionError("Number of cores must be a positive integer!")