Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/test_basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ jobs:
- uses: ./.github/actions/setup-ubuntu
- name: Run examples
run: |
python3 example.py --examples ntt_kyber_1_23_45_67_m55,ntt_dilithium_12_34_56_78_m55 --timeout=300
python3 example.py --examples ntt_kyber_1_23_45_67_m55,ntt_dilithium_12_34_56_78_m55 --timeout=1200
examples_ntt_kyber_dilithium_neon_core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-ubuntu
- name: Run examples
run: |
python3 example.py --examples ntt_kyber_123_4567_a55,ntt_dilithium_123_45678_a55 --timeout=300
python3 example.py --examples ntt_kyber_123_4567_a55,ntt_dilithium_123_45678_a55 --timeout=1200
sqmag:
runs-on: ubuntu-latest
steps:
Expand Down
7 changes: 1 addition & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ classifiers = [
]
requires-python = ">=3.10"
dependencies = [
"ortools==9.7.2996; python_version < '3.12'",
# ortools depends on pandas, but 9.7 does not specify it as dependency
"pandas>=2.0.3; python_version < '3.12'",
# ortools 9.7 requires protobuf<=6.31.1
"protobuf<=6.31.1; python_version < '3.12'",
"ortools==9.15.6755; python_version >= '3.12'",
"ortools==9.15.6755",
"sympy==1.14.0",
"unicorn==2.1.4",
]
Expand Down
8 changes: 1 addition & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
ortools==9.7.2996 ; python_version < "3.12"
ortools==9.15.6755 ; python_version >= "3.12"
# ortools 9.7 requires protobuf<=6.31.1
protobuf<=6.31.1 ; python_version < "3.12"
# ortools depends on pandas, but 9.7 does not specify it as dependency
pandas>=2.0.3 ; python_version < "3.12"
ortools==9.15.6755
sympy==1.14.0
unicorn==2.1.4
black==26.3.1
Expand All @@ -18,4 +13,3 @@ sphinx_mdinclude ; python_version >= "3.11"
myst_parser ; python_version >= "3.11"
sphinx-autobuild ; python_version >= "3.11"
sphinx-autodoc2 ; python_version >= "3.11"

35 changes: 23 additions & 12 deletions slothy/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1979,8 +1979,8 @@ def _add_register_usage(

spill_ival_active = self._NewBoolVar("")
self._AddMultiplicationEquality([var, spill_var], spill_ival_active)
spill_point_start = self._NewOptionalIntervalVar(
t.program_start_var, 1, t.program_start_var + 1, spill_ival_active, ""
spill_point_start = self._NewOptionalFixedIntervalVar(
t.program_start_var, 1, spill_ival_active, ""
)

interval = self._NewOptionalIntervalVar(
Expand Down Expand Up @@ -2649,15 +2649,15 @@ def _add_variables_functional_units(self):
# multiple execution units in use
for unit in units[0]:
t.exec_unit_choices = None
t.exec = self._NewIntervalVar(
t.cycle_start_var, cycles_unit_occupied, t.cycle_end_var, ""
t.exec = self._NewFixedIntervalVar(
t.cycle_start_var, cycles_unit_occupied, ""
)
self._model.intervals_for_unit[unit].append(t.exec)
else:
t.exec_unit_choices = None
unit = units[0]
t.exec = self._NewIntervalVar(
t.cycle_start_var, cycles_unit_occupied, t.cycle_end_var, ""
t.exec = self._NewFixedIntervalVar(
t.cycle_start_var, cycles_unit_occupied, ""
)
self._model.intervals_for_unit[unit].append(t.exec)
else:
Expand All @@ -2669,10 +2669,9 @@ def _add_variables_functional_units(self):
for unit in unit_choices:
unit_var = self._NewBoolVar(f"[{t.inst}].unit_choice.{unit}")
t.exec_unit_choices[unit] = unit_var
t.exec = self._NewOptionalIntervalVar(
t.exec = self._NewOptionalFixedIntervalVar(
t.cycle_start_var,
cycles_unit_occupied,
t.cycle_end_var,
unit_var,
f"{t.varname}_usage_{unit}",
)
Expand Down Expand Up @@ -4007,18 +4006,30 @@ def _init_external_model_and_solver(self):
self._model.cp_solver = cp_model.CpSolver()
self._model.cp_solver.random_seed = self.config.solver_random_seed

def _NewIntVar(self, minval, maxval, name=""):
def _NewIntVar(self, minval, maxval, name=""): # pylint:disable=invalid-name
r = self._model.cp_model.NewIntVar(minval, maxval, name)
self._model.variables.append(r)
return r

def _NewIntervalVar(self, base, dur, end, name=""):
def _NewFixedIntervalVar(self, base, dur, name=""): # pylint:disable=invalid-name
return self._model.cp_model.new_fixed_size_interval_var(base, dur, name)

def _NewIntervalVar(self, base, dur, end, name=""): # pylint:disable=invalid-name
return self._model.cp_model.NewIntervalVar(base, dur, end, name)

def _NewOptionalIntervalVar(self, base, dur, end, cond, name=""):
def _NewOptionalFixedIntervalVar(
self, base, dur, cond, name=""
): # pylint:disable=invalid-name
return self._model.cp_model.new_optional_fixed_size_interval_var(
base, dur, cond, name
)

def _NewOptionalIntervalVar(
self, base, dur, end, cond, name=""
): # pylint:disable=invalid-name
return self._model.cp_model.NewOptionalIntervalVar(base, dur, end, cond, name)

def _NewBoolVar(self, name=""):
def _NewBoolVar(self, name=""): # pylint:disable=invalid-name
r = self._model.cp_model.NewBoolVar(name)
self._model.variables.append(r)
return r
Expand Down
Loading