Commit Graph

112 Commits

Author SHA1 Message Date
Emil J 7719beb4ae
Merge pull request #5349 from rocallahan/cleanup-hashops
Reduce hashops verbiage in `OptMergePass`
2025-09-30 19:34:44 +02:00
Robert O'Callahan 4fe21dd652 Reduce hashops verbiage in OptMergePass 2025-09-19 03:31:46 +00:00
Emil J. Tywoniak d6d1f16c43 hashlib: add insertion order const iterator 2025-09-16 15:39:13 +02:00
Robert O'Callahan f61e3377a9 Hash strings 8 bytes at a time 2025-09-16 03:17:24 +00:00
Emil J 201c40072c
Merge pull request #5327 from YosysHQ/emil/do_insert-dont-build-new-hash
hashlib: don't build an unused hash for expired value in do_insert
2025-09-09 21:53:39 +02:00
Emil J. Tywoniak ccf140f2ef hashlib: don't build an unused hash for expired value in do_insert 2025-09-04 14:47:45 +02:00
Robert O'Callahan 54a258f854 In hash_cell_inputs, avoid constructing an std::pair (which requires copying the port IdString) 2025-09-04 14:17:08 +02:00
Robert O'Callahan b5aa3ab9f7 hash_ops should take all parameters by reference instead of requiring copies of vectors, tuples etc 2025-08-25 03:09:04 +00:00
Robert O'Callahan 3a5742ffd2 Improve commutative hashing.
The simple XOR `commutative_eat()` implementation produces a lot of collisions.
https://www.preprints.org/manuscript/201710.0192/v1/download is a useful reference on this topic.

Running the included `hashTest.cc` without the hashlib changes, I get 49,580,349 collisions.
The 49,995,000 (i,j) pairs (0 <= i < 10000, i < j < 10000) hash into only 414,651 unique hash values.
We get simple collisions like (0,1) colliding with (2,3).

