Clock: Move the clock and related functions to ClockedObject
Review Request #1303 - Created July 10, 2012 and submitted
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 9127:f00508d2c790 --------------------------- Clock: Move the clock and related functions to ClockedObject This patch moves the clock of the CPU, bus, and numerous devices to the new class ClockedObject, that sits in between the SimObject and MemObject in the class hierarchy. Although there are currently a fair amount of MemObjects that do not make use of the clock, they potentially should do so, e.g. the caches should at some point have the same clock as the CPU, potentially with a 1:n ratio. This patch does not introduce any new clock objects or object hierarchies (clusters, clock domains etc), but is still a step in the direction of having a more structured approach clock domains. The most contentious part of this patch is the serialisation of clocks that some of the modules (but not all) did previously. This serialisation should not be needed as the clock is set through the parameters even when restoring from the checkpoint. In other words, the state is "stored" in the Python code that creates the modules. The nextCycle methods are also simplified and the clock phase parameter of the CPU is removed (this could be part of a clock object once they are introduced).
util/regress all passing (disregarding t1000 and eio)
Posted (July 18, 2012, 1:26 a.m.)
I love the idea of this, but I still think that this does not belong in MemObject. I think that we should really have a ClockedObject class that derives from SimObject and that MemObject should derive from that. There are a number of things that use a clock that aren't necessarily MemObjects that could be moved over to the ClockedObject. Also, I have a bunch of random event queue diffs that you might be interested in. Let me know if you want me to send them your way.
Review request changed
Updated (July 18, 2012, 7:07 p.m.)
Summary: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 2 (+34 -120) |
Posted (July 18, 2012, 8:32 p.m.)
You forgot to add ClockedObject.py.
Review request changed
Updated (July 18, 2012, 10:46 p.m.)
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+197 -120) |
Posted (July 19, 2012, 3:25 a.m.)
I agree with your removal of the serialization code, but I think there are important caveats. On one hand, it makes sense that I should be able to take a checkpoint with a 1GHz CPU and restore that to a 2GHz CPU (just like I can transition from a simple CPU to O3 via a checkpoint). On the other hand, we will need to be very careful that state derived from the clock (e.g., the next event time, or some latency values) is also recalculated and not serialized. I don't know that there's anything to do about it at this point; this is just yet another category of potential bugs to keep an eye out for.
-
src/arch/x86/interrupts.cc (Diff revision 3) -
Is this really necessary? As you say in the other comment, this should all be done in python eventually anyway...
Posted (July 19, 2012, 5:52 a.m.)
-
src/sim/ClockedObject.py (Diff revision 3) -
Do we want a clock phase? I certainly wanted that when I did a similar thing. I'll send you some code that manages that. It could be pushed off to a future changeset.
-
src/sim/clocked_object.hh (Diff revision 3) -
This is likely premature optimization, but sticking a div in every clock schedule seems scary. The trick that I've used in the past was to save the clock tick and check to see if curtick is == to the saved tick. If so, you can just do an add and almost all the time, the condition will pass. Again, perhaps over optimized. I'll send you the code.
-
src/sim/clocked_object.hh (Diff revision 3) -
I'm ok with this, but it would be nice to know if we're leaving some performance on the table by doing this. I imagine atomic simple cpu would be the best test case.
Posted (July 28, 2012, 5:25 a.m.)
-
src/sim/clocked_object.hh (Diff revision 3) -
So I didn't notice this until I was looking at the more recent patch with the 'tick' and 'clock' vars, but doesn't it seem like, if curTick() is currently on a clock edge, that nextCycle() would return the curTick()+clock and not curTick()? I'm assuming that it's doing this for compatibility with the existing CPU nextCycle() methods, but is this a good time to address this (if people agree that it's a bug, or at least confusing)?
Ship It!
