This is a description of the artifact supplementing the paper Reconciling Event Structures with Modern Multiprocessors by Evgenii Moiseenko, Anton Podkopaev, Ori Lahav, Orestis Melkonian, and Viktor Vafeiadis.
The artifact is two Coq packages
(imm.1.1 and weakestmoToImm) in a VirtualBox image.
The image has been tested with VirtualBox 5.2.34 with Oracle VM VirtualBox Extension pack.
Import the VirtualBox image into VirtualBox, and boot the machine.
The login is semantics and the password is semantics.
All necessary software is installed, and the imm and weakestmoToImm projects are checked out to
/home/semantics/Desktop/imm and /home/semantics/Desktop/weakestmoToImm correspondingly.
Additionally, Emacs (with Proof General), VS Code, and CoqIDE are installed so that you can browse the sources
and the latest version of the paper copied to /home/semantics/Desktop/paper.pdf.
- Coq 8.9.1
- Hahn library (
coq-hahn) - Utility library from the Promising semantics development (
coq-promising-lib) - Intermediate Memory Model (
coq-imm.1.1)
Please, note that coq-imm.1.1 is a dependency for weakestmoToImm, but it is also a part of our artifact.
The preinstalled version of coq-imm is exactly the same as code checked out in /home/semantics/Desktop/imm.
The proofs might be checked by opening a terminal and running
cd /home/semantics/Desktop/imm
make clean; make -j2for imm and
cd /home/semantics/Desktop/weakestmoToImm
make clean; make -j2for weakestmoToImm.
There might be some warnings about notations. The build terminating without printing "error" is successful.
Please, note that building of the proofs might take a lot of time (especially, the imm project).
The code supplementing the paper is spread over two packages:
imm, where we extended theIMMmemory model with support for SC accesses comparing to the version from [Podkopaev-al:POPL19];weakestmoToImm, which contains definitions of theWeaketmomemory model and our proof of compilation correctness fromWeakestmotoIMM.
Below, there is a mapping from definitions and statements used in the paper to their counterparts in the Coq code.
- The main theorem of compilation correctness from Weakestmo to IMM (Theorem 1 from the paper) is represented
by
compilation_correctnessstated inweakestmoToImm/src/compilation/Compilation.v. - The simulation relation
Iused to prove Theorem 1 is represented bysimrel_consistentinweakestmoToImm/src/compilation/SimRel.v. - Lemma 2 stating that the simulation relation
Iholds for the initial event structure corresponds tosimrel_initinweakestmoToImm/src/compilation/SimRelInit.v. - Lemma 3 stating that the simulation relation
Ican be restored after a traversal step is represented bysimrel_stepinweakestmoToImm/src/compilation/SimRelStep.v. - Lemma 4 stating that if
Iholds for the final traversal configuration then the graph associated with the extracted subsetXis isomorphic to the original IMM graphGis represented bysimrel_extractinweakestmoToImm/src/compilation/Compilation.v
- (§3.1) Events of event structures are encoded by
eventid(which is equal tonat) defined inweakestmoToImm/src/model/EventStructure.v.
Labels (labelin Coq) are defined in fileimm/src/basic/Events.v. - (§3.2) Event structures (
ES.tin Coq) and the well-formedness predicate (ES.Wfin Coq) stating basic properties of their components are defined inweakestmoToImm/src/model/EventStructure.v. - (§3.3) A step of operational semantics of event structure construction (
stepin Coq) is defined inweakestmoToImm/src/construction/Step.v. - (§3.4) The Weakestmo event structure consistency predicate along with definitions of relations
hbandecfand the notion of visible events (predicatevisin Coq) are defined inweakestmoToImm/src/model/Consistency.v.
(The consistency predicate is parameterized bymodelwhich is eitherWeakestorWeakestmo. The former represents a version of Weakestmo [Chakraborty-Vafeiadis:POPL19] which is not considered in our paper.)
In footnote 9, we mention that our Coq formalization uses another definition of visible events (predicatevisin Coq) comparing to the one in [Chakraborty-Vafeiadis:POPL19]. Their equivalence is stated by lemmacc_altinweakestmoToImm/src/model/Consistency.v. - (§3.5)
The notion of execution graph (Definition 6,
executionin Coq) is defined in fileimm/src/basic/Execution.v. Unlike the paper representation, it is not defined as a special case of event structures. Moreover, as mentioned in footnote 11, execution graphs are defined with another type of events (actidin Coq, fileimm/src/basic/Events.v).
The notion of a subset of events extracted from an event structure (Definition 7,Execution.tin Coq) is defined inweakestmoToImm/src/model/Execution.v.
The notion of a execution graph associated with an extracted subset (simrel_extractin Coq) is defined inweakestmoToImm/src/compilation/Compilation.v.
- Function
s2g(G, S)from the paper (which maps events of event structureSto events of execution graphG) is represented by functione2a(stands for 'eventidtoactid') defined inweakestmoToImm/src/imm_aux/EventToAction.v. - In Coq, functions
⌈⌈·⌉⌉and⌊⌊·⌋⌋for liftings2gto sets are represented ase2a □₁ ·ande2a ⋄₁ ·correspondingly; their relational counterparts—e2a □ ·ande2a ⋄ ·.
The simulation relation I is represented by simrel_consistent (and its part simrel) in weakestmoToImm/src/compilation/SimRel.v.
Below, we map elements of the paper's version of I to the Coq version.
Most of them are represented by fields of simrel or derivable from them:
gcons(a field insimrel).SCONS(an entry insimrel_consistent).sr_exec(a field insimrel).ex_cov_iss(a field insimrel).- (a) Equality of events' threads and labels up to values for events connected via
e2ais represented bysr_e2a(a field insimrel). It uses auxiliary definitionsimrel_e2adefined inweakestmoToImm/src/compilation/SimRelEventToAction.v.
(b) Equality of labels for events and their covered and issued counterparts is represented byex_cov_iss_lab(a field insimrel). - Derivable from
sr_e2avia lemmae2a_sbstated inweakestmoToImm/src/imm_aux/EventToAction.v. - Derivable from
sr_e2avia lemmae2a_eq_in_cfstated inweakestmoToImm/src/imm_aux/EventToAction.v. - (a) Field
e2a_jfofsimrel_e2a(which is represented insimrelvia fieldsr_e2a) defined inweakestmoToImm/src/compilation/SimRelEventToAction.v.
(b) Lemmajf_cov_iv_rfstated inweakestmoToImm/src/compilation/SimRel.vderivable fromjf_ex_in_cert_rf(a field insimrel). jfe_ex_iss(a field insimrel).- Field
e2a_ewofsimrel_e2a(which is represented insimrelvia fieldsr_e2a) defined inweakestmoToImm/src/compilation/SimRelEventToAction.v. ew_ex_iss(a field insimrel).- Field
e2a_coofsimrel_e2a(which is represented insimrelvia fieldsr_e2a) defined inweakestmoToImm/src/compilation/SimRelEventToAction.v.
In our proof, we show that Lemma 3, the simulation step (in Coq, simrel_step in weakestmoToImm/src/compilation/SimRelStep.v),
holds by doing induction on a certification run.
During the induction, we preserve predicate simrel_cert defined in weakestmoToImm/src/compilation/SimRelCert.v.
- (§4.3.1) The
determinedset (Din Coq), relationsvfandsjf(cert_rfin Coq) are defined inweakestmoToImm/src/compilation/CertRf.v.
The certification run is defined via predicatecert_graphand constructed via lemmacert_graph_startinweakestmoToImm/src/compilation/CertGraph.v.
The proof ofcert_graph_startuses the receptiveness property (receptiveness_fullin Coq, defined in fileimm/src/promiseToImm/Receptiveness.v) which is mentioned in footnote 12.
As mentioned in [Podkopaev-al:POPL19], we have two versions of the IMM model being implemented in Coq:
IMM (file imm/src/imm/imm.v) and IMM_S (file imm/src/imm/imm_s.v).
Paradoxically, IMM_S is the one we refer to in the paper and IMM is a stronger version of it, which we use as another intermediate
step in compilation correctness proofs to hardware models.
The proof of compilation correctness from IMM_S to IMM is presented in
imm/src/imm/imm_sToimm.v.
The extension of IMM_S-consistency predicate to SC accesses (Definition 10) is defined by
predicate imm_psc_consistent in file imm/src/imm/imm_s.v,
whereas the extension for IMM is embedded in predicate imm_consistent in file imm/src/imm/imm.v.
Versions of relations scb, psc_base, and psc_f for both model are defined in the corresponding files.
-
(§5.1.1) The compilation correctness theorem from
IMM_SCtoTSOis represented by lemmaIMM_consistentinimm/src/hardware/immToTSO.v. It has a precondition stating that there should be anmfencebetween every SC write and following SC read as mentioned in the paper. -
(§5.1.2) Theorem 12 is represented by lemma
global_sc_arinimm/src/imm/Sc_opt.vcompilation correctness theorem fromIMM_SCtoPOWERis split to a compilation
The compilation correctness theorem fromIMM_SCtoPOWER(assuming the absence of SC accesses which are dealt by Theorem 12) is represented by lemmaIMM_consistentinimm/src/hardware/immToPower.v. -
(§5.1.4) The compilation correctness theorem from
IMM_SCtoARMv8is represented by lemmaIMM_consistentinimm/src/hardware/immToARM.v.