Hi,
Any idea how does the xtimecomposser dynamically allocate the required number of logical cores once the par statment used out side the main function. I would like to know in depth the allocation mechanism
“par” statement
-
- Member++
- Posts: 19
- Joined: Sun Mar 23, 2014 9:51 pm
-
- XCore Expert
- Posts: 754
- Joined: Thu Dec 10, 2009 6:56 pm
Hi,
The code will execute a GETR instruction (get resource) to get a handler to a hardware thread (logical core if you want) as many times as there is concurrency in your par statement. This will fail of course when there are no more hardware threads available. Therefore the tools will try to determine and inform you whether there are enough hardware threads available using static code analysis.
The code will execute a GETR instruction (get resource) to get a handler to a hardware thread (logical core if you want) as many times as there is concurrency in your par statement. This will fail of course when there are no more hardware threads available. Therefore the tools will try to determine and inform you whether there are enough hardware threads available using static code analysis.
-
- Member++
- Posts: 19
- Joined: Sun Mar 23, 2014 9:51 pm
Dear Bianco,
Thanks a lot for your kind reply. However, what I am looking for is how the GET it calculating the number of needed logical core and how it assign this particular function to this particular core. Because I noticed that in my program there is some function where it has been assigned to two logical cores. In which I thought there is some sort of calculation(formula) been used by the system to conduct such job. One more thing I would like to know if there is any way to assign the core number while using par statement outside main function.
Thanks a lot for your kind reply. However, what I am looking for is how the GET it calculating the number of needed logical core and how it assign this particular function to this particular core. Because I noticed that in my program there is some function where it has been assigned to two logical cores. In which I thought there is some sort of calculation(formula) been used by the system to conduct such job. One more thing I would like to know if there is any way to assign the core number while using par statement outside main function.
-
- Respected Member
- Posts: 347
- Joined: Wed Jan 27, 2016 5:21 pm
Hi malbahri,
I am not sure I understand exactly what you mean; but just to expand on what Bianco said; the XC compiler works out for each function how many hardware threads it needs to run a function; this is the maximum of the number of hardware threads of all functions called (if straight line code), or it is the sum of the number of hardware threads needed in each statement of a PAR. You get the gist.
This expression is then embedded in the assembly code using something like
Compile a .XC file with the -S flag and you will see the expression for your function.
The linker then takes all those expressions and works out how many hardware threads each function requires.
Cheers,
Henk
I am not sure I understand exactly what you mean; but just to expand on what Bianco said; the XC compiler works out for each function how many hardware threads it needs to run a function; this is the maximum of the number of hardware threads of all functions called (if straight line code), or it is the sum of the number of hardware threads needed in each statement of a PAR. You get the gist.
This expression is then embedded in the assembly code using something like
Code: Select all
.globl func.maxthreads
.linkset func.maxthreads (expression that describes the total)
The linker then takes all those expressions and works out how many hardware threads each function requires.
Cheers,
Henk
-
- XCore Expert
- Posts: 966
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
Sadly not. You can use [[combine]] before your par though.
One more thing I would like to know if there is any way to assign the core number while using par statement outside main function.
-
- Member++
- Posts: 19
- Joined: Sun Mar 23, 2014 9:51 pm
Dear Henk and Ross,
Thanks a lot for your kind help and Valuable comments
Thanks a lot for your kind help and Valuable comments