Machine tool controller including a multi-core processor for dividing a large-sized program into portions stored in different lockable instruction caches
10127045 ยท 2018-11-13
Assignee
Inventors
Cpc classification
G06F9/3814
PHYSICS
G06F9/5066
PHYSICS
International classification
G06F9/38
PHYSICS
Abstract
A sequential program is divided into programs each with a size fitted into a cache memory using program profile information and prepared cache memory information. Program profile information on the sequential program and information on the cache memory are acquired. Based on the acquired information, division addresses at which the sequential program is divided are determined. The IDs of the division programs, assigned core numbers, the start addresses and end addresses of the programs, and cache storage block information are stored in a memory as program execution information.
Claims
1. A controller comprising a multi-core processor comprising a plurality of cores with independent instruction cache memories to execute a sequential program with a size exceeding a capacity of one of the instruction cache memories, the controller comprising: a memory in which the sequential program is stored; and the multi-core processor configured to execute instructions to perform a method including: analyzing an arrangement of the sequential program in the memory to generate and store program profile information in the memory; dividing, based on the program profile information, the sequential program into a plurality of divided programs each with a size fitted into one of the instruction cache memories and storing program execution information on the divided programs in the memory; storing, in accordance with the program execution information, a first divided program in a first instruction cache memory of the instruction cache memories and inhibiting rewriting of the first instruction cache memory with the first divided program stored therein by locking the first instruction cache memory; storing, after execution of the first divided program stored in the first instruction cache memory is started and before execution of the first divided program stored in the first instruction cache memory has ended, based on the program execution information, a second divided program to be executed next in a second instruction cache memory of another core and inhibiting rewriting of the second instruction cache memory with the second divided program stored therein by locking the second instruction cache memory; starting execution of the second divided program to be executed next when the first divided program in execution ends; and cancelling the inhibiting of rewriting of the first instruction cache memory of the core having executed the first divided program by unlocking the first instruction cache memory when the first divided program in execution ends.
2. The controller according to claim 1, wherein the multi-core processor is further configured to execute instructions to perform the method including: estimating a processing time for each of the divided programs; estimating a time needed to store each of the divided programs in a corresponding instruction cache memory; and starting storing of the second divided program in the second instruction cache memory when a remaining execution time before an end of the first divided program in execution becomes equal to a time needed to store the second divided program to be executed next in the second instruction cache memory.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1) The above-described and other objects and features of the present invention will be apparent from the following description of embodiments with reference to attached drawings, in which:
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
(18) Embodiments of the present invention will be described in conjunction with the drawings. Components of the embodiments which are identical or similar to the corresponding components of the conventional technique are described using the same reference numerals.
(19)
(20) A numerical controller 10 includes a multi-core processor 70, a servo motor control section 13, and an amplifier interface section 14.
(21) The multi-core processor 70 has three cores assigned as a first numerical control section processor core 71, a second numerical control section processor core 72, and a PMC control section processor core 73. The processor cores 71, 72, and 73 connect to respective independent first-level instruction cache memories. The first numerical control section processor core 71 connects to a first instruction cache memory (L1 cache) 74. The second numerical control section processor core 72 connects to a second instruction cache memory (L1 cache) 75. The PMC control section processor core 73 connects to a third instruction cache memory (L1 cache) 76.
(22) The multi-core processor 70 is configured such that a second-level cache memory is shared by the plurality of cores. The first instruction cache memory 74, the second instruction cache memory 75, and the third instruction cache memory 76 are connected to a cache memory (L2 cache memory) 77 that is a second-level cache memory.
(23) The multi-core processor 70, a DRAM 79, and an integrated peripheral LSI 60 are connected together via a bus 78. A machine side IO unit 16 is connected to the integrated peripheral LSI 60 via a field bus 17.
(24) The servo motor control section 13 includes a servo control section processor 40 and a peripheral control LSI 45. These elements are connected together via a bus 43. The amplifier interface section 14 includes a peripheral control LSI 55. A motor control amplifier 18 is connected to the peripheral control LSI 55 of the amplifier interface section 14 via a serial servo bus 19.
(25) The multi-core processor 70, the servo motor control section 13, and the amplifier interface section 14 are connected together via an internal bus 15.
(26) In the numerical controller 10 depicted in
(27) First, a first embodiment of the controller according to the present invention will be described using
(28)
(29) As depicted in
(30) In this embodiment, in processing by the program profile information generating section depicted in
(31) In the sequential program P depicted in
(32) Now, a method in which a program execution information generating section in the first embodiment of the controller according to the present invention divides the sequential program P will be described. As illustrated in a flowchart in
(33) The flowchart in
(34) The program profile information (see
(35) Now, the division of the sequential program P depicted in
(36)
(37) First, such a division address <1> as sets the size of the program to be equal to or smaller than the product of the capacity c1_size of the instruction cache memory with a core number 1 and usage rate c1_rate is determined. Thus, a division program P1 is obtained.
(38) The following are stored in the memory as the program execution information (see
(39) Then, such a division address <2> as sets the size of the program to be equal to or smaller than the product of the capacity c2_size of the instruction cache memory with a core number 2 and usage rate c2_rate is determined. Thus, a division program P2 is obtained.
(40) The following are stored in the memory as the program execution information: the start address p2_start and end address p2_end of the division program P2, the start address p2block1_start and size p2block1_size of a block 1 stored in the instruction cache memory, and the start address p2block2_start and size p2block2_size of a block 2.
(41) Subsequently, a division address <3> and a division address <4> are similarly determined, and the program is divided at the division addresses to obtain division programs P3, P4, and P5. The start addresses, end addresses, and block start addresses of the respective programs are stored in the memory as program execution information.
(42)
(43) The program execution information on the division program P1 is as follows:
(44) Assigned core number: 1
(45) Block start address: p1_start
(46) Program end address: p1_end
(47) Cache storage block information Start address of the block 1: p1block1_start Size of the block 1: p1block1_size Start address of the block 2: p1block2_start Size of the block 2: p1block2_size
(48) The program execution information on the division program P2 is as follows:
(49) Assigned core number: 2
(50) Block start address: p2_start
(51) Program end address: p2_end
(52) Cache storage block information Start address of the block 1: p2block1_start Size of the block 1: p2block1_size Start address of the block 2: p2block2_start Size of the block 2: p2block2_size
(53) The program execution information on the division program P3 is as follows:
(54) Assigned core number: 1
(55) Block start address: p3_start
(56) Program end address: p3_end
(57) Cache storage block information Start address of the block 1: p3block1_start Size of the block 1: p3block1_size Start address of the block 2: p3block2_start Size of the block 2: p3block2_size
(58) The program execution information on the division program P4 is as follows:
(59) Assigned core number: 2
(60) Block start address: p4_start
(61) Program end address: p4_end
(62) Cache storage block information Start address of the block 1: p4block1_start Size of the block 1: p4block1_size Start address of the block 2: p4block2_start Size of the block 2: p4block2_size
(63) The program execution information on the division program P5 is as follows:
(64) Assigned core number: 1
(65) Block start address: p5_start
(66) Program end address: p5 end
(67) Cache storage block information Start address of the block 1: p5block1_start Size of the block 1: p5block1_size Start address of the block 2: p5block2_start Size of the block 2: p5block2_size
(68) Now, execution of the divided programs by the cores will be described using
(69) The flowchart of the processing executed by the scheduler section, depicted in
(70) The program execution information is acquired from the memory of the controller (step sc01). When any division program is to be executed (step sc02), the scheduler section requests the instruction cache control section to store the division program in the instruction cache memory (step sc03). When the storage in the instruction cache memory is complete (step sc04), the scheduler section checks whether or not any division program is in execution (step sc05). When a division program is in execution, the division program stored in the instruction cache memory waits for the division program in execution to end (step sc06). When no division program is in execution, the completely stored division program starts to be executed (step sc07). The scheduler section returns to step sc02 to continue processing.
(71)
(72) The cache control section determines whether or not a program storage request has been issued (step sd01). When the program storage request has been issued, the program number of the program to be stored is acquired (step sd02). The addresses and size of the division program to be stored are acquired from the program execution information and stored in the instruction cache memory (step sd03). The instruction cache memory block of the stored division program is set for rewrite inhibition (step sd04) to end the processing. On the other hand, when no program storage request has been issued, the cache control section checks whether any request to cancel rewrite inhibition has been issued (step sd05). When a request to cancel rewrite inhibition has been issued, the number of the program for which the rewrite inhibition is to be canceled is acquired (step sd06). The addresses and size of the program for which the rewrite inhibition is to be canceled are acquired from the program execution information. The rewrite inhibition is canceled (step sd07) to end the processing.
(73) As depicted in the flowchart of the scheduler section in
(74) Upon receiving the request, the cache control section stores the program P1 in the instruction cache memory, locks the instruction cache memory with the program P1 stored therein, and notifies the scheduler section of fulfillment of the request, as depicted in the flowchart in
(75) Then, while the program P1 is in execution, the scheduler section requests the cache control section of the core 2 to store the program P2 to be executed next based on the program execution information, in the instruction cache memory of the core 2 and to lock the instruction cache memory with the program P2 stored therein. Upon receiving the request, the cache control section stores the program P2 in the instruction cache memory, and locks the instruction cache memory with the program P2 stored therein.
(76) After the issuance of the request to the cache control section is complete and after the program P1 in execution ends, the scheduler section immediately starts executing the program P2 and requests the cache control section to unlock the instruction cache memory of the core 1, which has executed the program P1.
(77) Subsequently, a similar procedure is used to execute the programs P3, P4, and P5.
(78) A second embodiment of the controller according to the present invention will be described with reference to
(79)
(80) The controller of the present embodiment corresponds to the controller of the above-described first embodiment in which additionally the processing time estimating section analyzes the program data on the memory to estimate the processing time for each divided program and stores the processing time in the program execution information and in which the instruction cache memory storage time estimating section estimates the time needed to store each divided program in the instruction cache memory based on the program execution information and stores the time in the program execution information (see
(81)
(82) The scheduler section issues a request to store the nth (n>1) program Pn in the instruction cache memory when a time from the activation of the n1th program until the start of storage in the instruction cache memory elapses (the processing time p(n1)run_time for the n1th program minus the time pnsave_time needed to store the nth program in the instruction cache memory). The request to store the program P1 in the instruction cache memory is issued the instruction cache memory storage time before the time to periodically activate the sequential program.
(83) In the embodiment, as depicted in the flowchart of the processing by the scheduler section in
(84) The scheduler section presets a timer value in the timer control section so that the timer event occurs p1save_time (the cache storage time for the first program) before the activation period time for the sequential program. Using the timer event, the scheduler section requests the cache control section to store the program P1 in the instruction cache memory of the core 1 and lock the instruction cache memory with the program P1 stored therein.
(85) Upon receiving the request, the cache control section, in accordance with the flowchart of the processing by the cache control section in
(86) Upon receiving the notification of completion of fulfillment of the request from the cache control section, the scheduler section activates the program P1 and sets a timer for p1run_time minus p2save_time in the timer control section, when a time to start activating the sequential program is reached. Then, using the timer event from the timer control section, the scheduler section requests the cache control section of the core 2 to store the program P2 in the instruction cache memory and lock the instruction cache memory with the program P2 stored therein, based on the program execution information.
(87) Upon receiving the request, the cache control section stores the program P2 in the instruction cache memory, locks the instruction cache memory with the program P2 stored therein, and notifies the scheduler section of fulfillment of the request.
(88) When the scheduler section receives the notification of fulfillment of the request from the cache control section and when the program P1 in execution ends, the scheduler section immediately starts executing the program P2, sets a timer for p2run_time minus p3save_time in the timer control section, and requests the cache control section to unlock the instruction cache memory of the core 1, which has executed the program P1. Subsequently, a similar procedure is used to execute the programs P3, P4, and P5 (
(89) This minimizes the time for which the instruction cache memory is locked as a result of the execution of the sequential program P, and is expected to improve the performance of the system as a whole.