CN105183651B - For the foreseeable viewpoint method for improving of program automaticity - Google Patents

For the foreseeable viewpoint method for improving of program automaticity Download PDF

Info

Publication number
CN105183651B
CN105183651B CN201510579026.0A CN201510579026A CN105183651B CN 105183651 B CN105183651 B CN 105183651B CN 201510579026 A CN201510579026 A CN 201510579026A CN 105183651 B CN105183651 B CN 105183651B
Authority
CN
China
Prior art keywords
basic block
viewpoint
vision point
frequency
circulation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510579026.0A
Other languages
Chinese (zh)
Other versions
CN105183651A (en
Inventor
张伟哲
谢虎成
何慧
韩硕
郝萌
王学惠
鲁刚钊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Harbin Institute of Technology
Original Assignee
Harbin Institute of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Harbin Institute of Technology filed Critical Harbin Institute of Technology
Priority to CN201510579026.0A priority Critical patent/CN105183651B/en
Publication of CN105183651A publication Critical patent/CN105183651A/en
Application granted granted Critical
Publication of CN105183651B publication Critical patent/CN105183651B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

For the foreseeable viewpoint method for improving of program automaticity, belong to program feature prediction field.The problem of being difficult to determine maximum predicted while precision of prediction is ensured be present in existing program automatic performance Forecasting Methodology.One kind is used for the foreseeable viewpoint method for improving of program automaticity, is then (E using the basic block frequency of two element group representations Step 1: defining the vision point that basic block N performs numberv, BV,N);Step 2: the basic block frequency (E to two element group representationsv, BV,N) in vision point actual motion number EvAmount carry out lifting operation;Step 3: determine to predict basic block N frequency B in vision pointV,N;Step 4: define basic block N frequency BN=Ev×BV,N;Step 5: obtaining vision point total basic block frequency in once running and beingThe present invention has determines suitable insertion position while precision is ensured, the advantages of predictive is improved with reference to static branch probability.

Description

For the foreseeable viewpoint method for improving of program automaticity
Technical field
The present invention relates to one kind to be used for the foreseeable viewpoint method for improving of program automaticity.
Background technology
The common performance evaluation methodology of program includes dynamic analysis and static analysis.The i.e. true operation of so-called dynamic analysis compared with Small input size and degree of parallelism predict large-scale situation, and static analysis is based on compiler code analysis, obtains performance of program. Now desire to dynamic analysis and static analysis is combined acquisition program feature.Dynamic analysis represent accuracy, and static analysis generation Table is predictive.
Cycle-index is obtained by static analysis in research, into source program, the program acquisition after operation is deleted follows pitching pile Ring number, with reference to performance of program, finally give predicted time.LLVM itself provides EdgeProfiling, i.e., in circulation The information of preheader insertions " side ".But this method is that the original intention that the method for pure dynamic analysis is predicted with us is not inconsistent, gained Prediction probability it is relatively low.
Need to find suitable insertion position while precision is ensured, the pitching pile position i.e. viewpoint found, viewpoint is Refer to and the pitching pile position of cycle-index is obtained by static analysis, the advantage is that and perfectly unified static prediction and dynamic in advance Survey.The ratio of dynamic and nature static is freely adjusted by lifting or reducing viewpoint.Viewpoint is too high, and increase is predictive but can drop Low precision, that is, level off to pure static analysis.Predictability can be lost if viewpoint is too low, what the LLVM that levels off to was provided EdgeProfiling.Needing badly a kind of can ensure while precision that lifting viewpoint is to improve the method for predictability as far as possible.
The content of the invention
It is smart in guarantee prediction in the presence of being difficult to the invention aims to solve existing program automatic performance Forecasting Methodology The problem of maximum predicted is determined while spending, and propose one kind and be used for the foreseeable viewpoint method for improving of program automaticity.
One kind is used for the foreseeable viewpoint method for improving of program automaticity, and methods described is realized by following steps:
Then it is (E using the basic block frequency of two element group representations Step 1: defining the vision point that basic block N performs numberv, BV,N);Wherein, EvRepresent the actual motion number of vision point, BV,NExpression predicts basic block N frequency in vision point;It is described Vision point is the insertion point for calculating the instruction that circulation basic block performs number;
Step 2: the basic block frequency (E to two element group representationsv, BV,N) in vision point actual motion number EvAmount enter Row lifting operation, and the vision point after lifting meetsWherein, δ represents dominance relation, i.e., can be obtained in vision point Take the value of tri- variables of %start, %end and %stride directly relied on;
Step 3: determine the basic block frequency (E of two element group representationsv, BV,N) in vision point in predict basic block N frequency Rate BV,NAmount;
Step 4: make the actual motion number E of vision pointvFrequency B with predicting basic block N in vision pointV,NProduct determine Justice is basic block N frequency BN, i.e. BN=Ev×BV,N
Step 5: all obtain actual motion number E per vision point of actual motionv, correspondingly, will be predicted in vision point Basic block N frequency BV,NInstruction insertion vision point, therefore vision point total basic block frequency in once running is
Beneficial effects of the present invention are:
The present invention is by the way that basic block number is inserted in Preheader, to lift precision, and it is straight by obtaining vision point The values of tri- variables of %start, %end and %stride of dependence is connect to lift viewpoint, so as to make up because lifting precision and Caused predictive the shortcomings that reducing, and then later stage code is deleted operation, global counter array by the predictability of raising Read-write be dispersed in each basic block, so as to block the process of deleting.Realize and suitable insert is determined while precision is ensured Enter position, improved with reference to static branch probability predictive.And prediction accurate rate reaches 92-95%.
Brief description of the drawings
Fig. 1 is the flow chart of the present invention;
Fig. 2 is that different points of view includes different degrees of dynamic static state sex ratio in the embodiment of the present invention 1;
Fig. 3 is the different points of view loop nesting schematic diagram that the embodiment of the present invention 1 is related to;
Embodiment
Embodiment one:
Present embodiment is used for the foreseeable viewpoint method for improving of program automaticity, and with reference to shown in Fig. 1, methods described is led to Cross following steps realization:
Then it is (E using the basic block frequency of two element group representations Step 1: defining the vision point that basic block N performs numberv, BV,N);Wherein, EvRepresent the actual motion number of vision point, BV,NExpression predicts basic block N frequency in vision point;It is described Vision point is the insertion point for calculating the instruction that circulation basic block performs number;
Step 2: the basic block frequency (E to two element group representationsv, BV,N) in vision point actual motion number Ev amount Lifting operation is carried out, and the vision point after lifting meetsWherein, δ represents dominance relation, i.e., can in vision point Obtain the value of tri- variables of %start, %end and %stride directly relied on;
Step 3: determine the basic block frequency (E of two element group representationsv, BV,N) in vision point in predict basic block N frequency Rate BV, NAmount;
Step 4: make the actual motion number E of vision pointvFrequency B with predicting basic block N in vision pointV,NProduct determine Justice is basic block N frequency BN, i.e. BN=Ev×BV,N
Step 5: with the operation of program, actual motion number E is all obtained per vision point of actual motionv, correspondingly, Basic block N frequency B will be predicted in vision pointV,NInstruction insertion vision point, therefore vision point is total basic in once running Block frequency isHere the dynamic basic block frequency of vision point is especially represented from E, because its value etc. In EdgeProfiling result.
With LLVM EdgeProfiling methods, basic block number is inserted in Preheader, precision is improved and but drops Low predictability.Unlike, the inventive method can increase predictability, and benefit is easy for the later stage and deletes code, and the overall situation counts The read-write of device array is dispersed in each basic block, and so as to block the process of deleting, therefore it is necessary to lift viewpoint.
Embodiment two:
Unlike embodiment one, present embodiment is used for the foreseeable viewpoint lifting side of program automaticity Method, the basic block frequency (E of two element group representations described in step 1v, BV,N) value be:
(1) when selecting basic block to be used as viewpoint in itself, the basic block frequency representation of two element group representations is (EN, 1);
(2) for the basic block in circulation, when the Preheader of selection circulation is as viewpoint, basic block frequency representation ForWherein, %tc represents static analysis cycle-index,It is that compiler framework LLVM is provided The probability of static branch prediction;
(3) for acyclic basic block, compiler framework LLVM basic block frequencies, the viewpoint of acyclic basic block are continued to use Function entrance basic block e is remained as, i.e.,:(Ee,Be,N)。
Embodiment three:
Unlike embodiment one or two, present embodiment carries for the foreseeable viewpoint of program automaticity Lifting method, to the basic block frequency (E of two element group representations described in step 2v, BV,N) in vision point actual motion number EvAmount Carry out the process of lifting operation:
The instruction directly relied on for the basic block number that step 2 one, selection circulate, the described instruction bag directly relied on Include one kind in access instruction when program performs, exchange instruction, operational order;
The operand being only only used once in step 2 two, the instruction directly relied on for selecting step 2 one is assigned to mesh Mark set Targets;The instruction directly relied on is the instruction for generating and being inserted during LoopTripCount, that is, needs to be carried The instruction risen;
Father's cycle P arentLoop of nonexpondable operand in step 2 three, the instruction for selecting step step 2 one Viewpoint be assigned to Depends set;
If step 2 four, Depends collection are combined into sky, the basic block where circulation is returned to, and carry out the behaviour of step 2 five Make;Otherwise, carry out finding the operation of vision point;
Instruction in step 2 five, traversal goal set Targets, will instruct the termination for being inserted into initial viewpoint pos to refer to Before making Terminator;
Step 2 six, initial viewpoint pos is returned to, that is, complete the lifting of vision point.
Embodiment four:
Unlike embodiment three, present embodiment is used for the foreseeable viewpoint lifting side of program automaticity Method, the process of the operation of searching vision point is described in step 2 four,
The basic block N in Depends set is traveled through, if initial viewpoint pos can dominate basic block N, viewpoint pos is again It is entered as substantially fast N;Otherwise, initial viewpoint pos is still initial value.
Embodiment five:
Unlike embodiment one, two or four, present embodiment is used for that program automaticity to be foreseeable regards Method for improving is put, the basic block frequency (E of two element group representations is determined described in step 3v, BV,N) in vision point in predict it is basic Block N frequency BV,NThe process of amount be,
When the vision point of selection circulates in same circulation layer with father, determine to predict basic block N frequency B in vision pointV,N It is expressed as:Ev, (V → m) %tc;Wherein, m represents that father circulates the circulation layer at place;For example, as selection vision point and the 4th layer of father When circulating in same circulation layer, the frequency for determining to predict basic block N in vision point is:Ev, (V → 4) %tc
When outside the viewpoint of selection circulates in n-th of father, the probability that viewpoint is reached to Preheader is multiplied by circulation successively Number and next node reach forerunner's basic block Preheader probability, and nesting is gone down successively, obtains predicting in vision point Basic block N frequency is:
Its In,
EiRepresent the head node of i-th of circulation, PiRepresent forerunner's basic block Preheader, ViRepresent viewpoint, %tciRepresent Cycle-index, i=1.2...n-1, n.
Embodiment six:
Unlike embodiment five, the root of present embodiment is used for the foreseeable viewpoint lifting of program automaticity Method, when the vision point of selection is identical with father's circulation, basic block N frequency is predicted in the vision point simplified using father's cyclic representation Rate BV,NFor:
Wherein, H1Father's circulation is represented,Represent that viewpoint circulates with father Common viewpoint,Represent to simplify father's cycle frequency when calculating.
Embodiment 1:
Calculate time modeling:
Basic block frequency corresponding to different viewpoints is described in fig. 2, and arranged on left and right sides is dynamic and static state two respectively Extremely.All it is that circulation basic block 4 is predicted, using forerunner's basic block Preheader3 of circulation as viewpoint, then circulation is basic The cycle-index of block 4 is %tc.
To keep precision, then viewpoint is lifted to 1, then in basic block 1, predict that 3 frequency is only used simply It is multiplied by path probability.Therefore can be obtained with prediction:
(E3, %tc) and=(E1, (1 → 3), %tc)=(E1, %tc (1 → 3))
Then lifting is just completed.It is to need to be determined how to select basic block 1 in next step now, reaches and ensureing precision Under the premise of as close to purpose.Because %tc relies on tri- amounts of %start, %end and %stride.Therefore we select Viewpoint D need to meet:Wherein, δ represents dominance relation, i.e., can obtain three variables in viewpoint D Value.
The currently designed boosting algorithm for finding viewpoint, it is as follows:
Next it needs to be determined that BV,N, the complex situations of loop nesting as shown in Figure 3 are discussed below.
The basic block for circulating the place father of basic block 2 circulation is { Isosorbide-5-Nitrae, 2,3 }, and its basic block frequency is (Ec, %tc).Ei、 Pi、ViAnd %tciHead node, forerunner's basic block Preheader, viewpoint and the cycle-index IR of i-th of circulation are represented respectively.
When the vision point of selectioniWith viewpoint 4 in same circulation layer, it may be determined that Ev, (V → 4) %tc.But when regarding for selection Point D outside 4 i.e. father circulate outside when, can using complete representation as:
I.e. If several n-th of father circulations, the probability that viewpoint reaches Preheader are multiplied by cycle-index to the viewpoint of selection successively again outside, And the probability that next node reaches Preheader is multiplied by, nesting is gone down successively.
Special case situation is, if its viewpoint circulates identical with father, can carry out some simplification.The two prefix is identical, So the expression of father's circulation can be utilized.Such as father's circulation of viewpoint 2 is H1If its common viewpoint isFather's cycle frequency ForThen calculation formula can be reduced to:
The present invention can also have other various embodiments, in the case of without departing substantially from spirit of the invention and its essence, this area Technical staff works as can make various corresponding changes and deformation according to the present invention, but these corresponding changes and deformation should all belong to The protection domain of appended claims of the invention.

Claims (4)

1. one kind is used for the foreseeable viewpoint method for improving of program automaticity, it is characterised in that:Methods described passes through following steps Realize:
Then it is (E using the basic block frequency of two element group representations Step 1: defining the vision point that basic block N performs numberv, BV,N); Wherein, EvRepresent the actual motion number of vision point, BV,NExpression predicts basic block N frequency in vision point;The vision point As calculate the insertion point that circulation basic block performs the instruction of number;
Step 2: the basic block frequency (E to two element group representationsv, BV,N) in vision point actual motion number EvAmount carried Lift operations, and the vision point after lifting meetsWherein, δ represents dominance relation, i.e., can be obtained directly in vision point Connect the value of tri- variables of %start, %end and %stride of dependence;
The process of the lifting operation is:
The instruction directly relied on for the basic block number that step 2 one, selection circulate;
The operand being only only used once in step 2 two, the instruction directly relied on for selecting step 2 one is assigned to object set Close;
The viewpoint of father's circulation of nonexpondable operand is assigned in step 2 three, the instruction for selecting step step 2 one Depends gathers;
If step 2 four, Depends collection are combined into sky, the basic block where circulation is returned to, and carry out the operation of step 2 five;It is no Then, carry out finding the operation of vision point;
Instruction in step 2 five, traversal goal set, instruction is inserted into before initial viewpoint pos command for stopping;
Step 2 six, initial viewpoint pos is returned to, that is, complete the lifting of vision point;
Step 3: determine the basic block frequency (E of two element group representationsv, BV,N) in vision point in predict basic block N frequency BV,N Amount;Specially:
When the vision point of selection circulates in same circulation layer with father, determine to predict basic block N frequency B in vision pointV,NRepresent For:Ev, (V → m) %tc;Wherein, m represents that father circulates the circulation layer at place;
When outside the viewpoint of selection circulates in n-th of father, the probability that viewpoint is reached to Preheader is multiplied by cycle-index successively Forerunner's basic block Preheader probability is reached with next node, nesting is gone down successively, obtains predicting in vision point substantially Block N frequency is:
Wherein,
EiRepresent the head node of i-th of circulation, PiRepresent forerunner's basic block Preheader, ViRepresent viewpoint, %tciRepresent circulation Number, i=1.2...n-1, n;
Step 4: make the actual motion number E of vision pointvFrequency B with predicting basic block N in vision pointV,NProduct be defined as Basic block N frequency BN, i.e. BN=Ev×BV,N
Step 5: all obtain actual motion number E per vision point of actual motionv, correspondingly, will be predicted in vision point basic Block N frequency BV,NInstruction insertion vision point, therefore vision point total basic block frequency in once running is
2. according to claim 1 be used for the foreseeable viewpoint method for improving of program automaticity, it is characterised in that:Step 1 Basic block frequency (the E of two described element group representationsv, BV,N) value be:
(1) when selecting basic block to be used as viewpoint in itself, the basic block frequency representation of two element group representations is (EN, 1);
(2) for the basic block in circulation, when the Preheader of selection circulation is as viewpoint, basic block frequency representation isWherein, %tc represents static analysis cycle-index,It is the static state that compiler framework LLVM is provided The probability of branch prediction;
(3) for acyclic basic block, compiler framework LLVM basic block frequencies are continued to use, the viewpoint of acyclic basic block is still For function entrance basic block e, i.e.,:(Ee,Be,N)。
3. according to claim 2 be used for the foreseeable viewpoint method for improving of program automaticity, it is characterised in that:Step 2 Four it is described find vision points the processes of operations be,
The basic block N in Depends set is traveled through, if initial viewpoint pos can dominate basic block N, viewpoint pos assignment again For basic block N;Otherwise, initial viewpoint pos is still initial value.
4. according to claim 3 be used for the foreseeable viewpoint method for improving of program automaticity, it is characterised in that:Work as selection Vision point it is identical with father's circulation when, predict basic block N frequency B in the vision point simplified using father's cyclic representationV,NFor:
Wherein, H1Father's circulation is represented,Represent that viewpoint and father's circulation are common Viewpoint,Represent to simplify father's cycle frequency when calculating.
CN201510579026.0A 2015-09-11 2015-09-11 For the foreseeable viewpoint method for improving of program automaticity Active CN105183651B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510579026.0A CN105183651B (en) 2015-09-11 2015-09-11 For the foreseeable viewpoint method for improving of program automaticity

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510579026.0A CN105183651B (en) 2015-09-11 2015-09-11 For the foreseeable viewpoint method for improving of program automaticity

Publications (2)

Publication Number Publication Date
CN105183651A CN105183651A (en) 2015-12-23
CN105183651B true CN105183651B (en) 2018-03-16

Family

ID=54905743

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510579026.0A Active CN105183651B (en) 2015-09-11 2015-09-11 For the foreseeable viewpoint method for improving of program automaticity

Country Status (1)

Country Link
CN (1) CN105183651B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110377525B (en) * 2019-07-25 2022-11-15 哈尔滨工业大学 Parallel program performance prediction system based on runtime characteristics and machine learning

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286132A (en) * 2008-06-02 2008-10-15 北京邮电大学 Test method and system based on software defect mode

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2527208C2 (en) * 2008-12-18 2014-08-27 Конинклейке Филипс Электроникс Н.В. Software bug and performance deficiency reporting system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286132A (en) * 2008-06-02 2008-10-15 北京邮电大学 Test method and system based on software defect mode

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于LLVM的科学计算程序自动性能预测研究;谢虎成;《中国知网》;20150715;第5页第1.5节-第53页第3.6节 *

Also Published As

Publication number Publication date
CN105183651A (en) 2015-12-23

Similar Documents

Publication Publication Date Title
CN105302096B (en) Intelligent factory scheduling method
CN103149600B (en) Automatic wiring method for determining hydrogeological parameters based on optimization control point
CN102708045B (en) Dynamic symbol executing method for relieving path explosion
CN105894542A (en) Online target tracking method and apparatus
CN106528989B (en) A kind of distributed parallel SPH emulation mode
CN107832481A (en) A kind of partition method handled up for heavy crude reservoir combined steam
CN105183651B (en) For the foreseeable viewpoint method for improving of program automaticity
CN106447662A (en) Combined distance based FCM image segmentation algorithm
CN106406516A (en) Local real-time movement trajectory characteristic extraction and identification method for smartphone
CN103995873A (en) Data mining method and data mining system
CN105915224A (en) Parallelization track compression method based on Mapreduce
CN105260493B (en) A kind of oil well work(figure metering method based on semanteme
CN104361135A (en) Image search method
CN106485030A (en) A kind of symmetrical border processing method for SPH algorithm
CN109784145A (en) Object detection method and storage medium based on depth map
CN111951341A (en) Closed loop detection improvement method based on RGB-D SLAM
CN103235862A (en) Method and device for planning selective disassembly sequence
CN108197613B (en) Face detection optimization method based on deep convolution cascade network
CN115689382A (en) Method for measuring and calculating urban building energy consumption by using urban morphology on macro scale
CN112305558B (en) Mobile robot track determination method and device using laser point cloud data
CN108286957A (en) A kind of Flatness error evaluation method of fast steady letter
Xu et al. NWP feature selection and GCN-based ultra-short-term wind farm cluster power forecasting method
CN113656514A (en) Visualization method and device for three-dimensional model of mine
CN103247054B (en) A kind of target based on FPGA is seen and is taken aim at a real-time positioning apparatus and method
CN106529011B (en) A kind of Parallel districts implementation method for SPH algorithm

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant