研究生: |
洪明郁 Hung, Ming-Yu |
---|---|
論文名稱: |
靜態單賦值形式支援機率化指標分析 Support of Probabilistic Pointer Analysis in the SSA Form |
指導教授: |
李政崑
Lee, Jenq Kuen |
口試委員: |
許雅三
Hsu, Yar-Sun 賴尚宏 Lai, Shang-Hong 王廷基 Wang, Ting-Chi 黃元欣 Hwang, Yuan-Shin 黃冠寰 Hwang, Gwan-Hwan 楊武 Yang, Wuu 陳鵬升 Chen, Peng-Sheng |
學位類別: |
博士 Doctor |
系所名稱: |
電機資訊學院 - 資訊工程學系 Computer Science |
論文出版年: | 2012 |
畢業學年度: | 100 |
語文別: | 英文 |
論文頁數: | 81 |
中文關鍵詞: | 編譯器 、指標分析 、機率化 、靜態單賦值形式 |
外文關鍵詞: | compiler, pointer analysis, probabilistic, SSA form |
相關次數: | 點閱:2 下載:0 |
分享至: |
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報 |
機率化指標分析是一種編譯器時期的分析方法,它可以估計在程式中某
一個位置的指標指向關係機率。這種分析的結果可以用於需要量化資訊的
最佳化和平行化的編譯器。本論文提出一種使用靜態單賦值形式完成的機
率化指標分析。
當計算某一個指標的指向機率時,必須先建立指標相依圖形,指標相依
圖形可以表示出此指標的所有可能指向關係,之後經過一連串的圖形簡化
程序,指標相依圖形會被轉成精簡的指標相依圖形,而這個精簡的相依圖
形,正是機率化指標分析的結果。除此之外,透過加入考慮函數相關的敘
述,機率化指標分析更進一步的被擴充為跨程序的分析。
我們基於提出的理論在開放研究編譯器( Open64 ) 上實作兩種版本,
包含靜態與剖面資訊賦予。靜態資訊賦予的版本是靜態給定程式分歧機率
各半;離開迴圈的機率是一成。相對的,剖面資訊賦予的版本是使用開放
研究編譯器的剖面工具,取得程式實際執行的分歧機率。
實驗結果顯示剖面資訊賦予的版本平均誤差為3.80%,而靜態資訊賦予
的版本是9.13%。最後使用SPEC CPU2006 基準程式,測出機率化指標分
析的可擴展性。
更進一步的,我們將機率化指標分析的結果,用於引導編譯器去進行更
積極的最佳化:臆測執行最佳化。臆測執行最佳化的缺點就是,當執行臆
測錯誤時,就會有額外的恢復重新執行的效能損失。因為機率化指標分析
的資訊可以引導編譯器該不該執行這個最佳化,讓程式可以具有臆測執行
最佳化帶來的平行效果,而不用承擔臆測太多錯誤帶來的效能衰減。
關鍵詞:編譯器、指標分析、控制流程圖、靜態單賦值形式。
Probabilistic pointer analysis (PPA) is a compile-time analysis method
that estimates the probability that a points-to relationship will hold at a particular
program point. The results are useful for optimizing and parallelizing
compilers, which need to quantitatively assess the profitability of transformations
when performing aggressive optimizations and parallelization. This dissertation
presents a PPA technique using the static single assignment (SSA)
form. When computing the probabilistic points-to relationships of a specific
pointer, a pointer relation graph (PRG) is first built to represent all of the
possible points-to relationships of the pointer. The PRG is transformed by
a sequence of reduction operations into a compact graph, from which the
probabilistic points-to relationships of the pointer can be determined. In
addition, PPA is further extended to interprocedural cases by considering
function related statements. We have implemented our proposed scheme including
static and profiling versions in the Open64 compiler, and performed
experiments to obtain the accuracy and scalability. The static version estimates
branch probabilities by assuming that every conditional is equally
likely to be true or false, and that every loop executes ten times before terminating.
The profiling version measures branch probabilities dynamically
from past program executions using a default workload provided with the
benchmark. The average errors for selected benchmarks were 3.80% in the
profiling version and 9.13% in the static version. Finally, SPEC CPU2006
is used to evaluate the scalability, and the result indicates that our scheme
is sufficiently efficient in practical use. The average analysis time was 35.59
seconds for an average of 98696 lines of code.
In addition to evaluating the correctness and scalability of PPA, a PPAguided
speculation optimization is proposed. Originally, speculation execution
may cause performance decrease, because of many mis-speculations.
With the aid of PPA, a proposed cost model can guide compiler to do the
speculation execution or not. Thus, the compiler can always get the better
performance by executing parallely and avoiding mis-speculations.
Keywords:
compiler, pointer analysis, static single assignment (SSA) form
[1] M. Shapiro and S. Horwitz, “Fast and accurate flow-insensitive pointsto
analysis,” in POPL ’97: Proceedings of the 24th ACM SIGPLANSIGACT
Symposium on Principles of Programming Languages. New
York, NY, USA: ACM, 1997, pp. 1–14.
[2] B. Steensgaard, “Points-to analysis in almost linear time,” in POPL
’96: Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on
Principles of Programming Languages. New York, NY, USA: ACM,
1996, pp. 32–41.
[3] J.-D. Choi, M. Burke, and P. Carini, “Efficient flow-sensitive interprocedural
computation of pointer-induced aliases and side effects,” in POPL
’93: Proceedings of the 20th ACM SIGPLAN-SIGACT Symposium on
Principles of Programming Languages. New York, NY, USA: ACM,
1993, pp. 232–245.
[4] A. Deutsch, “Interprocedural may-alias analysis for pointers: beyond
k-limiting,” in PLDI ’94: Proceedings of the ACM SIGPLAN 1994 conference
on Programming Language Design and Implementation. New
York, NY, USA: ACM, 1994, pp. 230–241.
[5] M. Emami, R. Ghiya, and L. J. Hendren, “Context-sensitive interprocedural
points-to analysis in the presence of function pointers,” in PLDI
’94: Proceedings of the ACM SIGPLAN 1994 conference on Programming
Language Design and Implementation. New York, NY, USA:
ACM, 1994, pp. 242–256.
[6] P.-S. Chen, Y.-S. Hwang, R. D.-C. Ju, and J. K. Lee, “Interprocedural
probabilistic pointer analysis,” IEEE Trans. Parallel Distrib. Syst.,
vol. 15, no. 10, pp. 893–907, 2004.
[7] P.-S. Chen, M.-Y. Hung, Y.-S. Hwang, R. D.-C. Ju, and J. K. Lee, “Compiler
support for speculative multithreading architecture with probabilistic
points-to analysis,” in PPoPP ’03: Proceedings of the 9th ACM SIGPLAN
Symposium on Principles and Practice of Parallel Programming.
New York, NY, USA: ACM, 2003, pp. 25–36.
[8] M. Hind, “Pointer analysis: haven’t we solved this problem yet?” in
PASTE ’01: Proceedings of the 2001 ACM SIGPLAN-SIGSOFT Workshop
on Program Analysis for Software Tools and Engineering. New
York, NY, USA: ACM, 2001, pp. 54–61.
[9] M. Hind and A. Pioli, “Which pointer analysis should I use?” in Proceedings
of the 2000 ACM SIGSOFT International Symposium on Software
Testing and Analysis, ser. ISSTA ’00. New York, NY, USA: ACM,
2000, pp. 113–123.
[10] M. Sagiv, T. Reps, and R. Wilhelm, “Solving shape-analysis problems
in languages with destructive updating,” ACM Trans. Program. Lang.
Syst., vol. 20, no. 1, pp. 1–50, 1998.
[11] Y.-S. Hwang, P.-S. Chen, J. K. Lee, and R. D.-C. Ju, “Probabilistic
points-to analysis,” in LCPC ’01: Proceedings of the 2001 International
Workshop on Languages and Compilers for Parallel Computing, 2001,
pp. 290–305.
[12] J. G. Steffan, C. B. Colohan, A. Zhai, and T. C. Mowry, “A scalable
approach to thread-level speculation,” in In Proceedings of The 27th
Annual International Symposium on Computer Architecture, 2000, pp.
1–12.
[13] S. P. Vanderwiel and D. J. Lilja, “Data prefetch mechanisms,” ACM
Comput. Surv., vol. 32, pp. 174–199, June 2000.
[14] M. Herlihy and J. E. B. Moss, “Transactional memory: architectural
support for lock-free data structures,” in Proceedings of the 20th annual
international symposium on computer architecture, ser. ISCA ’93. New
York, NY, USA: ACM, 1993, pp. 289–300.
[15] X. Dong, N. P. Jouppi, and Y. Xie, “Pcramsim: system-level performance,
energy, and area modeling for phase-change ram,” in Proceedings
of the 2009 International Conference on Computer-Aided Design,
ser. ICCAD ’09. New York, NY, USA: ACM, 2009, pp. 269–275.
[16] J. Da Silva and J. G. Steffan, “A probabilistic pointer analysis for speculative
optimizations,” in Proceedings of the 12th international conference
on Architectural support for programming languages and operating systems,
ser. ASPLOS-XII. New York, NY, USA: ACM, 2006, pp. 416–
425.
[17] J. L. Henning, “SPEC CPU2006 benchmark descriptions,” SIGARCH
Comput. Archit. News, vol. 34, pp. 1–17, September 2006.
[18] G. Ramalingam, “Data flow frequency analysis,” in PLDI ’96: Proceedings
of the ACM SIGPLAN 1996 conference on Programming Language
Design and Implementation. New York, NY, USA: ACM, 1996, pp.
267–277.
[19] B. Alpern, M. N. Wegman, and F. K. Zadeck, “Detecting equality of
variables in programs,” in POPL ’88: Proceedings of the 15th ACM
SIGPLAN-SIGACT Symposium on Principles of programming languages.
New York, NY, USA: ACM, 1988, pp. 1–11.
[20] B. K. Rosen, M. N. Wegman, and F. K. Zadeck, “Global value numbers
and redundant computations,” in POPL ’88: Proceedings of the 15th
ACM SIGPLAN-SIGACT Symposium on Principles of Programming
Languages. New York, NY, USA: ACM, 1988, pp. 12–27.
[21] R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck,
“Efficiently computing static single assignment form and the control
dependence graph,” ACM Trans. Program. Lang. Syst., vol. 13, no. 4,
pp. 451–490, 1991.
[22] M. N. Wegman and F. K. Zadeck, “Constant propagation with conditional
branches,” ACM Trans. Program. Lang. Syst., vol. 13, no. 2, pp.
181–210, 1991.
[23] M. Gerlek, M. Wolfe, and E. Stoltz, “A reference chain approach for live
variables,” Tech. Rep. CSE 94-029, Oregon Graduate Institute. Apr,
Tech. Rep., 1994.
[24] R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck,
“An efficient method of computing static single assignment form,” in
POPL ’89: Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium
on Principles of Programming Languages. New York, NY, USA:
ACM, 1989, pp. 25–35.
[25] F. C. Chow, S. Chan, S.-M. Liu, R. Lo, and M. Streich, “Effective
representation of aliases and indirect memory operations in SSA form,”
in CC ’96: Proceedings of the 6th International Conference on Compiler
Construction. London, UK: Springer-Verlag, 1996, pp. 253–267.
[26] Y. Cui, L. Li, and S. Yao, “Inclusion-based multi-level pointer analysis,”
in Proceedings of the 2009 International Conference on Artificial
Intelligence and Computational Intelligence - Volume 02, ser. AICI ’09.
Washington, DC, USA: IEEE Computer Society, 2009, pp. 204–208.
[27] M. Das, “Unification-based pointer analysis with directional assignments,”
in Proceedings of the ACM SIGPLAN 2000 Conference on Programming
Language Design and Implementation, ser. PLDI ’00. New
York, NY, USA: ACM, 2000, pp. 35–46.
[28] V. C. Sreedhar, G. R. Gao, and Y.-F. Lee, “A new framework for
elimination-based data flow analysis using DJ graphs,” ACM Trans.
Program. Lang. Syst., vol. 20, no. 2, pp. 388–435, 1998.
[29] M. Burke, “An interval-based approach to exhaustive and incremental
interprocedural data-flow analysis,” ACM Trans. Program. Lang. Syst.,
vol. 12, no. 3, pp. 341–395, 1990.
[30] A. Rogers, M. Carlisle, J. Reppy, and L. Hendren, “Supporting dynamic
data structures on distributed memory machines,” ACM Transactions
on Programming Languages and Systems, vol. 17, no. 2, Mar. 1995.
[31] M. C. Carlisle and A. Rogers, “Software caching and computation migration
in olden,” in PPOPP ’95: Proceedings of the fifth ACM SIGPLAN
Symposium on Principles and Practice of Parallel Programming. New
York, NY, USA: ACM, 1995, pp. 29–38.
[32] T. Reps, S. Horwitz, and M. Sagiv, “Precise interprocedural dataflow
analysis via graph reachability,” in Proceedings of the 22nd ACM
SIGPLAN-SIGACT Symposium on Principles of Programming Languages,
ser. POPL ’95. New York, NY, USA: ACM, 1995, pp. 49–
61.
[33] I. Dillig, T. Dillig, and A. Aiken, “Sound, complete and scalable pathsensitive
analysis,” in Proceedings of the 2008 ACM SIGPLAN Conference
on Programming Language Design and Implementation, ser. PLDI
’08. New York, NY, USA: ACM, 2008, pp. 270–280.
[34] B. Hardekopf and C. Lin, “Semi-sparse flow-sensitive pointer analysis,”
in Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium
on Principles of programming languages, ser. POPL ’09. New York,
NY, USA: ACM, 2009, pp. 226–238.
[35] B. D. and T. Austin. The SimpleScalar Tool Set, Version 3.0. Unversity
of Wisconsin Madison Computer Science Department.
[36] L. Hammond, B. Hubbert, M. Siu, M. Prabhu, M. Chen, and K. Olukotun.
The stanford hydra cmp. IEEE MICRO Magazine, March-April
2000.
[37] V. Krishnan and J. Torrellas. A chip-multiprocessor architecture with
speculative multithreading. IEEE Transactions on Computers, 48(9):
866–880, 1999.
[38] J. Oplinger, D. Heine, S.-W. Liao, B. A. Nayfeh, M. S. Lam, and
K. Olukotun. Software and hardware for exploiting speculative parallelism
with a multiprocessor. Technical Report CSL-TR-97-715, Stanford
University, February 1997.
[39] G. S. Sohi, S. E. Breach, and T. N. Vijaykumar. Multiscalar processors.
In 25 Years ISCA: Retrospectives and Reprints, pages 521–532, 1998.
[40] J.-Y. Tsai, J. Huang, C. Amlo, D. J. Lilja, and P.-C. Yew. The superthreaded
processor architecture. IEEE Transactions on Computers,
48(9):881–902, 1999.
[41] J.-Y. Tsai, Z. Jiang, and P.-C. Yew. Compiler techniques for the superthreaded
architectures. International Journal of Parallel Programming,
27(1):1–19, 1999.
[42] A. Berson, S. Smith, and K. Thearling. Building Data Mining Applications
for CRM. McGraw-Hill, 1999.
[43] B. W. Kernighan and D. M. Ritchie. The C programming language,
Second Edition. Prentice Hall, 1988.
[44] B. Stroustrup. The C++ programming language. Addison-Wesley, 1991.
[45] Smith, M., Horowitz, M., Lam, M. Efficient Superscalar Performance
Through Boosting In 5th International Conference on Architectural Support
for Programming languages and Operating Systems. IEEE/ACM.
Boston, MA. p248-259. October, 1992
[46] Jin Lin, Tong Chen, Wei-Chung Hsu, Pen-Chung Yew, Roy Ju, Tin-fook
Ngai, and Sun Chan, A Compiler Framework for Speculative Analysis
and Optimizations in the ACM SIGPLAN’03 Conference on Programming
Language Design and Implementation (PLDI), pp. 289-299, June
2003
[47] Roy Dz-ching Ju, Kevin Nomura, Uma Mahadevan, Le-Chun Wu A
Unified Compiler Framework for Control and Data Speculation 2000 International
Conference on Parallel Architectures and Compilation Techniques
(PACT’00) October 15 - 19, 2000 Philadelphia, Pennsylvania
[48] Intel’s docuemnt that provides the overview of the Microarchitecture,
System Bus, Data Integrity, Configuration and Initialization, Test
Access Port, and Integration Tools for use while designing systems
with the Itanium processor. ftp://download.intel.com/design/Itanium/
Downloads/24870102.pdf
[49] Dongkeun Kim (Intel), Steve Shih-wei Liao (Intel), Perry Wang (Intel),
Juan del Cuvillo (Intel), Xinmin Tian (Intel), Xiang Zou (Intel), Hong Wang (Intel), Donald Yeung (U. of Maryland College Park),
Milind Gikar (Intel), John Shen (Intel) Physical Experimentation with
Prefetching Helper Threads on Intel’s Hyper-Threaded Processors 2004
International Symposium on Code Generation and Optimization with
Special Emphasis on Feedback-Directed and Runtime Optimization
[50] The Stanford SUIF Compiler Group. The SUIF Library. Stanford University,
1995.
[51] M. D. Smith. The SUIF Machine Library. Division of of Engineering
and Applied Science, Harvard University, March 1998.