Loading...
Please wait, while we are loading the content...
Similar Documents
Compiler optimisations and relaxed memory consistency models
| Content Provider | Hyper Articles en Ligne (HAL) |
|---|---|
| Researcher | Morisset, Robin |
| Date of Submission | 2017-04-05 |
| Abstract | Modern multiprocessors architectures and programming languages exhibit weakly consistent memories. Their behaviour is formalised by the memory model of the architecture or programming language; it precisely defines which write operation can be returned by each shared memory read. This is not always the latest store to the same variable, because of optimisations in the processors such as speculative execution of instructions, the complex effects of caches, and optimisations in the compilers. In this thesis we focus on the C11 memory model that is defined by the 2011 edition of the C standard. Our contributions are threefold. First, we focused on the theory surrounding the C11 model, formally studying which compiler optimisations it enables. We show that many common compiler optimisations are allowed, but, surprisingly, some important ones are forbidden. Secondly, building on our results, we developed a random testing methodology for detecting when mainstream compilers such as GCC or Clang perform an incorrect optimisation with respect to the memory model. We found several bugs in GCC, all promptly fixed. We also implemented a novel optimisation pass in LLVM, that looks for special instructions that restrict processor optimisations - called fence instructions - and eliminates the redundant ones. Finally, we developed a user-level scheduler for lightweight threads communicating through first-in first-out single-producer single-consumer queues. This programming model is known as Kahn process networks, and we show how to efficiently implement it, using C11 synchronisation primitives. This shows that despite its flaws, C11 can be usable in practice. |
| File Format | |
| Language | French English |
| Publisher Institution | PSL Research University |
| Access Restriction | Open |
| Subject Keyword | Memory model Memory consistency model C11 Compiler optimisations Fence Modèle mémoire Optimisations Compilateur Barrière info Computer Science [cs] Other [cs.OH] |
| Content Type | Text |
| Resource Type | Thesis |