CN1447229A - Branch prediction method applicable to context switch - Google Patents

Branch prediction method applicable to context switch Download PDF

Info

Publication number
CN1447229A
CN1447229A CN 02107782 CN02107782A CN1447229A CN 1447229 A CN1447229 A CN 1447229A CN 02107782 CN02107782 CN 02107782 CN 02107782 A CN02107782 A CN 02107782A CN 1447229 A CN1447229 A CN 1447229A
Authority
CN
China
Prior art keywords
branch
branch history
global
history register
prediction method
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.)
Granted
Application number
CN 02107782
Other languages
Chinese (zh)
Other versions
CN1200343C (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.)
Suzhou Zhongke Integrated Circuit Design Center Co., Ltd.
Original Assignee
Institute of Computing Technology of CAS
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 Institute of Computing Technology of CAS filed Critical Institute of Computing Technology of CAS
Priority to CN 02107782 priority Critical patent/CN1200343C/en
Publication of CN1447229A publication Critical patent/CN1447229A/en
Application granted granted Critical
Publication of CN1200343C publication Critical patent/CN1200343C/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Advance Control (AREA)

Abstract

This invention relates to a branch prediction method used in context switch including the following steps: a) to make process number comparison to the branch orders entered into the predictor b) if the numbers are equal to global order is "1", then different global branch history registers are applied to different process numbers to fetch the branch history registers and use a fixed on to the global order of "1" c) if not, an idle one is selected and a branch one is selected in stead of there is no idle ond d) to operate on read out global branch history and branch order addresses to form index of the pattern list e) to access the pattern list to read out related content f) to predict to decide if jump.

Description

