A method for automatically generating a sequence of Nmax instructions in assembly language, executable without error by a multi-core processor.

The method automates the generation of assembly code sequences with varied memory access profiles, addressing the limitations of manual methods by providing rapid, error-free, and diverse sequences for multi-core processors, enhancing performance testing and learning capabilities.

FR3146750A1Active Publication Date: 2024-09-20THALES SA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
FR2023002516
Authority / Receiving Office
FR · FR
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-17
Publication Date
2024-09-20
Estimated Expiration
2043-03-17

AI Technical Summary

Technical Problem

Current methods for generating assembly code sequences are time-consuming, require manual expertise, and produce sequences with limited diversity and similar memory access profiles, making it difficult to characterize and quantify memory contention behavior, especially in multi-core processors, which is critical for performance testing and certification.

Method used

A method for automatically generating a sequence of Nmax instructions in assembly language, using statistical metrics and rules to select instructions based on memory access profiles, ensuring varied characteristics and precise execution without errors, suitable for multi-core processors.

Benefits of technology

Enables rapid generation of long, consistent, and varied assembly code sequences with controlled memory access profiles, facilitating the creation of a learning database for estimating memory contention behavior and performance testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000
    Figure 00000000_0000
Patent Text Reader

Abstract

The invention relates to a method for automatically generating a sequence of Nmax instructions in assembly language, executable without error by a multi-core processor, comprising the steps of: initializing the processor registers, then selecting a first instruction from the predetermined sequence, possibly at random; and selecting an N+1st instruction from among a read instruction in a memory connected to the processor cores by a memory bus, a write instruction in said memory, and a local instruction using only the processor registers, according to rules and priorities among said rules, said rules using respective differences in the values ​​of statistical metrics of a memory access profile (P) of the sequence of the preceding N instructions comprising values ​​of statistical metrics, with reference values. Figure for the abstract: [Fig. 4]
Need to check novelty before this filing date? Find Prior Art

Description

Description Title of the invention: Method for automatically generating a sequence of Nmax instructions in assembly language, executable error-free by a multi-core processor

[0001] | The invention relates to a method for automatically generating a sequence of Nmax assembly language instructions, executable without error by a multi-processor Hearts.

[0002] — The technical field of the invention is that of software in general and more particularly- lately from the generation of software plugs or "stubs" in English. A stopper is a software module that at least simulates the presence of another. In the case of a more sophisticated imitation, notably simulating a part of the functional exchanges- tional, we speak of simulators or models. In the present invention, we are limited to simulate the impact of software execution on the activity of a memory bus, we do not does not seek to simulate the functional aspect of the application.

