Skip to content

Commit

Permalink
usmp feature: support use_workspace_io config
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Jul 29, 2024
1 parent 4f2f512 commit c4d8d8a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mlonmcu/feature/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ class Usmp(BackendFeature):
DEFAULTS = {
**FeatureBase.DEFAULTS,
"algorithm": "greedy_by_conflicts", # options: greedy_by_conflicts, greedy_by_size, hill_climb
"use_workspace_io": False,
}

def __init__(self, features=None, config=None):
Expand All @@ -761,6 +762,11 @@ def __init__(self, features=None, config=None):
def algorithm(self):
return str(self.config["algorithm"])

@property
def use_workspace_io(self):
value = self.config["use_workspace_io"]
return str2bool(value) if not isinstance(value, (bool, int)) else value

def add_backend_config(self, backend, config):
assert backend in ["tvmaot"], f"Unsupported feature '{self.name}' for backend '{backend}'"
if f"{backend}.extra_pass_config" in config:
Expand All @@ -775,6 +781,7 @@ def add_backend_config(self, backend, config):
tmp = ast.literal_eval(tmp)
assert isinstance(tmp, dict)
tmp["tir.usmp.enable"] = self.enabled
tmp["tir.usmp.use_workspace_io"] = self.use_workspace_io
if self.algorithm in ["greedy_by_size", "greedy_by_conflicts", "hill_climb"]:
tmp["tir.usmp.algorithm"] = self.algorithm
else:
Expand Down

0 comments on commit c4d8d8a

Please sign in to comment.