-
Notifications
You must be signed in to change notification settings - Fork 16
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
Split transactron core #617
Split transactron core #617
Conversation
transactron/core/transaction.py
Outdated
|
||
|
||
@dataclass(frozen=True) | ||
class TransactionManagerKey(SimpleKey["TransactionManager"]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if string in generic argument to SimpleKey
is a feature, but it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not a bad split. I sure hope this PR foretells the end of the refactor season ;)
This is related to #446. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The split structure also makes sense for me, everything is more readable now :)
EDIT: Shouldn't TransactionManagerKey
be placed in core/manager.py
instead of core/transaction.py
? [I'll approve after answer to that point]
For some bikeshedding:
I don't think that eager_deterministic_cc_scheduler
, trivial_roundrobin_cc_scheduler
and TransactionManagerKey
shold be imported by default from transactron import *
(if we care about default imports structure at all).
Not in the scope of this PR but before we separate transactron, I have two concerns about lib and utils:
- _typing.py -> typing.py - Underscore is misleading that it contains internal transactron types, while it has many useful types for Amaranth or use of transactron concepts externally in designs (also
# Internal Coreblocks types
:) ) - utils/transactron_helpers.py - is it supposed to contain functions used only internally in transactron? Now some of that functions look like that, but others (like functions for layouts) are used in Coreblocks and are useful for external use. I would split that to
utils/_transactron_utils.py
(with emphasized private underscore) and second file.
That was my initial idea, but this cause cyclic dependency. Other possibility is to move |
Theoretically transactron was written with possibility to use user own instances of TransactionManager with chosen scheduler. That is the reason why I decided to export the symbols. |
:(
I would be for separate file then (maybe
My point is that is should be imported via |
Moved.
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
One more try to split
transactron/core.py
. I have started from scratch, because from the last one passed half a year. There was no changes in the code except imports and changing objects in types to type strings.