# US 8,578,354 B2 · Link-time resource allocation for a multi-threaded processor architecture

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 8,578,354 B2
- Document ID: US8578354B2
- Status: Granted
- Kind: B2
- Application number: 12/992,178
- Filed: 2009-05-11
- Published: 2011-06-02
- Granted: 2013-11-05
- Earliest claimed: 2008-05-12
- Assignees: Xmos Ltd
- Applicants: Martin Young; Richard Osborne; Douglas Watt
- Inventors: Martin Young; Richard Osborne; Douglas Watt
- Web page: https://patentgrep.com/patent/US8578354B2

## CPC

- G06F 8/54: Link editing before load time
- G06F 8/314: {Parallel programming languages (G06F8/313 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method comprising: independently compiling a plurality of modules of source code to generate a plurality of respective object modules comprising a plurality of respective parallel threads explicitly designated by a user to be executed in parallel on a target platform; in each of the object modules, inserting at least one symbol indicative of a usage of a resource of the target platform associated with the respective thread; executing a linker to perform a linking process for linking the object modules, wherein the linking process comprises assessing the symbols in conjunction with one another, and based on the assessment generating an indication relating to a usage of the resource required for execution of the threads in parallel.

## Claims

### Claim 1

A method comprising:
independently compiling a plurality of modules of source code to generate a plurality of respective object modules comprising machine code and symbols other than machine code for providing information to a linker, different ones of the object modules comprising different respective parallel threads explicitly designated by a user to be executed in parallel on a target platform, and the target platform comprising an arrangement of interconnected processors;
in each of the object modules, inserting at least one of said symbols to indicate a usage of a resource of the target platform associated with the respective thread;
executing the linker to perform a linking process for linking the object modules, wherein the linking process comprises assessing the symbols in conjunction with one another to determine an allocation of the threads to different processors of the arrangement in dependence on the threads' associated resource usage, and based on the assessment generating an indication relating to a usage of the resource required for execution of said threads in parallel, said indication comprising an indication of said allocation;
wherein the linking process further comprises linking the object modules using said indication to generate a computer program in which said threads are to be executed in parallel on the allocated processors.

### Claim 2 (depends on 1)

The method of claim 1, wherein said assessment comprises determining whether a total of the resource usage required by the threads exceeds a maximum limit, said indication comprising an indication of whether the total resource usage exceeds said maximum limit.

### Claim 3 (depends on 2)

The method of claim 2, wherein the method comprises halting the linking process on condition that said indication indicates that the total of the resource usage does exceed the maximum limit.

### Claim 4 (depends on 2)

The method of claim 2, wherein said generation of the indication comprises generating an error message to a user.

### Claim 5 (depends on 2)

The method of claim 2, wherein the method comprises, on condition that said indication indicates that the total of the resource usage does exceed the maximum limit:
modifying one or more of the modules of source code to avoid the exceeding of the maximum limit;
re-compiling the one or more modules of source code to re-generate the object modules; and
following the modification and re-compilation, re-executing the linker to link the object modules to generate a computer program in which said threads are to be executed in parallel.

### Claim 6 (depends on 2)

The method of claim 2, wherein the maximum limit is the total available of the resource on the target platform.

### Claim 7 (depends on 1)

The method of claim 1, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of an amount of memory required by the respective thread, said indication comprising an indication relating to a memory usage required for execution of said threads in parallel.

### Claim 8 (depends on 1)

The method of claim 1, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of the number of ports required by the respective thread, said indication comprising an indication relating to a usage of ports required for execution of said threads in parallel.

### Claim 9 (depends on 1)

The method of claim 1, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of the number of timers required by the respective thread, said indication comprising an indication relating to a usage of timers required for execution of said threads in parallel.

### Claim 10 (depends on 1)

The method of claim 1, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of a number of channel ends required by the respective thread, the channel ends being a resource of the target platform for communicating between threads, and said indication comprising an indication relating to a usage of channel ends required for execution of said threads in parallel.

### Claim 11 (depends on 1)

The method of claim 1, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of a number of parallel threads of other object modules whose execution is to be initiated by a procedure of the respective thread, and said indication comprising an indication of a number of threads required to be executed in parallel as a result of that procedure.

### Claim 12 (depends on 1)

The method of claim 1, wherein said assessment comprises determining an allocation of an amount of the resource for execution of the threads in parallel, said indication comprising an indication of the allocated amount; and
the linking process comprises linking the object modules using said indication to generate a computer program in which said threads are to be executed in parallel using the allocated amount of the resource.

### Claim 13 (depends on 12)

The method of claim 12, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of a stack requirement for the respective thread, said indication comprising an indication relating to a stack allocation for execution of said threads in parallel.

### Claim 14 (depends on 13)

The method of claim 13, wherein the stack allocation comprises a stack size.

### Claim 15 (depends on 13)

The method of claim 13, wherein the stack allocation comprises a stack offset.

### Claim 16 (depends on 1)

The method of claim 1, wherein:
said insertion of a symbol in at least one of the object modules comprises defining that symbol as an expression by including in the object module an indication of an operation and at least one operand; and
said assessment comprises evaluating the expression to determine the resource usage required by execution of the threads in parallel.

### Claim 17 (depends on 16)

The method of claim 16, wherein one or more of said operands comprises an indication of another symbol of another object module, thus defining the symbol as a function of those one or more other symbols.

### Claim 18 (depends on 17)

The method of claim 17, wherein the expression comprises an expression to determine the sum of the resources required by the parallel threads.

### Claim 19 (depends on 17)

The method of claim 17, wherein the expression comprises an expression to determine the maximum of the resources required by two or more of the respective threads.

### Claim 20 (depends on 2)

The method of claim 2, wherein the method comprises:
in at least one of the object modules, inserting an error message associated with the respective symbol; and
outputting the error message to a user on the condition of finding that the total usage exceeds said maximum limit.

### Claim 21 (depends on 20)

The method of claim 20, wherein the error message is inserted as a string associated with the respective symbol.

### Claim 22 (depends on 1)

The method of claim 1, wherein the threads are explicitly designated in one or more of the source code modules to be executed in parallel.

### Claim 23 (depends on 1)

The method of claim 1, wherein each of said threads comprises at least one procedure and at least one of said threads comprises a plurality of procedures, wherein said insertion of a symbol in each object module indicative of a resource usage required by the respective thread comprises inserting a symbol indicative of a resource usage required by a procedure of the respective thread, and said assessment comprises determining whether the total resource usage required by parallel execution of procedures exceeds a maximum limit.

### Claim 24

A tool-chain comprising code embodied on a non-transitory computer-readable storage medium, the code comprising:
first code for individually compiling and assembling a plurality of modules of source code into respective object modules comprising machine code and symbols other than machine code for providing information for linking, different ones of the object modules comprising different respective parallel threads explicitly designated by a user to be executed in parallel on a target platform, and the target platform comprising an arrangement of interconnected processors, wherein the first code comprises code which when executed on a computer will insert in each of the object modules at least one of said symbols to indicate a usage of a resource of the target platform associated with the respective thread; and
second code for linking the object modules, the second code comprising code which when executed on a computer will assess the symbols in conjunction with one another to determine an allocation of the threads to different processors of the arrangement in dependence on the threads' associated resource usage, and based on the assessment generate an indication relating to a usage of the resource required by execution of said threads in parallel, said indication comprising an indication of said allocation;
wherein the second code is configured to link the object modules using said indication to generate a computer program in which said threads are to be executed in parallel on the allocated processors.

### Claim 25 (depends on 24)

The tool-chain of claim 24, wherein said assessment comprises determining whether a total of the resource usage required by the threads exceeds a maximum limit, said indication comprising an indication of whether the total resource usage exceeds said maximum limit.

### Claim 26 (depends on 25)

The tool-chain of claim 25, wherein the second code comprises code which when executed on a computer will halt the linking process on condition that said indication indicates that the total of the resource usage does exceed the maximum limit.

### Claim 27 (depends on 25)

The tool-chain of claim 25, wherein said generation of the indication comprises generating an error message to a user.

### Claim 28 (depends on 25)

The tool-chain of claim 25, wherein the second code comprises code for, on condition that said indication indicates that the total of the resource usage does exceed the maximum limit:
following modification of one or more of the modules of source code to avoid the exceeding of the maximum limit and re-compilation of the one or more modules of source code to re-generate the object modules, linking the object modules to generate a computer program in which said threads are to be executed in parallel.

### Claim 29 (depends on 25)

The tool-chain of claim 25, wherein the maximum limit is the total available of the resource on the target platform.

### Claim 30 (depends on 24)

The tool-chain of claim 24, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of an amount of memory required by the respective thread, said indication comprising an indication relating to a memory usage required for execution of said threads in parallel.

### Claim 31 (depends on 24)

The tool-chain of claim 24, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of the number of ports required by the respective thread, said indication comprising an indication relating to a usage of ports required for execution of said threads in parallel.

### Claim 32 (depends on 24)

The tool-chain of claim 24, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of the number of timers required by the respective thread, said indication comprising an indication relating to a usage of timers required for execution of said threads in parallel.

### Claim 33 (depends on 24)

The tool-chain of claim 24, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of a number of channel ends required by the respective thread, the channel ends being a resource of the target platform for communicating between threads, and said indication comprising an indication relating to a usage of channel ends required for execution of said threads in parallel.

### Claim 34 (depends on 24)

The tool-chain of claim 24, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of a number of parallel threads of other object modules whose execution is to be initiated by a procedure of the respective thread, and said indication comprising an indication of a number of threads required to be executed in parallel as a result of that procedure.

### Claim 35 (depends on 24)

The tool-chain of claim 24, wherein said assessment comprises determining an allocation of an amount of the resource for execution of the threads in parallel, said indication comprising an indication of the allocated amount; and
the second code comprises code which when executed on a computer will link the object modules using said indication to generate a computer program in which said threads are to be executed in parallel using the allocated amount of the resource.

### Claim 36 (depends on 35)

The tool-chain of claim 35, wherein said insertion of a symbol indicative of a resource usage in each object module comprises inserting a symbol indicative of a stack requirement for the respective thread, said indication comprising an indication relating to a stack allocation for execution of said threads in parallel.

### Claim 37 (depends on 36)

The tool-chain of claim 36, wherein the stack allocation comprises a stack size.

### Claim 38 (depends on 36)

The tool-chain of claim 36, wherein the stack allocation comprises a stack offset.

### Claim 39 (depends on 24)

The tool-chain of claim 24, wherein:
said insertion of a symbol in at least one of the object modules comprises defining that symbol as an expression by including in the object module an indication of an operation and at least one operand; and
said assessment comprises evaluating the expression to determine the resource usage required by execution of the threads in parallel.

### Claim 40 (depends on 39)

The tool-chain of claim 39, wherein one or more of said operands comprises an indication of another symbol of another object module, thus defining the symbol as a function of those one or more other symbols.

### Claim 41 (depends on 40)

The tool-chain of claim 40, wherein the expression comprises an expression to determine the sum of the resources required by the parallel threads.

### Claim 42 (depends on 40)

The tool-chain of claim 40, wherein the expression comprises an expression to determine the maximum of the resources required by two or more of the respective threads.

### Claim 43 (depends on 25)

The tool-chain of claim 25, wherein:
the first code comprises code which when executed on a computer will insert an error message associated with the respective symbol in at least one of the object modules; and
the second code comprises code which when executed on a computer will output the error message to a user on the condition of finding that the total usage exceeds said maximum limit.

### Claim 44 (depends on 43)

The tool-chain of claim 43, wherein the error message is inserted as a string associated with the respective symbol.

### Claim 45 (depends on 24)

The tool-chain of claim 24, wherein the threads are explicitly designated in one or more of the source code modules to be executed in parallel.

### Claim 46 (depends on 24)

The tool-chain of claim 24, wherein each of said threads comprises at least one procedure and at least one of said threads comprises a plurality of procedures, wherein said insertion of a symbol in each object module indicative of a resource usage required by the respective thread comprises inserting a symbol indicative of a resource usage required by a procedure of the respective thread, and said assessment comprises determining whether the total resource usage required by parallel execution of procedures exceeds a maximum limit.

### Claim 47

A compiler and assembler product for individually compiling and assembling a plurality of modules of source code, wherein the compiler and assembler product comprises code embodied on a non-transitory computer-readable storage medium which when executed on a computer performs steps of:
independently generating a plurality of respective object modules from each of the modules of source code, the object modules comprising machine code and symbols other than machine code for providing information to a linker, different ones of the object modules comprising different respective threads explicitly designated by a user to be executed in parallel on a target platform, and the target platform comprising an arrangement of interconnected processors; and
in the compilation of each object modules, inserting at least one of said symbols to indicate a usage of a resource of the target platform associated with the respective thread, for use by the linker to determine an allocation of the threads to different processors of the arrangement in dependence on the threads' associated resource usage and thereby link the object modules using said indication to generate a computer program in which said threads are to be executed in parallel on the allocated processors.

### Claim 48

A linker for linking a plurality of independently compiled object modules, the object modules comprising machine code and additional symbols other than machine code for providing information to the linker, different ones of the object modules comprising different respective threads explicitly designated by a user to be executed in parallel on a target platform, and the target platform comprising an arrangement of interconnected processors, each object module comprising at least one of said symbols being indicative of a usage of a resource of the target platform associated with the respective thread; wherein the linker comprises code embodied on a non-transitory computer-readable storage medium which when executed on a computer performs steps of:
assessing the symbols in conjunction with one another to determine an allocation of the threads to different processors of the arrangement in dependence on the threads' associated resource usage, and based on the assessment generating an indication relating to a usage of the resource required by execution of said threads in parallel, said indication comprising an indication of said allocation; and
linking the object modules using said indication to generate a computer program in which said threads are to be executed in parallel on the allocated processors.
