Skip to content

Commit

Permalink
Add a compatibility feature to suppress WLOGMIXUP
Browse files Browse the repository at this point in the history
  • Loading branch information
lwaern-intel committed Jun 14, 2024
1 parent c3171ad commit d6cbc1a
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 6 deletions.
6 changes: 5 additions & 1 deletion RELEASENOTES.docu
Original file line number Diff line number Diff line change
Expand Up @@ -1797,5 +1797,9 @@ extern typedef struct { } my_type_t;</pre> </add-note></build-id>
for the identifier <bug number="SIMICS-22472"/>.</add-note></build-id>
<build-id _6="next" _7="next"><add-note> Added the warning <tt>WBIGUNROLL</tt>
which is emitted when a <tt>#select</tt> or <tt>#foreach</tt> statement is
compiled to a large unrolled loop.</add-note></build-id>
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 <tt>--no-compat=suppress_WBIGUNROLL</tt> or
<tt>--warn=WBIGUNROLL</tt> to DMLC.</add-note></build-id>
</rn>
1 change: 1 addition & 0 deletions lib/1.2/dml-builtins.dml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lib/1.4/dml-builtins.dml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 24 additions & 0 deletions py/dml/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 &mdash; 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
Expand Down
2 changes: 2 additions & 0 deletions py/dml/dmlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions py/dml/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
15 changes: 15 additions & 0 deletions test/1.2/legacy/T_suppress_WBIGUNROLL_disabled.dml
Original file line number Diff line number Diff line change
@@ -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";
14 changes: 14 additions & 0 deletions test/1.2/legacy/T_suppress_WBIGUNROLL_enabled.dml
Original file line number Diff line number Diff line change
@@ -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";
Original file line number Diff line number Diff line change
@@ -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;

Expand Down

0 comments on commit d6cbc1a

Please sign in to comment.