Refactor EventFactory, Compilers and Parsers#1009
Refactor EventFactory, Compilers and Parsers#1009xeren wants to merge 29 commits intodevelopmentfrom
Conversation
|
@xeren can you please rebase and fix the conflicts? |
…actory # Conflicts: # dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAArch64.java # dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java # dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPPC.java # dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java # dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusRISCV.java # dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java # dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusX86.java # dartagnan/src/test/java/com/dat3m/dartagnan/others/miscellaneous/AnalysisTest.java
hernanponcedeleon
left a comment
There was a problem hiding this comment.
Why are you adding newRMWLoadExclusive for each arch if they all end up calling the general case? While I could see an argument in the factory for having the method for each arch, we do have other "common" events that use a single method, e.g. newRMWStoreExclusiveWithMo
dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java
Outdated
Show resolved
Hide resolved
I agree with you but maybe from a different point of view. I think it becomes more and more unclear of whether a (*) It is fine to generate core events from the parser, but not if you intend to support compilation to other targets on those events (at least in our current architecture). |
|
With the different |
dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPPC.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusRISCV.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorPower.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java
Outdated
Show resolved
Hide resolved
Remove EventFactory.C11 Remove EventFactory.Linux.newFence(String) Rename EventFactory.Spirv methods Rename EventFactory.Linux methods
Outline newFakeCtrlDependency(Register) Outline newAssignExecutionStatus(Register, Event)
|
In the latest commit I removed the individual barrier constructors in From my side, this PR should be ready to merge. |
dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusRISCV.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorC11.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java
Outdated
Show resolved
Hide resolved
|
Looks good to me. @hernanponcedeleon might want to take look once he has time. |
dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusX86.java
Outdated
Show resolved
Hide resolved
dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/ProgramParser.java
Outdated
Show resolved
Hide resolved
| public static Event newStoreOp(Expression address, IntBinaryOp operator, Expression operand, MemoryOrder mo) { | ||
| final Event st = EventFactory.Common.newRmwOp(address, operator, operand); | ||
| // ignore acquire tag | ||
| st.addTags(toRelTag(mo)); | ||
| st.setMetadata(STOP_PRINTING); | ||
| return st; | ||
| } |
There was a problem hiding this comment.
I am confused about this method and newLoadOp. The names suggest they are simply load or store operations, but then we call RMW methods. Also, the load one adds both release and acquire tags, but the store one ignores the acquire one. Why?
There was a problem hiding this comment.
Those are LDADD/STADD (and its variants, i.e, LD<OP> and ST<OP>) in arm8. That's also why the StoreOp ignores acquire.
He just moved the code from the Arm8Visitor into the EventFactory.
There was a problem hiding this comment.
But then why does not the load one ignore the release?
There was a problem hiding this comment.
Maybe you forgot what these operations mean :)
LD<OP> == fetch_op, i.e., it has a proper load followed by a proper store both of which can have memory orderings.
ST<OP> == store_op (atomic reduction), i.e., it technically has no load (non-returning) and only its store can have a memory ordering. To be fair, the code should probably throw an exception when trying to use ACQ/ACQ_REL memory orderings for ST<OP>.
There was a problem hiding this comment.
Yes, like with newBarrier/newFence, newLoadReserved/newLoadExclusive, etc.. I chose these names to correspond with the instructions of the associated ISAs/Languages (and to abstract from our IR's).
There was a problem hiding this comment.
To be fair, the code should probably throw an exception when trying to use ACQ/ACQ_REL memory orderings for
ST<OP>.
This is still open
Mostly cleans up some imports, but also
ProgramBuilder.addChildin litmus parsers.FenceNameRepositoryintoEventFactoryModifications to
EventFactoryAdded
AArch64.newRMWLoadExclusive,AArch64.newRMWStoreExclusiveX86.newLoadFence,newStoreFence(still not implemented, but merges two places)RISCV.newRMWLoadExclusivePower.newRMWLoadExclusiveModified
newRMWStoreExclusive,newRMWStoreExclusiveWithMoAArch64.newDmbBarrier, etc.AArch64.newBarrier(String,String)(moved fromnewFenceOpt)RISCV.newRMWStoreConditionalnewFakeCtrlDep(Register)(returnsList<Event>and does no longer accept aLabel)