[0003] — The invention also relates to the performance testing of embedded software (Worst Worst Case Execution Time or WCET in English, and the analysis of the problem of memory contention or interference processors or multi-cores and the behavior of software in relation to this: including the notions of aggressiveness and sensitivity.

[0004] — The present invention is a means for automatically and rapidly generating, software plugs with targeted characteristics and controlled behavior vis- with regard to memory contention.

[0005] Currently, to build a software plug, a sequence of code is developed by a programmer, in assembler or high-level language, and it is executed in a loop.

[0006] It is known to generate, by a software engineer, a sequence of code in language assembly machine or high-level language such as C, which is executed in a loop. The characteristics of this sequence are determined by analyzing a software engineer, depending on his expertise in assembler code and the impact of each instruction on memory contention.

[0007] — Such a "manual" construction of an assembler code sequence comes up against the intrinsic limitations of such manual activity such as a long time for large sequences, of the order of several tens of minutes, or even several hours to construct a sequence of several thousand as- seeming, or as the fine skills needed to secure execution on target of each sequence requiring compliance with the constraints linked to each ins- instruction (value of operands, memory addressing, register management). Therefore, the size of manually constructed sequences is often limited to a few instructions (at most a few dozen). However, the size of the generated sequences is important to obtain a large diversity of Memory Access Profiles (sequences of a few dozen instructions will end up having similar profiles). It is also known to construct a code sequence automatically, for example by choosing instructions at random from the microprocessor's instruction dictionary. The automatic construction of sequences of several hundred instructions by random selection from the microprocessor's instruction dictionary amounts to making multiple successive random selections, and therefore sees the law of large numbers apply. Also, we obtain statistically very similar instruction sequences, which reflect the statistical distribution in the dictionary of instructions of type read R, write W and local (i.e.: only working on registers), as well as an average Shannon entropy E. As a result, it is currently very difficult to quickly construct instruction sequences with varied and precisely chosen characteristics, whether with a view to making them a learning base of several thousand items or to construct a single software plug with chosen characteristics. Often, the behavior of such sequences with respect to memory contention is difficult to anticipate: it is difficult to quantify its capacities to generate and / or undergo memory contention, called respectively its aggressiveness and its sensitivity. When using multi-core microprocessors, several resources can be shared by different software running in parallel on different cores. In particular, memory or RAM, an acronym for "Random Access Memory", is accessible via a bus common to all cores. Like any shared resource, this bus is managed by a controller which manages simultaneous and concurrent access according to its own arbitration logic, causing the slowdown of one or other of the software running on the different cores. Depending on the activity of these software programs and especially their way of accessing memory (we speak of Memory Access Profile or "Memory Access Pattern" in English), their execution slows down (linked to the wait during the execution of assembler instructions accessing memory in the event of concurrent access). This slowdown depends on: memory bus controller arbitration logic, the software's memory access profile, and profiles of software running in parallel on other cores. This phenomenon is known as memory interference or contention. In the context of critical embedded software, it is necessary (and sometimes required by certification authorities) to provide the worst-case software execution time or WCET, in order to verify that it has time to execute in the time allocated to it. This characterization, already difficult for complex software on single-core microprocessors, becomes even more problematic on multi-core microprocessors, due to this contention phenomenon involving all the software running in parallel. We define the notions of aggressiveness, or capacity to generate memory contentions, and sensitivity or propensity to undergo them, by measurement in the face of reference applications that we give ourselves: a reference sensitive application is built, running a loop of assembler instructions identified, by analysis, as lower priority in the memory bus arbitration mechanisms. A counter is in- cremented each time the loop is executed, and an aggressive benchmark application is built on the same principle with one of the highest priority instruction loops. To measure the aggressiveness and sensitivity of an assembly code sequence, it is executed in a loop over the same period of time in the following configurations: Running the sensitive application alone: ​​the number of loops is noted executed over the period; Execution of the sequence alone: ​​we note the number of loops executed on the period; Execution of the sequence in parallel with the sensitive application: we measure slowing down the sensitive application when running in parallel the code sequence, relative to its execution alone; Execution of the sequence in parallel with the aggressive application: we measure the slowdown of the tested sequence when it runs in parallel with aggressive application, compared to running it alone. Aggressiveness, as illustrated in [Fig.1], is the ratio of the number of loops executed by the sensitive reference application over the same period of time when executed alone and in parallel with the tested sequence. Sensitivity, as illustrated in [Fig.2], is the ratio of the number of loops executed by the aggressive reference application over the same period of time when executed alone and in parallel with the tested sequence. Sensitivity and aggressiveness are ratios and are therefore expressed as percentages. The phenomenon of memory contention or interference being intrinsically linked to requests of the memory bus by software, we seek to characterize these requests. For this, it is known to define a memory access profile P of an assembler code sequence by a sequential list of assembler instructions accessing the memory (extract from this code sequence), as well as the memory addresses which are accessed, as illustrated in [Fig.3]. This memory access profile P is supplemented by statistical characteristics calculated on this list, in particular, but not exhaustively, by: a memory intensity I, representative of the number of access instructions in reading R for Read in English language or writing access W for Write in English language, vs the total number of instructions; a representative read / read-write ratio or read / memory ratio Rwr of the number of read access instructions R vs number of instructions memory access (reading and writing). We will subsequently call the number of read-write accesses by the term the number of memory accesses; a Shannon entropy E of the memory access profile P representative of the randomness of the addresses accessed in memory; and an interleaving IV, for interleaving in English language, instructions read access R and write access W instructions. The paper "Improving Prediction Accuracy of Memory Interferences for Multicore Platforms", by C.Courtaud et al, hal-02401625, details these statistical characteristics and demonstrates their relevance for characterizing the sensitivity of software to contention. One aim of the invention is to overcome the problems mentioned above, and in particular to propose a solution enabling the automatic and rapid generation of assembler code sequences: executable without error (i.e.: without stopping execution following an exception software); having memory access profiles P with chosen and varied characteristics, and so a priori: more or less aggressive (generating more or less memory contention); More or less sensitive (undergoing more or less restraints). Another object of the invention is to use these assembly code sequences to construct: a database of several thousand software plugs with access profiles known memory whose aggressiveness and sensitivity are measured. This base can be used for training (by machine learning or Machine English language learning) a model capable of estimating aggression and sensitivity of memory access profiles extracted from real applications em- critical barges; and software plugs with characterized memory access profiles allowing simulate the aggressiveness and sensitivity of competing embedded applications to perform WCET performance tests of an embedded application given. According to one aspect of the invention, there is proposed a method for automatically generating a sequence of Nmax instructions in assembly language, executable without error by a multi-core processor, comprising the steps of: initialization of the processor registers, then choice of a first instruction of the predetermined sequence, possibly at random; and choice of an N+18we instruction, among a read instruction in a memory connected to the processor cores by a memory bus, an ins- instruction to write to said memory, and a local instruction using only processor registers, based on rules and priorities between said rules, said rules using respective deviations of values ​​of statistical metrics of a memory access profile of the sequence of N ins- previous instructions including statistical metric values, with setpoint values. In one embodiment, the statistical metrics of the memory access profile of the sequence of the preceding N instructions comprise: a memory intensity corresponding to the ratio of the number of access instructions in reading or writing and the total number of instructions N; a read / memory ratio corresponding to the ratio of access instructions in reading and memory access instructions (read and write); and a Shannon entropy E of the memory access profile representative of the randomness of the addresses accessed in memory. According to one embodiment, the statistical metrics of the memory access profile of the sequence of the N preceding instructions further comprise an interleaving of the read access instructions and the write access instructions. In one embodiment, the rules include a first test rule if the memory intensity is greater than a memory intensity setpoint, in which case the choice of the N+1iwe instruction is a local instruction, and otherwise, the choice of the N+1th instruction is a read access instruction or a write access instruction. According to one embodiment, the rules include rules applied after the first rule, in any order: - a second test rule if the read / memory ratio is greater than a read / memory ratio instruction, in which case the choice of the N+1st instruction is an ins- read access instruction, and otherwise the choice of the N+1j*th instruction is a write access instruction: - a third test rule if the Shannon entropy E of the memory access profile is greater than a Shannon entropy E setpoint, in which case the choice of the memory address of the N+1'twe instruction is chosen so as to lower the entropy E, by taking an address already used or an address whose distance to the previous one is already known, and otherwise the choice of the memory address of the N+1ÿwe instruction is chosen at random: and - a fourth test rule if the interleaving is greater than an interleaving instruction, in which case the choice of the N+1itme instruction is a read access or write access instruction of the same type as the Nth instruction, and otherwise the choice of the N+1#we instruction is a read access or write access instruction of the opposite type to that of the Nêwe instruction. In one embodiment, the method further comprises integrating the sequence of Nmax assembly language instructions into an execution loop to generate executable software or software stub. The invention will be better understood by studying a few embodiments described as non-limiting examples and illustrated by the appended drawings in which: [Fig.1] schematically illustrates the aggressiveness of an assembler code sequence, according to the state of the art; [Fig.2] schematically illustrates the sensitivity of an assembler code sequence, according to the state of the art; [Fig.3] schematically illustrates a sequential list of assembler instructions accessing memory (extract from this code sequence), as well as the memory addresses that are accessed from a memory access profile, according to the state of the art; [Fig.4] schematically illustrates a method for automatically generating a sequence of Nmax instructions in assembly language, executable without error by a multi-core processor, according to one aspect of the invention; [Fig.5] schematically illustrates an example of instruction selection rules of the method of [Fig.4], according to one aspect of the invention; [Fig.6] schematically illustrates an automation of the process of selecting assembler instructions to quickly construct sequences, according to one aspect of the invention. In all figures, elements with identical references are similar. As illustrated in [Fig.4], the invention proposes a method for automatically generating a sequence of Nmax instructions in assembly language, executable without error by a multi-core processor, comprising the steps of: initialization of the processor registers, then choice of a first instruction of the predetermined sequence, possibly at random; and choice of an N+18we instruction, among a read instruction in a memory connected to the processor cores by a memory bus, an ins- instruction to write to said memory, and a local instruction using only processor registers, based on rules and priorities between said rules, said rules using respective deviations of values ​​of statistical metrics of a memory access profile P of the sequence of N ins- previous instructions including statistical metric values, with setpoint values. The statistical metrics of the memory access profile of the sequence of the previous N instructions include: a memory intensity Im corresponding to the ratio of the number of instructions read access R or write access W and the total number of instructions N; a read / memory ratio Rwr corresponding to the ratio of access instructions in reading R and memory access instructions (read R and write W); and a Shannon entropy E of the memory access profile P representative of the randomness of the addresses accessed in memory. The statistical metrics of the memory access profile of the sequence of the N preceding instructions may further comprise an interleaving Iv of the read access instructions R and the write access instructions W. [Fig.5] shows an example of instruction selection rules. The rules include a first test rule if the memory intensity Im is greater than a memory intensity setpoint Im_c, in which case the choice of the N+1st instruction is a local instruction, and otherwise, the choice of the N+18th instruction is a read access instruction R or a write access instruction W. Rules include rules applied after the first rule, in any order: - a second test rule if the read / memory ratio Rwr is greater than a read / memory ratio instruction Rwr_c, in which case the choice of the N+18th instruction is a read access instruction R, and otherwise the choice of the N+18th instruction is a write access instruction W; - a third test rule if the Shannon entropy E Ep of the memory access profile P is greater than a Shannon entropy E Ep_c setpoint, in which case the choice of the memory address of the N+1#we instruction is chosen so as to lower the entropy E, by taking an address already used or an address whose distance to the previous one is already known, and otherwise the choice of the memory address of the N+1#me instruction is chosen at random; and - a fourth test rule if the interleaving Iv is greater than an interleaving instruction Iv_c, in which case the choice of the N+1st instruction is a read access instruction R or write access instruction W of the same type as the Nth instruction, and otherwise the choice of the N+1st instruction is a read access instruction R or write access instruction W of the opposite type to that of the Nth instruction. Alternatively, other metrics can be considered, and other rules defined based on these to influence the choice of instructions, registers used, and memory addresses targeted. The method further comprises integrating the sequence of Nmax assembly language instructions into an execution loop to generate executable software or software stub. The invention makes it possible, as illustrated in [Fig.6], to automate the process of selecting assembler instructions to quickly construct sequences: of variable size, potentially very long (thousands of instructions), consistent and guaranteed execution on target (no execution errors), and to memory access profiles close to the chosen target values ​​or setpoints. In addition, automation makes it possible to quickly generate multiple sequences, with varied memory access profiles (depending on the multiple target values ​​chosen), and therefore to build a relevant learning base for automatic learning (machine learning), according to the following steps: generation of the assembler instruction sequence according to the pre- previously described; integration into a C skeleton and construction of the binary; measures of aggression A and sensitivity S on target; extraction of the memory access pattern and associated metrics; and capitalization of sequences, memory access patterns and measures for to build a learning base; an additional step may consist of using the base learning for supervised training of an estimator for the sens- sibility and aggressiveness (machine learning).

Claims

Claims

1. Method for automatically generating a sequence of Nmax ins- assembly language instructions, executable without error by a multi-core processor, comprising the steps of: initialization of the processor registers, then choice of a first instruction of the predetermined sequence, even- totally at random; and choice of an N+18th instruction, from an instruction of reading from memory connected to the processor cores by a memory bus, a write instruction in said memory, and a local instruction using only the processor registers, based on rules and priorities between said rules, said rules using gaps respective values ​​of statistical metrics of a profile (P) memory access of the sequence of the N previous instructions including statistical metric values, with setpoint values.

2. The method of claim |, wherein the statistical metrics of the memory access profile of the sequence of the N previous instructions include: a memory intensity (Im) corresponding to the ratio of the number of read (R) or write (W) access instructions and the total number of instructions N: a read / memory ratio (Rwr) corresponding to the ratio of read access instructions (W) and access instructions in memory (R, W); and a Shannon access entropy (E) of the memory access profile (P) representative of the randomness of the addresses accessed in memory.

3. The method of claim 2, wherein the statistical metrics of the memory access profile of the sequence of the N previous instructions further include an interleaving (Iv) of the access instructions in read (R) and write (W) access instructions.

4. Method according to one of the preceding claims, in which the rules include a first test rule if the memory intensity (Im) is greater than a memory intensity setpoint (Im_c), at which case the choice of the N+1 th instruction is a local instruction, and otherwise, the choice of the N+1st instruction is a read access instruction {R) or a write access instruction (W).

5. The method of claim 4, wherein the rules comprise rules applied after the first rule, in any order - a second test rule if the read / memory ratio (Rwr) is greater than a read / memory ratio setpoint (Rwr_c), in which case the choice of the N+1st instruction is a read access instruction (R), and otherwise the choice of the N+1#we instruction is an access instruction in writing (W); - a third test rule if the Shannon entropy E (Ep) of the profile memory access (P) is greater than an entropy setpoint (Ep_c) E of Shannon (Ep), in which case the choice of the memory address of the N+ ] 'ême instruction is chosen so as to lower the entropy E, by taking an address already in use or an address whose distance from the previous one is already known, and otherwise the choice of the memory address of the N+]#we ins- instruction is chosen at random; and - a fourth test rule if the interlacing (Iv) is greater than one interlacing instruction (Iv_c), in which case the choice of the N+]8th ins- instruction is a read access (R) or write access instruction (W) of the same type as the Nêwe instruction, and otherwise the choice of N+1 The th instruction is a read access (R) or a read access (R) instruction. writing (W) of the opposite type to that of the N®we instruction.

6. Method according to one of the preceding claims comprising, in furthermore, the integration of the sequence of Nmax instructions in language as- seem in a run loop to generate software executable or software plug.

Citation Information

Patent Citations

  • Systems and methods for modeling memory access behavior and memory traffic timing behavior

    US20160239212A1