Be applicable to the branch prediction method that context switches
Technical field
The invention belongs to the micro-processor architecture field, particularly a kind of branch prediction method of microprocessor.
Background technology
Current various microprocessor is generally taked following two kinds of schemes when solving branch:
(1) time-out is got finger, comes out up to branch outcome.This way can take to add the method that postpones groove usually in order to reduce delay, but whether success generally all can produce certain delay no matter shift.As: the R4000 microprocessor of MIPS.
(2) take to a certain degree prediction, before branch outcome is come out, just get finger by the address of prediction.This method does not produce delay when conjecture is correct, but when conjecture is wrong, will cancels the instruction of having got into and get finger again, thereby causes the streamline cutout, has increased time-delay.As: the R10000 of MIPS, 21064,21164,21264 of Alpha, the UltraSparc series of Sun, the P6 series microprocessor of Intel etc.
Second kind of scheme is the current popular scheme, adopted by most of microprocessors.Wherein: the R10000 of MIPS, 21064,21164 of Alpha, the UltraSparc I of Sun adopts is bimodal (Bimodal Predictor) fallout predictor of two; That the UltraSparc III of the UltraSparcSun of Sun adopts is Gshare fallout predictor (Gshare Predictor); What the P6 series microprocessor of Intel adopted is the two-layer fallout predictor (Two-level Predictor) of PAs configuration (PAs configuration); That 21264 of Alpha adopts is hybrid predicting device (Hybrid Predictor).
In these schemes, bimodal (Bimodal Predictor) fallout predictor seldom uses basically, or is used with other fallout predictor, and other severally all belongs to two-layer fallout predictor, is divided into GAs, PAs and mixing (Hybrid) according to the configuration difference.Whether these schemes all are to utilize the historical record and the programmable counter PC of branch basically, form the index to pattern history table PHT (Pattem HistoryTable), shift according to the content decision of reading from PHT then.
For example, Fig. 1 is the synoptic diagram of the fallout predictor of use Gshare (belonging to the GAs configuration) method.It directly uses global branch history (Global Branch History) and a part of jump instruction address XOR mutually, at last minute jump instruction address of splicing, formation is to the index of PHT, from the PHT table, read corresponding list item with this index again, and whether predict redirect according to the content decision of reading.
The Forecasting Methodology of these fallout predictors has important disadvantages, they are not considered multi-user (multi-user), multiprogramming (multi-programming), multithreading (multi-threading), and multi-user, multiprogramming, being applied in the current and following processor of multithreading are inevitable, or even a kind of trend, so though they all have very high hit rate on the prediction monoprogrammed, but in actual applications, be subjected to the influence of the context switching (contextswitching) of process (comprising thread), effect is unsatisfactory.Some processor is in order to improve hit rate, use more position to write down transinformation, taken very big, valuable chip area, for example, 21264 the fallout predictor of Alpha has used 28K bits altogether, but the hit rate in the practical application can't be greatly improved.
The someone begins to study in theory the branch prediction of multiline procedure processor (multi-threadedprocessor) now, as: the scheme that J.Gummaraju and M.Franklin propose, but this scheme is also impracticable, because it has set up a PHT (PatternHistory Table) for each process, the quantity of the prediction bits that such fallout predictor is required, the chip area that will take will be beyond affordability in the practical application.Therefore really do not used yet.
So the context that is not suitable for the process (comprising thread) under multi-user, multiprogramming, the multi-thread environment that is applied to of existing Forecasting Methodology switches, and there is big, the unpractical deficiency of chip occupying area in theoretic multithreading Forecasting Methodology.
Summary of the invention
The object of the present invention is to provide a kind of branch prediction method that is applicable to that context switches,, run into when frequent context switches and also can bring into play good effect, and be convenient to realize even under the environment of multi-user, multiprogramming, multithreading.
A kind of branch prediction method that is applicable to that context switches of the present invention is characterized in that, comprises the following step:
A) branch instruction that will enter fallout predictor is carried out the comparison of process (comprising thread) number;
B) according to comparative result, if equal or overall situation position is " 1 ", adopt different global branch history register (Global Branch History Register) GBHR for different process numbers, and read wherein global branch history, and be " 1 " to overall situation position, use a fixing branch history register;
C) if comparative result does not wait and overall situation position is not " 1 ", select the branch history register of a sky, when not having the free branch history register, select a branch history register to replace
D) use the global branch history read to operate, the index of formation pattern list (Pattem History Table) PHT with the address of branch instruction;
E) access module table (Pattern History Table) PHT reads related content;
F) predict according to the result that finds, determine whether redirect.
Wherein in step a): the process number that relatively is to use branch instruction of process (comprising thread) number and the process number of each GBHR correspondence comprise the comparison of process indications ASID (address spaceidentifier) and the inspection of overall situation position Global.
Wherein in step b): removing Global is the GBHR that use " 1 ", and other each GBHR has the ASID of a correspondence, is used for comparing.
Description of drawings
In order further to understand technology contents of the present invention, below in conjunction with drawings and Examples the present invention is made a detailed description, wherein:
Fig. 1 is to use the synoptic diagram of the fallout predictor of Gshare method;
Fig. 2 is a branch transition fallout predictor of the present invention.
Embodiment
In the present invention, the use process represents that symbol (address space identifier) ASID and overall situation position Global come identification process, for each bar instruction, all have corresponding ASID and Global position.In the middle of general processor, the list item of preserving content corresponding is all arranged, the position difference of just depositing.
A kind of branch prediction method that is applicable to that context switches provided by the invention, shown in Figure 2 in conjunction with consulting, comprise the following step:
A) branch instruction that will enter fallout predictor is carried out the comparison of process (comprising thread) number, process (comprising thread) number relatively be to utilize to receive that Global position relevant with this branch instruction and ASID carry out with each global branch history register (Global Branch History Register) ASID that GBHR is corresponding, comprise the comparison of ASID and the inspection of Global position, see also the upper left among Fig. 2;
B) according to comparative result, if the Global position is " 1 ", the address that shows this instruction is that the overall situation is used, select to use special GBHR (Global Branch History Register), No. 0 GBHR for example, and this GBHR can not redistribute to any other process, sees also the bottom left section among Fig. 2;
C) if the Global position for " 0 " to decide according to the comparative result of ASID and select which GBHR:1 for use) have the content in the ASID territory of GBHR correspondence to equate with the ASID of this instruction, then select first equal GBHR for use; 2) if not do not equate, but also have vacant unappropriated GBHR, then select a sky, and the content in the ASID territory of correspondence is arranged to the ASID of this instruction; 3) if not do not equate, and do not have vacant unappropriated GBHR, then select a GBHR, redistribute, and make the content in the ASID territory of correspondence the ASID of this instruction into, see also the bottom left section among Fig. 2 to this ASID according to certain rule;
D) use the global branch history read to operate, the index of formation pattern list (Pattern History Table) PHT with the address of branch instruction;
E) access module table (Pattern History Table) PHT reads related content;
F) predict according to the result that finds, determine whether redirect, steps d sees also right half part among Fig. 2 to step f.
By preceding method as can be known the present invention have following a bit:
1. because the present invention has adopted the identification of special process in Forecasting Methodology, thus this be one specially at multi-user, multiprogramming, multi-thread environment, can adapt to the branch predictor method that the context of process (comprising thread) switches well.It has guaranteed, though fallout predictor be operated in multi-user, multiprogramming, multi-thread environment can be because context switches yet the performance of impact prediction device.
2. and owing to only used overall transfer history (Global BranchHistory) in predicted portions, taked the comparatively easily predict of row, avoided the realization complicacy.
Therefore the present invention has overcome the deficiency that context that the fallout predictor in the reality is not suitable for process (comprising thread) switches, and theoretic multithreading fallout predictor realizes deficiency complicated, the feasibility difference.

Claims (3)

