CN103678170A - Distribution object priority generation method of scratch pad memory - Google Patents
Distribution object priority generation method of scratch pad memory Download PDFInfo
- Publication number
- CN103678170A CN103678170A CN201310610846.2A CN201310610846A CN103678170A CN 103678170 A CN103678170 A CN 103678170A CN 201310610846 A CN201310610846 A CN 201310610846A CN 103678170 A CN103678170 A CN 103678170A
- Authority
- CN
- China
- Prior art keywords
- distribution
- distribution object
- priority
- code
- relation
- 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.)
- Pending
Links
Images
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
The invention discloses a distribution object priority generation method of a scratch pad memory. The distribution object priority generation method includes acquiring an initial priority of a distribution object collection in a target program, creating relationship information among distribution objects in the distribution object collection, and changing the initial priority according to the relationship information to generate priorities of the distribution objects. The distribution object collection includes code objects and data objects. Relationships among the distribution objects are created through modeling to serve as important consideration factors to introduce an SPM (scratch pad memory) distribution procedure to change the priorities of the distribution objects, and the competition processing problems of the SPM distribution objects are solved according to relationships among the objects. The modeled relationships among the distribution objects can be utilized by different mapping transformation methods under different occasions.
Description
Technical field
The invention belongs to field of computer technology, relate in particular to a kind of scratch ROM distribution object priority generation method.
Background technology
Along with the speed of processor is more and more faster, the bottleneck between processor and chip external memory has become the key point of entire system performance.In general-purpose computing system, conventionally use Cache to solve the performance difference between processor and internal memory.At one-level Cache, can not meet in system requirements situation, can further introduce Multi-Level Cache, and Cache is expanded to respectively to Instruction Cache and Data Cache.Conventionally, Cache is by hard-wired buffer memory middleware, and it fills content according to the strategy of reserving in advance, and CPU does not directly manage the filling of its allocation of space and content.Content in Cache space is the mapping of chip external memory content subset normally.Different according to the mapping policy using, its when operation hit rate also different.But because Cache is by hardware management, it has indeterminable delay, the shortcoming that power consumption is higher.Therefore, in embedded system, conventionally use scratch ROM (SPM, Scratch Pad Memory) as its replacement scheme.Different from Cache, SPM has independently address space, and the management of its content can be inserted by compiler or by CPU management, be inserted when operation when compiling.It has higher dirigibility, lower power consumption and stronger real-time than Cache, therefore in current embedded system, has increasing application.Need to be by software control due to SPM content, use different content method for posting and allocation strategy by program code and routine data insert in SPM can application programs performance and effect have different impacts.Research has made full use of wide significance to SPM.
But because SPM is limited, efficient, the available resource of software, when using SPM space, need to determine how to select and select distribution object and be placed to SPM.In the process of distributing, also have and certain may produce following problem: surpass an object and there is close similar even identical feature, in order to select part object from these objects in limited SPM space, produced the limited SPM space resources problem of mutual competition between object.When dynamic allocation method is used in SPM space, this class object easily causes more SPM content and main memory content exchange to increase the shake of object in internal memory, from SPM unloading to internal memory then again unloading extremely in SPM.
Summary of the invention
The present invention has overcome in prior art scratch ROM and has not related to selecting and select distribution object to cause occurring analogical object to compete, thereby increases the defect of object shake in internal memory, has proposed a kind of scratch ROM distribution object priority generation method.The present invention carries out priority conversion and sequence to distribution object, by its priority orders, object is inserted in scratch ROM.
The present invention proposes a kind of scratch ROM distribution object priority generation method, comprise the steps:
A. obtain the initial priority of distribution object set in target program, described distribution object set comprises code object and data object;
B. set up in described distribution object set relation information between each distribution object;
C. according to described relation information, change described initial priority, generate the priority of described each distribution object.
In the scratch ROM distribution object priority generation method that the present invention proposes, the initial priority of obtaining each distribution object in described target program comprises as follows:
A1. program codes is compiled to anatomy, obtain basic temperature information;
A2. select the distribution object granularity of described target program;
A3. according to described distribution object granularity and described basic temperature information, divide the distribution object set of described target program, and calculate the temperature information of described distribution object set;
A4. according to described temperature information, calculate the initial priority of each distribution object in described distribution object set.
In the scratch ROM distribution object priority generation method that the present invention proposes, set up relation information between each distribution object and comprise the steps:
B1: the code access data item information of obtaining described program codes;
B2: set up the relation information between described distribution object according to code access data item information; Described relation information comprises: the first kind relation between the data object of code object and access thereof, Equations of The Second Kind relation between the adjacent data object between the adjacent code object of logic or address, the 3rd class data between different code object between the different pieces of information object of identical code object accesses or same accessed data object.
In the scratch ROM distribution object priority generation method that the present invention proposes, described step changes described initial priority and comprises the steps:
C1: the weight that described relation information is set;
C2: described relation information is converted by weight;
C3: according to the relation information after conversion, described initial priority is changed, generate the priority of described each distribution object.
In the scratch ROM distribution object priority generation method that the present invention proposes, further comprise:
D. by described priority, described distribution object set is sorted, according to sequence, each distribution object is dispensed in corresponding scratch ROM.
Beneficial effect of the present invention comprises: according to the relation between distribution object, change original priority, make the object that originally can compete again have the priority of notable difference, thereby solved the problem of competing.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of scratch ROM distribution object priority generation method of the present invention.
Fig. 2 is neighborhood exemplary plot.
Fig. 3 is that kith and kin are related to exemplary plot.
Fig. 4 is brotherhood exemplary plot.
Fig. 5 is distribution object adjacent in embodiment and the schematic diagram of temperature thereof.
Embodiment
In conjunction with following specific embodiments and the drawings, the present invention is described in further detail.Implement process of the present invention, condition, experimental technique etc., except the content of mentioning specially below, be universal knowledege and the common practise of this area, the present invention is not particularly limited content.
Below the explanation of the technical term about occurring in instructions:
Code object---executable code segment.Be designated as C.For example: a fundamental block is also a code object.
The data that data object---code is accessed.Be designated as D.
Distribution object---comprise code object and data object.Be designated as O.There is O={C|D}.
The region (being designated as A) that the orderly code fundamental block (being designated as B) of code region---a 1-N logic forms, there is subordinate relation in these code fundamental blocks and this region, i.e. B ∈ A.Code area size is the code fundamental block number that belongs to this code region.
First kind relation, i.e. kith and kin's relation---claim that the pass between current code object and its data object of accessing or operating is kith and kin's relations, they are kith and kin each other.Code object C visit data object D is designated as R (C->D)=1.As shown in Figure 3, Bi accesses Dx, and Bi and Dx be kith and kin's relation each other; Bj accesses Dy, and Bj and Dy be kith and kin's relation each other.
The neighborhood that context between Equations of The Second Kind relation, i.e. neighborhood---title code object is sequentially code.Left neighbours' code object: the previous code object of current code object (being designated as O).Be designated as Left (O).Right neighbours' code object: a rear code object of current code object.Be designated as Right (O).Relation between data object and its adjacent data object is called the neighborhood for data object.As shown in Figure 2, Bi and Bj be neighbours each other, and Bj and Bk be neighborhood each other.
The 3rd class relation, i.e. brotherhood---when different code object is accessed same data object or during identical code object accesses different pieces of information object, claim these code object or data object brother each other, between it, have brotherhood.As shown in Figure 4, Bi/Bj accesses Dx, and Bi and Bj be brotherhood each other; Bi accesses Dx/Dy, and Dx and Dy be brotherhood each other.
Object size---the size of the shared storage space of object.Be designated as S (O).
Object space cost---equal object size.Be designated as V (O), conventionally have V (O)=S (O).
Object priority---for weighing the quantification numeral of object degree of priority, numeral is larger, and priority is higher.Be designated as P (O).
Object temperature---for code object, its temperature is that number of times sum is carried out in the instruction that belongs to this code object.For data object, its temperature is to belong to the number of times sum that the data of this data object are accessed to.Be designated as F, have:
What Fig. 1 showed is the process flow diagram of scratch ROM distribution object priority generation method of the present invention.Comprising following steps:
A. obtain the initial priority of distribution object set in target program, distribution object set comprises code object and data object.
A1. program codes is compiled to anatomy, obtain basic temperature information;
A2. the distribution object granularity of selected target program;
A3. according to distribution object granularity and basic temperature information, the distribution object set of dividing target program, and the temperature information of dispensed object set;
A4. according to the initial priority of each distribution object in temperature information dispensed object set.
B. set up in distribution object set relation information between each distribution object;
B1: the code access data item information of obtaining program codes;
B2: set up the relation information between distribution object according to code access data item information; Relation information comprises: the first kind relation between the data object of code object and access thereof, and between the adjacent code object of logic or the adjacent data in address
Equations of The Second Kind relation between object, between the different pieces of information object of identical code object accesses or same accessed number
According to the 3rd class data between the different code object of object.
C. according to relation information, change initial priority, generate the priority of each distribution object;
C1: the weight that relation information is set;
C2: relation information is converted by weight;
C3: according to the relation information after conversion, initial priority is changed, generate the priority of each distribution object.
D. according to priority to distribution object, set is sorted, and according to sequence, each distribution object is dispensed in corresponding scratch ROM.
This specific embodiment is to take that what based on scratch ROM SPM, generate priority is example, when SPM (supposing still to have living space and can distribute in SPM) carries out allocation of space, use instrument (for example, the SimpleScalar instrument chain of compilation tool and simulation tool, or other similar means) target program is dissected to simulation, obtain temperature information and program code item visit data item information, program code item visit data item information refers to whether a certain code instructions has accessed certain data item in storage simultaneously.
The distribution object granularity of selected target program, available granularity comprises: the granularity of functional blocks, fundamental block, data block, data item or User Defined size etc.
The distribution object set of obtaining out target program with selected distribution object granularity, distribution object set comprises code object and data object.Code object refers to the set of one or more program items, and data object refers to the set of one or more data item.
Obtain the method for distribution object set for using granularity boundary demarcation program code object and data object when having determined distribution object granularity, use corresponding algorithm partition program code object and data object.For example, when code object is chosen to be fundamental block, use fundamental block partitioning algorithm to divide fundamental block object, when data object is chosen to be 8Byte group, by 8Byte group dividing data.
Simultaneously, use the basic temperature information of aforementioned anatomy to calculate the temperature information of distribution object as the adeditive attribute of distribution object, wherein the method for the temperature information of dispensed object is: the temperature of assignment of code object equals the temperature sum of its instruction items comprising, and the temperature of data allocations object is the accessed temperature sum of its data item comprising.
Based on each distribution object temperature information of (comprising code object and data object), selected linearity or Nonlinear Mapping function, as algorithm, quantize the initial priority of code object and data object.For example, adopting direct reflection method is the temperature that distribution object initial priority equals distribution object, i.e. P (O)=F (O) O ∈ [C, D], and wherein P (O) represents the initial priority of distribution object O, F (O) represents the temperature of distribution object O.
The program code item visit data item information obtaining according to aforementioned anatomy afterwards solves the relation between distribution object in distribution object set, and relation comprises: first kind relation (kith and kin's relation), Equations of The Second Kind relation (neighborhood) and the 3rd class relation (brotherhood).
Wherein, first kind relation refers to, data item in code entry visit data object in code object, this pair of code object and data object first kind relation each other, is called " kith and kin's relation " by the first kind relation in following instructions in the present embodiment visually.
Equations of The Second Kind relation refers to, Equations of The Second Kind relation each other between the code object code object adjacent with its logic or between the data object data object adjacent with its address, is called " neighborhood " by the Equations of The Second Kind relation in following instructions in the present embodiment visually.
The 3rd class relation refers to, accesses between the different code object of same data object or between identical code object accesses different pieces of information object the 3rd class relation each other, in the present embodiment, visually the 3rd class relation in following instructions is called to " brotherhood ".
The relation that use above-mentioned steps solves is as considerations, initial priority to distribution object converts, transform method is, use initial priority and relation information as input, selected linearity or Nonlinear Mapping function, as the initial priority of algorithmic transformation distribution object, are exported the priority after distribution object conversion.
According to above-mentioned, to the explanation of kith and kin's relation and brotherhood and accompanying drawing 3 and accompanying drawing 4, can find out that brotherhood is a kind of special evolution of kith and kin's relation, further specialization on the basis of the characteristic that it can have in kith and kin's relation.For the characteristic of kith and kin's relation and neighborhood and utilize method.By an example explanation, above-mentioned relation information is described below:
Be provided with code object C1 visit data object D1, code object C2 visit data object D2, has C1 and D1 kith and kin each other, and C2 and D2 be kith and kin each other.The space cost of C1, D1, C2, D2 is respectively S (C1), S (D1), S (C2), S (D2).The object temperature of C1, D1, C2, D2 is respectively F (C1), F (D1), F (C2) and F (D2), P (R (O1)) after refers to distribution object O1 to have the priority after the conversion of object of access relation, F (R (O1)) before refers to distribution object O1 to have the temperature information before the conversion of object of access relation, can use following fortran:
O1=F
-1(Max(F(C1),F(D1),F(C2),F(D2)));
P(R(O1))
after=F(R(O1))
before+0.1;
Above formula is that kith and kin are related to radiation converter technique, this formula is one of innovation point of the present invention, it has effectively utilized the kith and kin's relation between distribution object, in priority, adds that kith and kin are related to weight, and using 0.1 power is in order not change original temperature priority.Kith and kin of the present invention are related to that radiation converter technique also comprises distortion and other conversion that realizes identity function based on above-mentioned formula.In like manner there is the kith and kin's relation power stack in other situations.Proof: when establishing O1 and being C1, i.e. F (C1) maximum.Now, when S (D1)=S (D2), F (D1)
after>F (D2)
after, now D1 preferentially inserts and has better effect.When S (D1) ≠ S (D2), this conversion does not change priority.Must demonstrate,prove this and be transformed to the useful priority conversion of probability, it can produce good partial order effect and can not revise original existing partial order.
For neighborhood, consider to take the object that fundamental block is granularity division, because code region temperature F (A) is for belonging to the temperature sum of the code object F (C) in this region, that is:
now getting area size is 2, only considers adjacent fundamental block, and its region neighbours' object ultimate range is 0.Heat affects between code object is called to the temperature radiation of code object.There is the Heat affects between the code object of neighborhood to be called neighbours' heat radiation, be designated as N (O).Making its value is neighbours' object temperature/region temperature.So, to get and determine current code object O, left neighbours' radiation temperature is: left neighbours' temperature F (Left (O))/left neighbours region temperature F (A
left).Equally, right neighbours' radiation temperature is: right neighbours' temperature F (Right (O))/right neighbours region temperature F (A
right), be:
With 0.5 factor, multiplying each other is also in order to guarantee that it does not change original existing partial order, due to F (Left (O)) <=F (A
left) and F (Right (O)) <=F (A
right), there is N (O) span for [0,1].So the temperature after the raying of current code object is: basic temperature (basic right of priority)+left neighbours' radiation+right neighbours' radiation.That is:
For some special C1 and C2, if there is F (C1)=F (C2), there is P (C1)
before=P (C2)
beforeand N (C1)=N (C2), now also can further use area size be 3 or larger similar transform method to produce further partial order.
After conversion completes, just can use the final priority of distribution object to sort to distribution object, by sequence, select out correlative code object and data object in preferential quick storage resource SPM.
Take Fig. 5 as example, and the space cost of each code object is V, but because its temperature difference show that its basic right of priority is different, its basic priority value indicates in the drawings respectively.In same program, just like characteristic shown in Fig. 5 top and the bottom is similar but the code block that function is different.Now, according to initial priority, sort: BB1[C/C1] [C1/C] [A/A1] [A1/A].In the situation that there is no right of priority correction, for C and C1, only can choose at random or fixedly choose two kinds.Now use method of the present invention to consider that the radiation of neighbours' influence factor use neighbours temperature converts its initial priority, its conversion process is as follows:
C:2+4/(4+2)=2.66,C1:2+3/(3+2)=2.6。
A:1+4/(4+1)=1.8,A1:1+3/(1+3)=1.75。
Now the right of priority after conversion had both met the unique characteristics of code object, the local feature of being also in order, and set up the partial ordering relation of competing object, make it have comparable feature, the unreasonable problem that the random choice of the C before having avoided and C1 brings.Can find out, this kind of method also can be controlled the C that chooses out and the aggregation properties of B, can be in dynamic allocation method from SPM is mid-, goes out (or more late inserting) earlier, amplified the dynamic available potentiality in SPM space.
The present invention both can be used in the static allocation process of above-mentioned SPM, also can be used in dynamic allocation procedure.In dynamic allocation procedure, set up in distribution object set relation information between each distribution object, and according to relation information, take to change with method identical in above-mentioned static allocation process the priority of distribution object, thereby generate the priority of each distribution object, avoided object in internal memory to produce the problem of shake.
Protection content of the present invention is not limited to above embodiment.Do not deviating under the spirit and scope of inventive concept, variation and advantage that those skilled in the art can expect are all included in the present invention, and take appending claims as protection domain.
Claims (5)
1. a scratch ROM distribution object priority generation method, is characterized in that, comprises the steps:
A. obtain the initial priority of distribution object set in target program, described distribution object set comprises code object and data object;
B. set up in described distribution object set relation information between each distribution object;
C. according to described relation information, change described initial priority, generate the priority of described each distribution object.
2. scratch ROM distribution object priority generation method as claimed in claim 1, is characterized in that, the initial priority of obtaining each distribution object in described target program comprises as follows:
A1. program codes is compiled to anatomy, obtain basic temperature information;
A2. select the distribution object granularity of described target program;
A3. according to described distribution object granularity and described basic temperature information, divide the distribution object set of described target program, and calculate the temperature information of described distribution object set;
A4. according to described temperature information, calculate the initial priority of each distribution object in described distribution object set.
3. scratch ROM distribution object priority generation method as claimed in claim 1, is characterized in that, sets up relation information between each distribution object and comprises the steps:
B1: the code access data item information of obtaining described program codes;
B2: set up the relation information between described distribution object according to code access data item information; Described relation information comprises: the first kind relation between the data object of code object and access thereof, Equations of The Second Kind relation between the adjacent data object between the adjacent code object of logic or address, the 3rd class data between different code object between the different pieces of information object of identical code object accesses or same accessed data object.
4. scratch ROM distribution object priority generation method as claimed in claim 1, is characterized in that, described step changes described initial priority and comprises the steps:
C1: the weight that described relation information is set;
C2: described relation information is converted by weight;
C3: according to the relation information after conversion, described initial priority is changed, generate the priority of described each distribution object.
5. scratch ROM distribution object priority generation method as claimed in claim 1, is characterized in that, further comprises:
D. by described priority, described distribution object set is sorted, according to sequence, each distribution object is dispensed in corresponding scratch ROM.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310610846.2A CN103678170A (en) | 2013-11-26 | 2013-11-26 | Distribution object priority generation method of scratch pad memory |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310610846.2A CN103678170A (en) | 2013-11-26 | 2013-11-26 | Distribution object priority generation method of scratch pad memory |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103678170A true CN103678170A (en) | 2014-03-26 |
Family
ID=50315796
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310610846.2A Pending CN103678170A (en) | 2013-11-26 | 2013-11-26 | Distribution object priority generation method of scratch pad memory |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103678170A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111309644A (en) * | 2020-02-14 | 2020-06-19 | 苏州浪潮智能科技有限公司 | Memory allocation method and device and computer readable storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1138173A (en) * | 1995-03-16 | 1996-12-18 | 松下电器产业株式会社 | Resource dispensing equipment |
CN101901192A (en) * | 2010-07-27 | 2010-12-01 | 杭州电子科技大学 | On-chip and off-chip data object static assignment method |
-
2013
- 2013-11-26 CN CN201310610846.2A patent/CN103678170A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1138173A (en) * | 1995-03-16 | 1996-12-18 | 松下电器产业株式会社 | Resource dispensing equipment |
CN101901192A (en) * | 2010-07-27 | 2010-12-01 | 杭州电子科技大学 | On-chip and off-chip data object static assignment method |
Non-Patent Citations (3)
Title |
---|
STEFAN STEINKE等: "Assigning program and data objects to scratchpad for energy reduction", 《PROCEEDINGS OF THE 2002 DESIGN,AUTOMATION AND TEST IN EUROPE CONFERENCE AND EXHIBITION》, 31 December 2002 (2002-12-31), pages 409 - 415 * |
ZHONG-HO CHEN: "A Hardware/Software Framework for Instruction and Data Scratchpad Memory Allocation", 《ACM TRANSACTIONS ON ARCHITECTURE AND CODE OPTIMIZATION》, vol. 7, no. 2, 30 April 2010 (2010-04-30), pages 1 - 27 * |
王学香 等: "基于扩展控制流图的片上存储器分配策略", 《电子学报》, vol. 35, no. 8, 15 August 2007 (2007-08-15), pages 1558 - 1562 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111309644A (en) * | 2020-02-14 | 2020-06-19 | 苏州浪潮智能科技有限公司 | Memory allocation method and device and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20210191765A1 (en) | Method for static scheduling of artificial neural networks for a processor | |
Shin et al. | Scheduling page table walks for irregular GPU applications | |
US20070143759A1 (en) | Scheduling and partitioning tasks via architecture-aware feedback information | |
CN105681052B (en) | A kind of power-economizing method for the storage of data center's distributed document | |
WO2021232769A1 (en) | Method for storing data and data processing apparatus | |
CN104281495A (en) | Method for task scheduling of shared cache of multi-core processor | |
Yuan et al. | PR-LRU: A novel buffer replacement algorithm based on the probability of reference for flash memory | |
Lira et al. | Hk-nuca: Boosting data searches in dynamic non-uniform cache architectures for chip multiprocessors | |
Iserte et al. | An study of the effect of process malleability in the energy efficiency on GPU-based clusters | |
Wang et al. | Exploiting dark cores for performance optimization via patterning for many-core chips in the dark silicon era | |
CN108733491B (en) | Thermal sensing and low-energy-consumption task scheduling method for heterogeneous MPSoC system | |
Lenis et al. | A performance comparison of data and memory allocation strategies for sequence aligners on NUMA architectures | |
CN103678170A (en) | Distribution object priority generation method of scratch pad memory | |
CN106484532A (en) | GPGPU parallel calculating method towards SPH fluid simulation | |
CN110489214B (en) | Dynamic task allocation for data intensive workflows in a cloud environment | |
CN104850508B (en) | access method based on data locality | |
CN110308965A (en) | The rule-based heuristic virtual machine distribution method and system of cloud data center | |
Chen et al. | A cost minimization data allocation algorithm for dynamic datacenter resizing | |
CN113079053B (en) | Virtual resource reconfiguration method and system based on particle swarm theory under network slice | |
Wang et al. | On runtime adaptive tile defragmentation for resource management in many-core systems | |
Liu et al. | Exploiting multi-level scratchpad memories for time-predictable multicore computing | |
CN106940682B (en) | Embedded system optimization method based on-chip programmable memory | |
Yang et al. | Partially shared cache and adaptive replacement algorithm for NoC-based many-core systems | |
Salman et al. | Solving the task assignment problem using Harmony Search algorithm | |
CN104111868B (en) | A kind of speculative multithreading dispatching method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20140326 |