diff --git a/RELEASENOTES.docu b/RELEASENOTES.docu index 3f2b965b2..29e0cf0c7 100644 --- a/RELEASENOTES.docu +++ b/RELEASENOTES.docu @@ -1797,5 +1797,9 @@ extern typedef struct { } my_type_t; for the identifier . Added the warning WBIGUNROLL which is emitted when a #select or #foreach statement is - compiled to a large unrolled loop. + compiled to a large unrolled loop. + This warning is only enabled by default with Simics API version 8 or + above. With version 7 and below it must be explicitly enabledby passing + either --no-compat=suppress_WBIGUNROLL or + --warn=WBIGUNROLL to DMLC. diff --git a/lib/1.2/dml-builtins.dml b/lib/1.2/dml-builtins.dml index f2511de67..5a84327dc 100644 --- a/lib/1.2/dml-builtins.dml +++ b/lib/1.2/dml-builtins.dml @@ -215,6 +215,7 @@ template device { parameter _compat_io_memory auto; parameter _compat_shared_logs_on_device auto; parameter _compat_suppress_WLOGMIXUP auto; + parameter _compat_suppress_WBIGUNROLL auto; parameter _compat_legacy_attributes auto; parameter _compat_lenient_typechecking auto; parameter _compat_dml12_inline auto; diff --git a/lib/1.4/dml-builtins.dml b/lib/1.4/dml-builtins.dml index fc1af1bf3..53a77309f 100644 --- a/lib/1.4/dml-builtins.dml +++ b/lib/1.4/dml-builtins.dml @@ -561,6 +561,7 @@ template device { param _compat_io_memory auto; param _compat_shared_logs_on_device auto; param _compat_suppress_WLOGMIXUP auto; + param _compat_suppress_WBIGUNROLL auto; param _compat_legacy_attributes auto; param _compat_lenient_typechecking auto; param _compat_dml12_inline auto; diff --git a/py/dml/compat.py b/py/dml/compat.py index b8945d555..8a2644747 100644 --- a/py/dml/compat.py +++ b/py/dml/compat.py @@ -198,6 +198,30 @@ class suppress_WLOGMIXUP(CompatFeature): short = "Suppress the warning 'WLOGMIXUP' by default" last_api_version = api_6 +@feature +class suppress_WBIGUNROLL(CompatFeature): + '''This compatibility feature makes it so the warning `WBIGUNROLL` is + suppressed by default. `WBIGUNROLL` warns about `#foreach` and `#select` + statements that compile to large unrolled loops — for more + information, see the documentation of `WBIGUNROLL` in the + [Messages](messages.html) section. + + `WBIGUNROLL` is suppressed by default below Simics API version 8 in order + to avoid overwhelming users with warnings. Addressing occurences of large + unrolled loops should be done before or as part of migration to Simics API + version 8. + + Passing `--no-compat=suppress_WBUGUNROLL` to DMLC has almost the same effect + as passing `--warn=WBIGUNROLL`; either will cause DMLC to report the warning + even when the Simics API version in use is below 8. The only difference + between these two options is that if `--no-compat=suppress_WBIGUNROLL` is + used (and `--warn=WBIGUNROLL` is not), then `WBIGUNROLL` may still be + explicitly suppressed via `--no-warn=WBIGUNROLL`. In contrast, + `--warn=WBIGUNROLL` doesn't allow for `WBIGUNROLL` to be suppressed at + all.''' + short = "Suppress the warning 'WBIGUNROLL' by default" + last_api_version = api_7 + @feature class legacy_attributes(CompatFeature): '''This compatibility feature makes DMLC register all attributes using the diff --git a/py/dml/dmlc.py b/py/dml/dmlc.py index c1c3b39bf..8ce72098c 100644 --- a/py/dml/dmlc.py +++ b/py/dml/dmlc.py @@ -599,6 +599,8 @@ def main(argv): if compat.suppress_WLOGMIXUP in dml.globals.enabled_compat: ignore_warning('WLOGMIXUP') + if compat.suppress_WBIGUNROLL in dml.globals.enabled_compat: + ignore_warning('WBIGUNROLL') for w in options.disabled_warnings: if not is_warning_tag(w): diff --git a/py/dml/messages.py b/py/dml/messages.py index 52d9f0672..c8e69b6bf 100644 --- a/py/dml/messages.py +++ b/py/dml/messages.py @@ -2309,6 +2309,9 @@ class WBIGUNROLL(DMLWarning): list instead as a `session` array or an `extern`ed C array, and iterate through it using traditional `for` loops. For more information, see [the various answers to this Stack Overflow question.](https://stackoverflow.com/questions/75073681/cannot-use-variable-index-in-a-constant-list) + + This warning is only enabled by default with Simics API version 8 or above + (due to the compatibility feature `suppress_WBIGUNROLL`.) """ fmt = ("This '%s' statement compiles to an unrolled loop where the loop " + "body is studied and generated %s times. This may dramatically " diff --git a/test/1.2/legacy/T_suppress_WBIGUNROLL_disabled.dml b/test/1.2/legacy/T_suppress_WBIGUNROLL_disabled.dml new file mode 100644 index 000000000..5048af670 --- /dev/null +++ b/test/1.2/legacy/T_suppress_WBIGUNROLL_disabled.dml @@ -0,0 +1,15 @@ +/* + © 2024 Intel Corporation + SPDX-License-Identifier: MPL-2.0 +*/ +dml 1.2; + +device test; + +/// COMPILE-ONLY +/// NO-CC + +/// DMLC-FLAG --no-compat=suppress_WBIGUNROLL + +/// SCAN-FOR-TAGS suppress_WBIGUNROLL.dml +import "suppress_WBIGUNROLL.dml"; diff --git a/test/1.2/legacy/T_suppress_WBIGUNROLL_enabled.dml b/test/1.2/legacy/T_suppress_WBIGUNROLL_enabled.dml new file mode 100644 index 000000000..9f65ffbe9 --- /dev/null +++ b/test/1.2/legacy/T_suppress_WBIGUNROLL_enabled.dml @@ -0,0 +1,14 @@ +/* + © 2024 Intel Corporation + SPDX-License-Identifier: MPL-2.0 +*/ +dml 1.2; + +device test; + +/// COMPILE-ONLY +/// NO-CC + +/// DMLC-FLAG --simics-api=7 + +import "suppress_WBIGUNROLL.dml"; diff --git a/test/1.2/errors/T_WBIGUNROLL.dml b/test/1.2/legacy/suppress_WBIGUNROLL.dml similarity index 96% rename from test/1.2/errors/T_WBIGUNROLL.dml rename to test/1.2/legacy/suppress_WBIGUNROLL.dml index 81d63c574..acfa4aa83 100644 --- a/test/1.2/errors/T_WBIGUNROLL.dml +++ b/test/1.2/legacy/suppress_WBIGUNROLL.dml @@ -1,13 +1,10 @@ /* - © 2023 Intel Corporation + © 2024 Intel Corporation SPDX-License-Identifier: MPL-2.0 */ dml 1.2; -device test; - -/// COMPILE-ONLY -/// NO-CC +// expectations in this file are selectively enabled using SCAN-FOR-TAGS data int zero = 0;