diff --git a/.github/workflows/test_basic.yaml b/.github/workflows/test_basic.yaml index fdc4e758f..f4fd3c18a 100644 --- a/.github/workflows/test_basic.yaml +++ b/.github/workflows/test_basic.yaml @@ -82,7 +82,7 @@ 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: @@ -90,7 +90,7 @@ jobs: - 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: diff --git a/pyproject.toml b/pyproject.toml index 462870efa..52106f1bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", ] diff --git a/requirements.txt b/requirements.txt index 740cd6b84..97a70a260 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 @@ -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" - diff --git a/slothy/core/core.py b/slothy/core/core.py index c255535da..a7c2d2615 100644 --- a/slothy/core/core.py +++ b/slothy/core/core.py @@ -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( @@ -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: @@ -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}", ) @@ -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