With the hashlib changes, we get only 707,099 collisions and 49,287,901 unique hash values.
Much better! The `commutative_hash` implementation corresponds to `Sum(4)` in the paper
mentioned above.
2025-08-19 21:45:52 +00:00
Robert O'Callahan 2654bd5355 Compute `is_port` in AbcPass without iterating through all cells and wires in the module every time we run ABC.
This does not scale when we run ABC thousands of times in a single AbcPass.
2025-08-14 22:29:45 +00:00
Robert O'Callahan 4bf7c23e2b Make `pool` const lookup methods take a lookup path that never rehashes the table.
This avoids the need to cast away `const` and makes these methods thread-compatible.
2025-07-17 23:40:35 +00:00
Robert O'Callahan cf9720ecab Make const lookup methods take a lookup path that never rehashes the table.
This avoids the need to cast away `const` and makes these methods
thread-compatible.
2025-07-17 23:40:26 +00:00
mikesinouye 93780bb869
Add <optional> to haslib.h which uses std::optional 2025-05-06 09:57:03 -07:00
Emil J. Tywoniak aa01ef3312 hashlib: simplify loopback. NFC 2025-01-20 16:15:48 +01:00
Emil J. Tywoniak 901935fbce hashlib: merge hash_ops with hash_top_ops for plugin compat 2025-01-14 21:41:33 +01:00
Emil J. Tywoniak a58481e9b7 mark all hash_into methods nodiscard 2025-01-14 12:39:15 +01:00
Emil J. Tywoniak a2805b15c9 hashlib: fix hash_obj_ops discarding hash value 2025-01-14 12:36:24 +01:00
mikesinouye de9cb5a60c
Remove spurious prime 2025-01-02 11:05:30 -08:00
mikesinouye 1ae0d8432f
Approximately double the max hash table size 2025-01-02 08:59:11 -08:00
Emil J. Tywoniak 026e9dae9d hashlib: fixes from jix 2024-12-18 15:09:25 +01:00
Emil J. Tywoniak ed70038aa1 hashlib: fixes from jix 2024-12-18 15:09:25 +01:00
Emil J. Tywoniak b9b9515bb0 hashlib: hash_eat -> hash_into 2024-12-18 15:09:25 +01:00
Emil J. Tywoniak 0a525f38c2 hashlib: declare YS_HASHING_VERSION = 1 2024-12-18 15:09:25 +01:00
Emil J. Tywoniak 1df8a3e64b hashlib: legacy mkhash_add -> djb2_add 2024-12-18 15:09:25 +01:00
Emil J. Tywoniak 4e29ec1854 hashlib: acc -> eat 2024-12-18 15:09:25 +01:00
Emil J. Tywoniak 79acc141d5 hashlib: add deprecated mkhash function to prevent plugin breakage 2024-12-18 14:58:53 +01:00
Emil J. Tywoniak ad0dc17711 docs: document the ideas behind the hashing interface 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak 0dafe06cd4 hashlib: run_hash uses hash_top_ops, not hash_ops 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak 02a578365a hashlib: remove is_new from HasherDJB32, implement hash_top for IdString 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak 52b0fc03b7 hash: solo hashing interface, override for SigBit 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak 4d14399749 hashlib: allow forcing Hasher state, use it for IdString trivial hashing 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak c1af19fabc hashlib: don't xorshift in between upper and lower word 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak 209ab6fb72 hashlib: fudge always 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak 582259f770 hashlib: hash_t can be set to 64-bit 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak b8738e2bd7 hashlib: use hash_t across the board 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak c73c88033d hashlib: only include in one place 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak db04788c18 hashlib: fix pyosys 2024-12-18 14:58:31 +01:00
Emil J. Tywoniak 953508f6d2 driver: add --hash-seed 2024-12-18 14:58:29 +01:00
Emil J. Tywoniak d071489ab1 hashlib: redo interface for flexibility 2024-12-18 14:49:25 +01:00
Mike Inouye 1e3973c5cb Explictly #include <variant> for std::variant usage.
Signed-off-by: Mike Inouye <mikeinouye@google.com>
2024-10-07 21:57:30 +00:00
Emily Schmidt fbee31080e add optional header and hashlib implementation for optional 2024-08-21 11:04:11 +01:00
Emily Schmidt 248d5f72d4 add support for std::variant to hashlib 2024-08-21 11:01:09 +01:00
Emil J 051d83205d
Merge pull request #4471 from georgerennie/hashlib_primes
hashlib: Add some more primes
2024-07-29 15:10:22 +02:00
Emil J. Tywoniak 583db7b15e sigmap: comments 2024-07-18 16:02:11 +02:00
George Rennie 339d4e8932 hashlib: Correct prime sequence 2024-07-02 08:10:18 +01:00
George Rennie 78ae4ed9ac hashlib: Add some more primes
* Add some primes as suggested in #4458. This allows larger hashtables
  to be allocated for very big designs
2024-07-01 12:37:41 +01:00
Martin Povišer 66479a2232 hashlib: Add missing `stdint.h` include
We use `uint32_t` `uint64_t` etc. so add an explicit include.
2024-02-08 14:27:12 +00:00
Claire Xenia Wolf fb72dc1a40 Add constexpr hashlib default constructors
Signed-off-by: Claire Xenia Wolf <claire@clairexen.net>
2023-12-29 19:20:44 +01:00
Martin Povišer 189064b8da rtlil, hashlib: Remove deprecated `std::iterator` usage
`std::iterator` has been deprecated in C++17. Yosys is being compiled
against the C++11 standard but plugins can opt to compile against a
newer one. To silence some deprecation warnings when those plugins are
being compiled, replace the `std::iterator` inheritance with the
equivalent type declarations.
2023-12-09 19:01:39 +01:00
Rasmus Munk Larsen 8e0308b5e7 Revert changes to celltypes.h. Use dict instead of std::unordered_map and most hash function for uint64_t to hashlib.h to support this. 2023-10-03 14:25:59 -07:00