[dvsim] Make build-randomization opt-in
THis commit changes the dvsim infra from the original implementation
of always enabling build randomization by default, to opt-in.
The build-randomization is now enabled only if the user passes
--build-seed <optional-seed>` explicitly on the command-line. This
enables the users to properly reproduce failures.
It also enables modification of in-tree sources via pre-build commands
that can modify random constant packages. The previous implementation
made it difficult to achieve reproduction of these mutated sources.
It also did not factor in the case where a design could have multiple
build-modes in effect (default, cover_reg_top, etc).
All build-time source modifications are now to be wrapped in `build_seed`
mode, which is a simulation mode that is strictly enabled on the
command-line. The nightly regressions run at Google will eventually
be updated to pass on this switch as well.
If the --build-seed switch is not passed, no build randomization is
performed - the staticly checked-in sources are used as-is. The BUILD_SEED
which was updated in the previous implementation on every invocation
is also now fixed to 1 in this scenario.
Signed-off-by: Srikrishna Iyer <sriyer@google.com>
diff --git a/util/dvsim/Deploy.py b/util/dvsim/Deploy.py
index 0318b95..ae003db 100644
--- a/util/dvsim/Deploy.py
+++ b/util/dvsim/Deploy.py
@@ -296,13 +296,9 @@
cmds_list_vars = ["pre_build_cmds", "post_build_cmds"]
weight = 5
- # A static, randomized seed that is fixed across all builds.
- # This value can be overridden by --build-seed switch.
- seed = random.getrandbits(32)
-
def __init__(self, build_mode, sim_cfg):
self.build_mode_obj = build_mode
- self.seed = CompileSim.seed
+ self.seed = sim_cfg.build_seed
super().__init__(sim_cfg)
def _define_attrs(self):
@@ -356,13 +352,8 @@
target = "build"
- # A static, randomized seed that is fixed across all builds.
- # This value can be overridden by --build-seed switch.
- seed = random.getrandbits(32)
-
def __init__(self, build_mode, sim_cfg):
self.build_mode_obj = build_mode
- self.seed = CompileOneShot.seed
super().__init__(sim_cfg)
def _define_attrs(self):