Skip to content
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MODULEINFO
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Make: dmlc
$(HOST)/bin/dml/python/__main__.py
$(HOST)/bin/dml/python/dml/__init__.py
$(HOST)/bin/dml/python/dml/ast.py
$(HOST)/bin/dml/python/dml/breaking_changes.py
$(HOST)/bin/dml/python/dml/c_backend.py
$(HOST)/bin/dml/python/dml/g_backend.py
$(HOST)/bin/dml/python/dml/codegen.py
$(HOST)/bin/dml/python/dml/compat.py
$(HOST)/bin/dml/python/dml/crep.py
$(HOST)/bin/dml/python/dml/ctree.py
$(HOST)/bin/dml/python/dml/dmllex.py
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ LIBDIR := $(SIMICS_PROJECT)/$(HOST_TYPE)/bin

PYFILES := dml/__init__.py \
dml/ast.py \
dml/breaking_changes.py \
dml/c_backend.py \
dml/g_backend.py \
dml/codegen.py \
dml/compat.py \
dml/crep.py \
dml/ctree.py \
dml/template.py \
Expand Down
2 changes: 1 addition & 1 deletion deprecations_to_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[path_to_dml, header, outfile] = sys.argv[1:]
sys.path.append(path_to_dml)

from dml import compat
from dml import breaking_changes as compat
from dml.env import api_versions, default_api_version

by_version = {}
Expand Down
3 changes: 1 addition & 2 deletions dmlast.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def create_dmlasts(dmlc_path, dmlast_path, dml_path, depfile):
from dml.toplevel import produce_dmlast
from dml.logging import ignore_warning
import dml.globals
from dml import compat
from dml import breaking_changes as compat

ignore_warning('WEXPERIMENTAL')
dml.globals.enabled_compat.add(compat.warning_statement)
Expand All @@ -35,4 +35,3 @@ def create_dmlasts(dmlc_path, dmlast_path, dml_path, depfile):
[dmlc_path, dmlast_path, dml_path, depfile] = map(Path, sys.argv[1:])
create_dmlasts(dmlc_path.resolve(), dmlast_path.resolve(),
dml_path.resolve(), depfile)

2 changes: 1 addition & 1 deletion py/dead_dml_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def method_locations(path):
from dml.toplevel import parse_file, determine_version
from dml import logging, messages
import dml.globals
from dml import compat
from dml import breaking_changes as compat
# needed to parse 1.2/utility.dml
dml.globals.enabled_compat.add(compat.warning_statement)
for warning in messages.warnings:
Expand Down
19 changes: 3 additions & 16 deletions py/dml/compat.py → py/dml/breaking_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,7 @@ class suppress_WLOGMIXUP(CompatFeature):
[Messages](messages.html) section.

`WLOGMIXUP` is suppressed by default below Simics API version 7 in order
to avoid overwhelming users with warnings, as the faulty pattern that
`WLOGMIXUP` reports is very prevalent within existing code. Addressing
applications of the faulty pattern should be done before or as part of
migration to Simics API version 7.
Comment on lines 201 to 204
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed some text that felt redundant. It follows from how breaking changes work that WLOGMIXUP will be enabled during migration to API 7, and it follows from the previous mention of "overwhelming" that you want to fix those violations if you care about not getting overwhelmed.


Passing `--no-compat=suppress_WLOGMIXUP` to DMLC has almost the same effect
as passing `--warn=WLOGMIXUP`; either will cause DMLC to report the warning
even when the Simics API version in use is below 7. The only difference
between these two options is that if `--no-compat=suppress_WLOGMIXUP` is
used (and `--warn=WLOGMIXUP` is not), then `WLOGMIXUP` may still be
explicitly suppressed via `--no-warn=WLOGMIXUP`. In contrast,
`--warn=WLOGMIXUP` doesn't allow for `WLOGMIXUP` to be suppressed at
all.'''
Comment on lines 206 to 213
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because it's a lot of text and I don't understand why a user needs it. If they get the warning somewhere, then they will fix it. If that's impossible somewhere (which is unlikely), then they can use --no-warn as usual, no need to remind them.

to avoid overwhelming users with warnings.'''
short = "Suppress the warning 'WLOGMIXUP' by default"
last_api_version = api_6