1, a kind of branch prediction method that is applicable to that context switches is characterized in that, comprises the following step:
A) branch instruction that will enter fallout predictor is carried out the comparison of process number;
B) according to comparative result, if equate or overall situation position be " 1 ", adopt different global branch history registers for different process numbers, and read branch history register wherein, and be " 1 " the overall situation, use one fixing;
C) if comparative result does not wait and overall situation position is not " 1 ", select the branch history register of a sky, when not having the free branch history register, select a branch history register to replace;
D) use the global branch history read to operate, the index of formation pattern list with the address of branch instruction;
E) the access module table is read related content;
F) predict according to the result that finds, determine whether redirect.
2, according to the described a kind of branch prediction method that is applicable to that context switches of claim 1, it is characterized in that, wherein in step a: the process number that relatively is to use branch instruction of process number and the process number of each branch history register correspondence comprise the comparison of process indications and the inspection of overall situation position.
3, according to the described a kind of branch prediction method that is applicable to that context switches of claim 1, it is characterized in that, wherein in step b: removing overall situation position is the branch history register that use " 1 ", other each branch history register all has the process indications of a correspondence, is used for comparing.
CN 02107782 2002-03-22 2002-03-22 Branch prediction method applicable to context switch Expired - Lifetime CN1200343C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 02107782 CN1200343C (en) 2002-03-22 2002-03-22 Branch prediction method applicable to context switch

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 02107782 CN1200343C (en) 2002-03-22 2002-03-22 Branch prediction method applicable to context switch

Publications (2)

Publication Number Publication Date
CN1447229A true CN1447229A (en) 2003-10-08
CN1200343C CN1200343C (en) 2005-05-04

Family

ID=28048426

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 02107782 Expired - Lifetime CN1200343C (en) 2002-03-22 2002-03-22 Branch prediction method applicable to context switch

Country Status (1)

Country Link
CN (1) CN1200343C (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826002A (en) * 2010-04-16 2010-09-08 浙江大学 Hardware realization method of recording branch predictor
CN104603747A (en) * 2012-09-12 2015-05-06 高通股份有限公司 Swapping branch direction history(ies) in response to branch prediction table swap instruction(s), and related systems and methods
CN105005737A (en) * 2015-07-31 2015-10-28 天津大学 Branch prediction attack oriented micro-architecture level safety protection method
CN108062236A (en) * 2016-11-07 2018-05-22 杭州华为数字技术有限公司 A kind of software-hardware synergism branch instruction predictions method and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826002A (en) * 2010-04-16 2010-09-08 浙江大学 Hardware realization method of recording branch predictor
CN101826002B (en) * 2010-04-16 2012-12-26 浙江大学 Hardware realization method of recording branch predictor
CN104603747A (en) * 2012-09-12 2015-05-06 高通股份有限公司 Swapping branch direction history(ies) in response to branch prediction table swap instruction(s), and related systems and methods
CN105005737A (en) * 2015-07-31 2015-10-28 天津大学 Branch prediction attack oriented micro-architecture level safety protection method
CN108062236A (en) * 2016-11-07 2018-05-22 杭州华为数字技术有限公司 A kind of software-hardware synergism branch instruction predictions method and device

Also Published As

Publication number Publication date
CN1200343C (en) 2005-05-04

Similar Documents

Publication Publication Date Title
US9921850B2 (en) Instruction sequence buffer to enhance branch prediction efficiency
EP3306466B1 (en) An instruction sequence buffer to store branches having reliably predictable instruction sequences
CN100407167C (en) Fast and acurate cache way selection
US6986027B2 (en) Universal load address/value prediction using stride-based pattern history and last-value prediction in a two-level table scheme
US6253316B1 (en) Three state branch history using one bit in a branch prediction mechanism
EP1145110B1 (en) Circuit and method for tagging and invalidating speculatively executed instructions
KR20070118135A (en) Branch target address cache storing two or more branch target addresses per index
CN1287273C (en) Method and circuit for changng streamline length in synchronous multiline range processor
CN101479700A (en) Methods and apparatus for proactive branch target address cache management
JP5734945B2 (en) Sliding window block based branch target address cache
CN105718241A (en) SPARC V8 system structure based classified type mixed branch prediction system
CN101763249A (en) Branch checkout for reduction of non-control flow commands
WO2007133895A1 (en) Block-based branch target address cache
WO2007019001A1 (en) Call return stack way prediction repair
CN1200343C (en) Branch prediction method applicable to context switch
JP2006338656A (en) Branch prediction control
EP1311947A1 (en) Instruction fetch and dispatch in multithreaded system
Nair Optimal 2-bit branch predictors
CN1093658C (en) Branch history table with branch pattern field
EP1049970B1 (en) Branch prediction with return selection bits to categorize type of branch prediction
US7747845B2 (en) State machine based filtering of non-dominant branches to use a modified gshare scheme
CN117389629B (en) Branch prediction method, device, electronic equipment and medium
CN1280713C (en) Design method of double-stack return address predicator
CN113515310A (en) Microprocessor and branch prediction control method
CN101916184B (en) Method for updating branch target address cache in microprocessor and microprocessor

Legal Events

Date Code Title Description
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: SUZHOU ZHONGKE IC DESIGN CENTER CO., LTD.

Free format text: FORMER OWNER: INST. OF COMPUTING TECHN. ACADEMIA SINICA

Effective date: 20080801

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20080801

Address after: E301, international science and Technology Park, 328 Airport Road, Suzhou Industrial Park, Jiangsu Province

Patentee after: Suzhou Zhongke Integrated Circuit Design Center Co., Ltd.

Address before: No. 6 South Road, Zhongguancun Academy of Sciences, Beijing, Haidian District

Patentee before: Institute of Computing Technology, Chinese Academy of Sciences

CX01 Expiry of patent term

Granted publication date: 20050504

CX01 Expiry of patent term