Article: CELL Microprocessor III
By: Deadmeat (deadmeatoa.delete@this.yahoo.com), August 5, 2005 7:33 pm
Room: Moderated Discussions
Wow, my honor to be talking to you, Linus.
Having stated that, I would like to point you to this document.
http://www-128.ibm.com/developerworks/library/pa-cell/
This article is written by the IBM developer who implemted the APU driver as a virtual file system on Linux. He clarifies.
> Since every thread that executes the SPU_RUN ioctl blocks for the duration of the ioctl system call,
> it can not interact with any other system resources at the same time, including other SPU contexts or
> files belonging to the context it is executing in. A single process can work with multiple SPU contexts,
> but to run on more than one SPU at a given time, the process needs to contain at least one thread for each
> running SPU context.
>
> Likewise, if the program communicates with the SPU code using mailbox access, it needs to create a new thread,
> for example, by calling fork or pthread_create. One of the threads then calls the SPU_RUN ioctl on the run file,
> while the other runs in an event loop on the mailbox files and potentially other file descriptors.
One APU requires one CPU thread that "kicked" it, one CPU cannot have two or more APU contexts in execution. Unless
Sony has another CELL OS with different programming model for games(which I doubt) this one CPU thread per one APU
rule stays.
While I understand your great wisdom, we are not dealing with X86 or any other traditional architectures. Since CELL was
custom-designed to suit the twisted mind of its paying customer, Kutaragi Ken, you have to see it from Kutaragi Ken(an
analog electrical engineer with no formal training in Computer Science or Computer Engineering. This is why his machines
are so wacky)'s perspective. And his perspectives are clearly different from yours and mine.
> Now, I actually thought the Cell would be a major pain to program for,
You are still right on that one. Nothing's changed.
> there is nothing fundamentally wrong with having Linux threads that can freely switch back and forth between the
PPE and a SPE.
Except for the fact that you would need to prepare two binaries for each function you have written, which comsumes time,
money, and more importantly memory. If this function was 100% in C/C++, then it wouldn't be so hard, just not very fast.
But most vector-related functions are written in assembly, which means two sets of assembly are required for each
processor ISA.
> On x86, you use a magic "iret" instruction to turn the CPU into a vm86 core, and on Cell you'd use "SPE resource
> scheduler" to turn a native-mode process into a SPE process, so it would certainly look very different in the
> details (and you could run seven SPE's at a time), but from a high level standpoint both cases really just have a
> system call to go into a new mode.
While I understand what you are proposing, I have not read anything like that from any of CELL-related papers. Furthermore,
there is a serious problem with memory.
Recall that each APU has only 256 KB of memory, of which 128 KB is used for program and 64 KB for presently executing
contex, 64 KB for prior or next context being read from or writing into memory.
And you cannot really fit a lot of program code in the space of 128 KB, just a few selected most-used functions that are
ported to APU ISA so that the thread residing in the CPU process space can jump process and now reside in the APU process
space. 95% of the time the thread cannot jump from the CPU process space to the APU process space because there is no
equivalent function available in the APU program memory. When there is one, then bingo the thread are ready to jump,
as long as the target APU is not under utilization by some other process. How effective is that? I have no idea. But my
gutt tells me this won't work.
Having stated that, I would like to point you to this document.
http://www-128.ibm.com/developerworks/library/pa-cell/
This article is written by the IBM developer who implemted the APU driver as a virtual file system on Linux. He clarifies.
> Since every thread that executes the SPU_RUN ioctl blocks for the duration of the ioctl system call,
> it can not interact with any other system resources at the same time, including other SPU contexts or
> files belonging to the context it is executing in. A single process can work with multiple SPU contexts,
> but to run on more than one SPU at a given time, the process needs to contain at least one thread for each
> running SPU context.
>
> Likewise, if the program communicates with the SPU code using mailbox access, it needs to create a new thread,
> for example, by calling fork or pthread_create. One of the threads then calls the SPU_RUN ioctl on the run file,
> while the other runs in an event loop on the mailbox files and potentially other file descriptors.
One APU requires one CPU thread that "kicked" it, one CPU cannot have two or more APU contexts in execution. Unless
Sony has another CELL OS with different programming model for games(which I doubt) this one CPU thread per one APU
rule stays.
While I understand your great wisdom, we are not dealing with X86 or any other traditional architectures. Since CELL was
custom-designed to suit the twisted mind of its paying customer, Kutaragi Ken, you have to see it from Kutaragi Ken(an
analog electrical engineer with no formal training in Computer Science or Computer Engineering. This is why his machines
are so wacky)'s perspective. And his perspectives are clearly different from yours and mine.
> Now, I actually thought the Cell would be a major pain to program for,
You are still right on that one. Nothing's changed.
> there is nothing fundamentally wrong with having Linux threads that can freely switch back and forth between the
PPE and a SPE.
Except for the fact that you would need to prepare two binaries for each function you have written, which comsumes time,
money, and more importantly memory. If this function was 100% in C/C++, then it wouldn't be so hard, just not very fast.
But most vector-related functions are written in assembly, which means two sets of assembly are required for each
processor ISA.
> On x86, you use a magic "iret" instruction to turn the CPU into a vm86 core, and on Cell you'd use "SPE resource
> scheduler" to turn a native-mode process into a SPE process, so it would certainly look very different in the
> details (and you could run seven SPE's at a time), but from a high level standpoint both cases really just have a
> system call to go into a new mode.
While I understand what you are proposing, I have not read anything like that from any of CELL-related papers. Furthermore,
there is a serious problem with memory.
Recall that each APU has only 256 KB of memory, of which 128 KB is used for program and 64 KB for presently executing
contex, 64 KB for prior or next context being read from or writing into memory.
And you cannot really fit a lot of program code in the space of 128 KB, just a few selected most-used functions that are
ported to APU ISA so that the thread residing in the CPU process space can jump process and now reside in the APU process
space. 95% of the time the thread cannot jump from the CPU process space to the APU process space because there is no
equivalent function available in the APU program memory. When there is one, then bingo the thread are ready to jump,
as long as the target APU is not under utilization by some other process. How effective is that? I have no idea. But my
gutt tells me this won't work.
Topic | Posted By | Date |
---|---|---|
New CELL Article Online | David Kanter | 2005/08/02 11:32 AM |
New CELL Article Online | mas | 2005/08/02 12:46 PM |
New CELL Article Online | mas | 2005/08/02 12:53 PM |
New CELL Article Online | David Wang | 2005/08/02 01:46 PM |
New CELL Article Online | fastpathguru | 2005/08/02 04:05 PM |
New CELL Article Online | David Wang | 2005/08/02 06:27 PM |
New CELL Article Online | Panajev2001a | 2005/08/03 03:26 AM |
New CELL Article Online | David Wang | 2005/08/03 11:28 AM |
New CELL Article Online | Deadmeat | 2005/08/04 01:05 PM |
New CELL Article Online | David Wang | 2005/08/04 05:47 PM |
New CELL Article Online | Deadmeat | 2005/08/04 07:04 PM |
New CELL Article Online | john evans | 2005/08/04 08:30 PM |
New CELL Article Online | Deadmeat | 2005/08/05 12:10 PM |
New CELL Article Online | Linus Torvalds | 2005/08/05 06:21 PM |
New CELL Article Online | Deadmeat | 2005/08/05 07:33 PM |
New CELL Article Online | fastpathguru | 2005/08/05 10:36 PM |
New CELL Article Online | john evans | 2005/08/05 10:51 PM |
New CELL Article Online | Deadmeat | 2005/08/06 04:09 AM |
New CELL Article Online | fastpathguru | 2005/08/06 06:29 AM |
New CELL Article Online | Deadmeat | 2005/08/07 04:06 PM |
New CELL Article Online | David Wang | 2005/08/04 09:03 PM |
New CELL Article Online | Deadmeat | 2005/08/05 12:21 PM |
New CELL Article Online | David Wang | 2005/08/05 11:51 PM |
New CELL Article Online | David Wang | 2005/08/06 12:00 AM |
New CELL Article Online | Deadmeat | 2005/08/07 03:39 PM |
New CELL Article Online | David Wang | 2005/08/08 01:57 PM |
New CELL Article Online | Deadmeat | 2005/08/08 02:55 PM |
New CELL Article Online | David Wang | 2005/08/08 03:37 PM |
New CELL Article Online | Deadmeat | 2005/08/08 05:05 PM |
New CELL Article Online | David Wang | 2005/08/08 05:47 PM |
New CELL Article Online | Deadmeat | 2005/08/08 06:25 PM |
Implausible at best, irrational most likely... | David Kanter | 2005/08/08 06:51 PM |
Implausible at best, irrational most likely... | Deadmeat | 2005/08/09 10:26 AM |
New CELL Article Online | David Wang | 2005/08/08 07:46 PM |
New CELL Article Online | Deadmeat | 2005/08/09 10:36 AM |
New CELL Article Online | David Wang | 2005/08/09 11:12 AM |
New CELL Article Online | Deadmeat | 2005/08/09 01:26 PM |
New CELL Article Online | David Wang | 2005/08/09 02:36 PM |
New CELL Article Online | Aaron Spink | 2005/08/09 02:57 PM |
New CELL Article Online | David Wang | 2005/08/10 10:06 AM |
New CELL Article Online | Serge Monkewitz | 2005/08/09 01:18 PM |
New CELL Article Online | Deadmeat | 2005/08/09 01:30 PM |
New CELL Article Online | Vitaly Vidmirov | 2005/08/11 01:36 AM |
New CELL Article Online | Anonymous | 2005/08/03 04:11 PM |
New CELL Article Online | fastpathguru | 2005/08/03 05:19 PM |
New CELL Article Online | mas | 2005/08/03 07:59 PM |
New CELL Article Online | José Javier Zarate | 2005/08/04 05:20 AM |
New CELL Article Online | mas | 2005/08/04 05:27 AM |
New CELL Article Online | mas | 2005/08/05 06:50 AM |
New CELL Article Online | PiedPiper | 2005/08/02 09:02 PM |