Expand Down Expand Up @@ -263,9 +251,8 @@ class no_method_index_asserts(CompatFeature):

Migrating away from this compatibility feature should be a priority. If
its disablement makes the simulation crash due to an assertion failing,
then that **definitely signifies a bug in your model; a bug that would
very likely result in memory corruption if the assertion were not to
be made.**'''
then that signifies a bug in your model that could
lead to memory corruption without the range check.'''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to neutral language that says the same thing. The feature is important for those who spend much time on problems root-caused to memory corruptions, it's not up to us to decide. People are running sanitation tools that probably catch most such memory corruptions. IIRC, some of the overflows detected in the wild by the range check were not real corruptions (because it just logged something without accessing state). I.e., the code is inherently dangerous and unsafe but can't actually cause problems yet.

I agree it's a sane check that everyone should enable as soon as possible, but the same goes for most breaking changes. If we care, the best we can do is to actively push people to enable the check.

short = ("Disable assertions made by methods of object arrays that the "
+ "the object array indices are valid. Migrate away from this "
+ "ASAP!")
Expand Down
3 changes: 2 additions & 1 deletion py/dml/c_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from pathlib import Path

from . import objects, logging, crep, output, ctree, serialize, structure
from . import traits, compat
from . import traits
from . import breaking_changes as compat
import dml.globals
from .structure import get_attr_name, port_class_ident, need_port_proxy_attrs
from .logging import *
Expand Down
3 changes: 2 additions & 1 deletion py/dml/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import math

from . import objects, crep, ctree, ast, int_register, logging, serialize
from . import dmlparse, output, compat
from . import dmlparse, output
from . import breaking_changes as compat
from .logging import *
from .expr import *
from .ctree import *
Expand Down
2 changes: 1 addition & 1 deletion py/dml/crep.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .logging import *
from .expr_util import *
from .messages import *
from . import compat
from . import breaking_changes as compat

