Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move bool_op into prod2's template arguments #162

Closed
9 tasks done
SSoelvsten opened this issue Nov 3, 2021 · 0 comments · Fixed by #624
Closed
9 tasks done

Move bool_op into prod2's template arguments #162

SSoelvsten opened this issue Nov 3, 2021 · 0 comments · Fixed by #624
Assignees
Labels
❕ deprecation Some day, something will be superseeded 📁 internal This is where the ✨magic✨happens ✨ optimisation It's all about speed / space 🎓 student programmer Work, work...

Comments

@SSoelvsten
Copy link
Owner

SSoelvsten commented Nov 3, 2021

We may be able to get a slight but significant performance increase by having the boolean operators op given to Apply and Quantification to be compile-time known, since this might simplify some computations or even remove some if-statements. This might get us even closer in performance to other implementations.

  • Rework the bool_op functions in adiar/bool_op.h to be a predicate<bool,bool>, i.e. one that only sees the value of the ptr_uint64.
  • Rename is_X_irrelevant into is_X_idempotent.
  • Replace internal/bool_op.h with a generic binary_op class that holds a reference to a function<Terminal(Terminal, Terminal)>. For now, only implement the specialization for Terminal = bool.
    • Improve its performance by pre-computing values that are used more than once in the binary_op constructor.
    • Add type of flipped binary_op<...>
    • Template the prod2 algorithm to work with some BinaryOp (possibly inheritable by the policy?).
  • Add non-generic versions for each operator that exploits bit-operations and provides as much as possible at compile time.
     class and_op
     {
     public:
       static ptr_t apply(const ptr_t lhs, const ptr_t rhs)
       {
         return essential(sink1 & sink2);
       }
    
       operator() (const ptr_t lhs, const ptr_t rhs)
       {
          return apply(lhs, rhs);
       }
    
       static bool is_left_shortcutting(const ptr_t lhs)
       {
          return !value_of(lhs);
       }
    
       static constexpr bool is_left_negating(const ptr_t lhs)
       {
          return false;
       }
    
       // etc.
     }
    • Unit test these extra classes separately.
    • Use these non-generic versions within bdd_and, bdd_or, zdd_intsec, ... (and add new unit tests to cover these specializations)

This would essentially be a stateful policy pattern similar to the ones added in #128 .

@SSoelvsten SSoelvsten added ✨ optimisation It's all about speed / space good first issue Good for newcomers and removed good first issue Good for newcomers labels Nov 3, 2021
@SSoelvsten SSoelvsten added the ❕ breaking version_number++ label Oct 16, 2022
@SSoelvsten SSoelvsten changed the title Move bool_op in product construction into template arguments Move bool_op into prod2's template arguments Nov 22, 2022
@SSoelvsten SSoelvsten added the 📁 internal This is where the ✨magic✨happens label Nov 22, 2022
@SSoelvsten SSoelvsten added the 🎓 student programmer Work, work... label Mar 20, 2023
@SSoelvsten SSoelvsten removed the ❕ breaking version_number++ label Apr 27, 2023
@SSoelvsten SSoelvsten added the ❕ deprecation Some day, something will be superseeded label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❕ deprecation Some day, something will be superseeded 📁 internal This is where the ✨magic✨happens ✨ optimisation It's all about speed / space 🎓 student programmer Work, work...
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant