Skip to content
Snippets Groups Projects

Introduce immutable RNG state for correct comparisons and pickling

This MR refactors the frontend RNG architecture of !474 (merged) to use immutable RNG state objects.

An immutable state object must be attached to each RNG invocation in order to correctly compare equivalent invocations and allow them to be pickled. The RNG objects themselves now serve as factories for their invocations and associated series of state objects.

  • Add RngState class for immutable RNG state objects
  • Turn RngBase and subclass Philox into factories for their state
  • Remove RngFunc and replace it by an introspection-based typechecking mechanism (inheritance from RngFunc is not preserved by pickle)
  • Adapt backend parsing
  • Add test cases for RNG comparion and pickling
  • Bump SymPy dependency to ~=1.14 (RNG functions need https://github.com/sympy/sympy/pull/26881)
  • Fix SymPy-related spurious mypy errors
Edited by Frederik Hennig

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Looks good, just some minor issues with two comments.

  • Michael Kuron approved this merge request

    approved this merge request

  • added 1 commit

    Compare with previous version

  • Frederik Hennig resolved all threads

    resolved all threads

  • Frederik Hennig enabled an automatic merge when all merge checks for ffde2c83 pass

    enabled an automatic merge when all merge checks for ffde2c83 pass

  • mentioned in commit 5c4f9d2c

  • Please register or sign in to reply
    Loading