Abstract
Production compilers such as GCC, Clang, IBM XL and the Intel C Compiler employ multiple loop parallelization techniques that help in the task of parallel programming. Although very effective, these techniques are only applicable to loops that the compiler can statically determine to have no loop-carried dependences (DOALL). Because of this restriction, a plethora of Dynamic DOALL (D-DOALL) loops are outright ignored, leaving the parallelism potential of many computationally intensive applications unexplored. This paper proposes a new analysis tool based on OpenMP clauses that allow the programmer to generate detailed profiling of any given loop by identifying its loop-carried dependences and producing carefully selected execution time metrics. The paper also proposes a set of heuristics to be used in conjunction with the analysis tool metrics to properly select loops which could be parallelized through speculative execution, even in the presence of loop-carried dependences. A thorough analysis of 180 loops from 45 benchmarks of three different suites (cBench, Parboil, and Rodinia) was realized using the Intel C Compiler and the proposed approach. Experimental results using static analysis from the Intel C Compiler showed that only 7.8% of the loops are DOALL. The proposed analysis tool exposed 39.5% May DOALL (M-DOALL) loops which could be eventually parallelized using speculative execution, as exemplified by loops from the Parboil sad program which produced a speedup of 1.92x.
Supported by CCES (Center for Computing in Engineering and Sciences) and FAPESP (São Paulo Research Foundation). Grant Numbers: 2013/08293-7, 2019/04536-9, 2016/15337-9 and 2019/01110-0.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Dependences that arise across different loop iterations.
- 2.
Code duplication can be avoided in some cases, but not always [13].
- 3.
a.k.a. Flow or Read-After-Write (RAW) dependence.
- 4.
a.k.a. Write-After-Read (WAR) dependence.
- 5.
a.k.a. Write-After-Write (WAW) dependence.
- 6.
-q-opt-report5 and -qopt-report-phase=vec.
- 7.
A loop is canonical if and only if it has a single induction variable, a simple test expression, and its induction variable is never modified in the loop body.
- 8.
Average variance across measurements was lower than 0.5% of the mean.
- 9.
12 from cBench, 12 from Parboil and 20 from Rodinia.
- 10.
57 from cBench, 25 from Parboil and 41 from Rodinia.
- 11.
These loops were chosen because they are representative of the values of the presented metrics.
References
LoopAnalyzer Tool Repository: Available at publication time. https://github.com/BrunoChonorio/LoopAnalyzer
Alli, S., Bailey, C.: Compiler-directed dynamic memory disambiguation for loop structures. In: Euromicro Symposium on Digital System Design, 2004, DSD 2004, pp. 130–134 (2004). https://doi.org/10.1109/DSD.2004.1333268
ARM C Language Extensions Documentation, ARM Limited: Transactional Memory Extension (TME) intrinsics (2019). https://developer.arm.com/docs/101028/0009/transactional-memory-extension-tme-intrinsics. Release ACLE Q3 2019. Document Number 101028
Bernstein, D., Cohen, D., Maydan, D.E.: Dynamic memory disambiguation for array references. In: Proceedings of the 27th Annual International Symposium on Microarchitecture, MICRO 27, pp. 105–111. Association for Computing Machinery, New York (1994). https://doi.org/10.1145/192724.192737
Burke, M., Cytron, R.: Interprocedural dependence analysis and parallelization. SIGPLAN Not. 21(7), 162–175 (1986). https://doi.org/10.1145/13310.13328
de Carvalho, J.P., Araujo, G., Baldassin, A.: The case for phase-based transactional memory. IEEE Trans. Parallel Distrib. Syst. 30(2), 459–472 (2018)
Che, S., et al.: Rodinia: a benchmark suite for heterogeneous computing. In: 2009 IEEE International Symposium on Workload Characterization (IISWC), pp. 44–54. IEEE (2009)
Chen, D.K., Yew, P.C.: An empirical study on DOACROSS loops. In: Proceedings of Supercomputing 1991, pp. 620–632. IEEE (1991)
Chowdhury, Rezaul A., Djeu, Peter., Cahoon, Brendon., Burrill, James H., McKinley, Kathryn S.: The limits of alias analysis for scalar optimizations. In: Duesterwald, Evelyn (ed.) CC 2004. LNCS, vol. 2985, pp. 24–38. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-24723-4_3
Cooper, K.D., Kennedy, K.: Fast interprocedual alias analysis. In: Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1989, pp. 49–59. Association for Computing Machinery, New York (1989). https://doi.org/10.1145/75277.75282
Deutsch, A.: Interprocedural may-alias analysis for pointers: beyond k-limiting. SIGPLAN Not. 29(6), 230–241 (1994). https://doi.org/10.1145/773473.178263
Diwan, A., McKinley, K.S., Moss, J.E.B.: Type-based alias analysis. SIGPLAN Not. 33(5), 106–117 (1998). https://doi.org/10.1145/277652.277670
Doerfert, J., Grosser, T., Hack, S.: Optimistic loop optimization. In: Proceedings of the 2017 International Symposium on Code Generation and Optimization, CGO 2017, pp. 292–304. IEEE Press (2017)
Free Software Foundation Inc.: Using the GNU Compiler Collection (2019). https://gcc.gnu.org/onlinedocs/
Fursin, G., Lokhmotov, A., Plowman, E.: Collective knowledge: towards R&D sustainability. In: Proceedings of the Conference on Design, Automation and Test in Europe (DATE 2016) (March 2016)
Gupta, S.K., Sharma, N.: Alias analysis for intermediate code. In: GCC Developers Summit, p. 71. Citeseer (2003)
Hall, Mary W., Murphy, Brian R., Amarasinghe, Saman P., Liao, Shih -Wei, Lam, Monica S.: Interprocedural analysis for parallelization. In: Huang, Chua-Huang, Sadayappan, Ponnuswamy, Banerjee, Utpal, Gelernter, David, Nicolau, Alex, Padua, David (eds.) LCPC 1995. LNCS, vol. 1033, pp. 61–80. Springer, Heidelberg (1996). https://doi.org/10.1007/BFb0014192
Herlihy, M., Moss, J.E.B.: Transactional memory: architectural support for lock-free data structures. In: Proceedings of the 20th Annual International Symposium on Computer Architecture, pp. 289–300 (1993)
Hind, M., Burke, M., Carini, P., Choi, J.D.: Interprocedural pointer alias analysis. ACM Trans. Program. Lang. Syst. 21(4), 848–894 (1999). https://doi.org/10.1145/325478.325519
Hind, M., Burke, M., Carini, P., Midkiff, S.: An empirical study of precise interprocedural array analysis. Sci. Program. 3, 255–271 (1994)
Hind, M., Pioli, A.: Evaluating the effectiveness of pointer alias analyses. Sci. Comput. Program. 39(1), 31–55 (2001). https://doi.org/10.1016/S0167-6423(00)00014-9. http://www.sciencedirect.com/science/article/pii/S0167642300000149. Static Program Analysis (SAS 1998)
Horwitz, S.: Precise flow-insensitive may-alias analysis is NP-hard. ACM Trans. Program. Lang. Syst. 19(1), 1–6 (1997). https://doi.org/10.1145/239912.239913
Huang, A.S., Slavenburg, G., Shen, J.P.: Speculative disambiguation: a compilation technique for dynamic memory disambiguation. In: Proceedings of the 21st Annual International Symposium on Computer Architecture, ISCA 1994, pp. 200–210. IEEE Computer Society Press, Washington, DC (1994). https://doi.org/10.1145/191995.192012
IBM Corporation: IBM Power ISA, Version 3.0 B (2017)
IBM Corporation: IBM XL C/C++ for Linux: Compiler Reference, Version 16.11 (SC27-8047-01) (2018)
Intel Corporation: Intel® C++ Compiler Developer Guide and Reference (Version 19.1) (2019)
Intel Corporation: Intel® Architecture Instruction Set Extensions Programming Reference (2020). Reference Number 319433–038
Kirk, D.B., Wen-Mei, W.H.: Programming Massively Parallel Processors: A Hands-on Approach. Morgan Kaufmann, Burlington (2016)
Landi, W., Ryder, B.G.: Pointer-induced aliasing: a problem classification. In: Proceedings of the 18th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 93–103 (1991)
Lattner, C., Adve, V.: LLVM: a compilation framework for lifelong program analysis & transformation. In: Proceedings of the International Symposium on Code Generation and Optimization: Feedback-Directed and Runtime Optimization, CGO 2004, pp. 75–86. IEEE Computer Society, Washington, DC (2004). http://dl.acm.org/citation.cfm?id=977395.977673
Maydan, D.E., Hennessy, J.L., Lam, M.S.: Efficient and exact data dependence analysis. SIGPLAN Not. 26(6), 1–14 (1991). https://doi.org/10.1145/113446.113447
Maydan, D.E., Hennessy, J.L., Lam, M.S.: Effectiveness of data dependence analysis. Int. J. Parallel Program. 23(1), 63–81 (1995)
Moshovos, A., Breach, S.E., Vijaykumar, T.N., Sohi, G.S.: Dynamic speculation and synchronization of data dependences. SIGARCH Comput. Archit. News 25(2), 181–193 (1997). https://doi.org/10.1145/384286.264189
Nakaike, T., Odaira, R., Gaudet, M., Michael, M.M., Tomari, H.: Quantitative comparison of hardware transactional memory for Blue Gene/Q, zEnterprise EC12, Intel Core, and POWER8. SIGARCH Comput. Archit. News 43(3S), 144–157 (2015). https://doi.org/10.1145/2872887.2750403
Nicolau, A.: Run-time disambiguation: coping with statically unpredictable dependencies. IEEE Trans. Comput. 38(5), 663–678 (1989). https://doi.org/10.1109/12.24269
OpenMP Architecture Review Board: OpenMP application program interface version 5.0 (November 2018). http://www.openmp.org
Padua, D.A., Wolfe, M.J.: Advanced compiler optimizations for supercomputers. Commun. ACM 29(12), 1184–1201 (1986). https://doi.org/10.1145/7902.7904
Robert, Valentin, Leroy, Xavier: A formally-verified alias analysis. In: Hawblitzel, Chris, Miller, Dale (eds.) CPP 2012. LNCS, vol. 7679, pp. 11–26. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-35308-6_5
Sato, T.: Speculative resolution of ambiguous memory aliasing. In: Proceedings Innovative Architecture for Future Generation High-Performance Processors and Systems, pp. 17–26 (1997)
Steensgaard, B.: Points-to analysis in almost linear time. In: Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1996, pp. 32–41. Association for Computing Machinery, New York (1996). https://doi.org/10.1145/237721.237727
Stratton, J.A., et al.: Parboil: a revised benchmark suite for scientific and commercial throughput computing. Cent. Reliab. High-Perform. Comput. 127 (2012)
Wolfe, M.J.: High Performance Compilers for Parallel Computing. Addison-Wesley Longman Publishing Co., Inc., Boston (1995)
Wu, Y., Chen, L.L., Ju, R., Fang, J.: Performance potentials of compiler-directed data speculation. In: Proceedings of the 2003 IEEE International Symposium on Performance Analysis of Systems and Software, ISPASS 2003, pp. 22–31. IEEE Computer Society, USA (2003)
Yoo, R.M., Hughes, C.J., Lai, K., Rajwar, R.: Performance evaluation of intel® transactional synchronization extensions for high-performance computing. In: Proceedings of the International Conference on High Performance Computing, Networking, Storage and Analysis, SC 2013. Association for Computing Machinery, New York (2013). https://doi.org/10.1145/2503210.2503232
Zheng, X., Rugina, R.: Demand-driven alias analysis for C. In: Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2008, pp. 197–208. Association for Computing Machinery, New York (2008). https://doi.org/10.1145/1328438.1328464
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Honorio, B.C., de Carvalho, J.P.L., Skaf, M., Araujo, G. (2020). Using OpenMP to Detect and Speculate Dynamic DOALL Loops. In: Milfeld, K., de Supinski, B., Koesterke, L., Klinkenberg, J. (eds) OpenMP: Portable Multi-Level Parallelism on Modern Systems. IWOMP 2020. Lecture Notes in Computer Science(), vol 12295. Springer, Cham. https://doi.org/10.1007/978-3-030-58144-2_15
Download citation
DOI: https://doi.org/10.1007/978-3-030-58144-2_15
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-58143-5
Online ISBN: 978-3-030-58144-2
eBook Packages: Computer ScienceComputer Science (R0)