__all__ = (
'cname',
Expand Down
2 changes: 1 addition & 1 deletion py/dml/ctree.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .set import Set
from .slotsmeta import auto_init
from . import dmlparse, output
from . import compat
from . import breaking_changes as compat
import dml.globals
# set from codegen.py
codegen_call_expr = None
Expand Down
2 changes: 1 addition & 1 deletion py/dml/dmlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from . import serialize
from . import dmlparse
from . import output
from . import compat
from . import breaking_changes as compat

import dml.c_backend
import dml.info_backend
Expand Down
2 changes: 1 addition & 1 deletion py/dml/dmlparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from . import dmllex12
from . import dmllex14
from . import provisional
from . import compat
from . import breaking_changes as compat

assert lex.__version__ == yacc.__version__ == "3.4"

Expand Down
2 changes: 1 addition & 1 deletion py/dml/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Global variables

from . import compat
from . import breaking_changes as compat

# name -> Template instance. An object declaration in a file are
# represented implicitly as a template, named @filename.dml.
Expand Down
2 changes: 1 addition & 1 deletion py/dml/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from .reginfo import explode_registers
from . import dmlparse
from .set import Set
from . import compat
from . import breaking_changes as compat
from .slotsmeta import auto_init
from . import provisional

Expand Down
2 changes: 1 addition & 1 deletion py/dml/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import functools
from . import ast, logging
from . import compat
from . import breaking_changes as compat
from .logging import *
from .messages import *
from .set import Set
Expand Down
2 changes: 1 addition & 1 deletion py/dml/toplevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ply import lex, yacc

from . import objects, logging, codegen, ctree, ast
from . import compat
from . import breaking_changes as compat
from . import symtab
from .messages import *
from .logging import *
Expand Down
3 changes: 2 additions & 1 deletion py/dml/traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import contextlib
import abc
import os
from . import objects, logging, crep, codegen, toplevel, topsort, compat
from . import objects, logging, crep, codegen, toplevel, topsort
from . import breaking_changes as compat
from .logging import *
from .codegen import *
from .symtab import *
Expand Down
2 changes: 1 addition & 1 deletion py/dml/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
from .output import out
from .messages import *
from .logging import *
from . import compat
from . import breaking_changes as compat
from . import output
import dml .globals
import abc
Expand Down
1 change: 1 addition & 0 deletions test/1.2/errors/WREF.dml → test/1.2/errors/T_WREF.dml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ device test;

/// COMPILE-ONLY

/// API-VERSION 5
// Should be EREF in 6, SIMICS-9886
/// WARNING WREF
parameter p = $garbage;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ dml 1.4;

device test;

/// API-VERSION 7

/// ERROR ETYPE
extern uinteger_t undef_uval;
/// ERROR ETYPE
Expand Down
22 changes: 22 additions & 0 deletions test/1.4/legacy/T_no_compat_5a.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
© 2025 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/

// 1.2 because some compat features are auto-disabled in DML 1.4
dml 1.2;

device test;

/// COMPILE-ONLY
/// API-VERSION 5
/// DMLC-FLAG --no-compat=dml12_not,dml12_misc

import "no_compat.dml";

parameter enabled_5a = false;
parameter enabled_5b = true;
parameter enabled_6a = true;
parameter enabled_6b = true;
parameter enabled_7a = true;
parameter enabled_7b = true;
22 changes: 22 additions & 0 deletions test/1.4/legacy/T_no_compat_5b.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
© 2025 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/

// 1.2 because some compat features are auto-disabled in DML 1.4
dml 1.2;

device test;

/// COMPILE-ONLY
/// API-VERSION 5
/// DMLC-FLAG --no-compat=port_obj_param,dml12_inline

import "no_compat.dml";

parameter enabled_5a = true;
parameter enabled_5b = false;
parameter enabled_6a = true;
parameter enabled_6b = true;
parameter enabled_7a = true;
parameter enabled_7b = true;
21 changes: 21 additions & 0 deletions test/1.4/legacy/T_no_compat_6a.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
© 2025 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/

dml 1.4;

device test;

/// COMPILE-ONLY
/// API-VERSION 6
/// DMLC-FLAG --no-compat=dml12_int,dml12_goto,io_memory

import "no_compat.dml";

param enabled_5a = false;
param enabled_5b = false;
param enabled_6a = false;
param enabled_6b = true;
param enabled_7a = true;
param enabled_7b = true;
21 changes: 21 additions & 0 deletions test/1.4/legacy/T_no_compat_6b.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
© 2025 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/

dml 1.4;

device test;

/// COMPILE-ONLY
/// API-VERSION 6
/// DMLC-FLAG --no-compat=shared_logs_on_device,suppress_WLOGMIXUP

import "no_compat.dml";

param enabled_5a = false;
param enabled_5b = false;
param enabled_6a = true;
param enabled_6b = false;
param enabled_7a = true;
param enabled_7b = true;
21 changes: 21 additions & 0 deletions test/1.4/legacy/T_no_compat_7a.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
© 2025 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/

dml 1.4;

device test;

/// COMPILE-ONLY
/// API-VERSION 7
/// DMLC-FLAG --no-compat=broken_conditional_is,broken_unused_types,no_method_index_asserts,warning_statement,lenient_typechecking,port_proxy_ifaces

import "no_compat.dml";

param enabled_5a = false;
param enabled_5b = false;
param enabled_6a = false;
param enabled_6b = false;
param enabled_7a = false;
param enabled_7b = true;
21 changes: 21 additions & 0 deletions test/1.4/legacy/T_no_compat_7b.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
© 2025 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/

dml 1.4;

device test;

/// COMPILE-ONLY
/// API-VERSION 7
/// DMLC-FLAG --no-compat=function_in_extern_struct,port_proxy_attrs,meaningless_log_levels,optional_version_statement,experimental_vect,legacy_attributes

import "no_compat.dml";

param enabled_5a = false;
param enabled_5b = false;
param enabled_6a = false;
param enabled_6b = false;
param enabled_7a = true;
param enabled_7b = false;
Loading