home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / dsp / 1796 next >
Encoding:
Internet Message Format  |  1992-07-20  |  41.0 KB

  1. Path: sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!augean.eleceng.adelaide.edu.AU!gvokalek
  2. From: gvokalek@augean.eleceng.adelaide.edu.AU (George Vokalek)
  3. Newsgroups: comp.dsp
  4. Subject: Re: Looking for users of TI TMS320C40 DSP chip and/or 3L 'C' compiler
  5. Message-ID: <1992Jul21.064853.29476@augean.eleceng.adelaide.edu.AU>
  6. Date: 21 Jul 92 06:48:53 GMT
  7. References: <5362@mccuts.uts.mcc.ac.uk>
  8. Organization: Electrical & Electronic Eng., The University of Adelaide
  9. Lines: 853
  10.  
  11. It really pisses me off when I type in a reply to a post and the
  12. email bounces!  Therefore I will share my annoyance with the
  13. world by posting my reply:
  14.  
  15.    ----- Transcript of session follows -----
  16. While talking to nsfnet-relay.ac.uk:
  17. >>> DATA
  18. <<< 554 No date field given
  19. 554 ehgabp2@uts.mcc.ac.uk... Service unavailable
  20.  
  21. ------- Received message follows ----
  22.  
  23. Received: by augean (5.61+IDA+MU/4.8Z)
  24.     id AA29036; Tue, 21 Jul 1992 16:11:19 +0930
  25. Date: Tue, 21 Jul 1992 16:11:19 +0930
  26. From: gvokalek (George Vokalek)
  27. Message-Id: <9207210641.AA29036@augean.eleceng.adelaide.edu.au>
  28. To: ehgabp2@uts.mcc.ac.uk
  29. Subject: Re: Looking for users of TI TMS320C40 DSP chip and/or 3L 'C' compiler
  30. Newsgroups: comp.dsp
  31. References: <5362@mccuts.uts.mcc.ac.uk>
  32.  
  33. In comp.dsp you write:
  34.  
  35.  
  36. >We are looking for users of the Texas Instruments TMS320C40 DSP chip
  37. >and the 3L 'C' compiler, which produced object code suitable for this 
  38. >chip, hosted on a PC AT.
  39.  
  40. >Has anyone done any comparisons with the Inmos T800 using a 3L compiler?
  41.  
  42. While I cannot answer your question directly, I can say that the
  43. C40 should run rings around the T800, especially in floating point.
  44. The C40 is more comparable in performance to the mythical T9000.
  45.  
  46. Our transputer people have just opted for the Inmos C compiler rather
  47. than the 3L, since we do more embedded type work (rather than big
  48. hyper-parallel-type-work), and the 3L is 2-3 times the cost of the Inmos.
  49.  
  50. I have also avoided the 3L compiler for the C40 (we are waiting for
  51. our C40 hardware to arrive) for similar reasons.
  52.  
  53. I do have an electronic copy of a paper by 3L discussing its porting
  54. of the compiler to the C40.  That paper is appended at the end of this
  55. message.  (Thanks to S.J.Bradshaw at Traquair Inc. for providing it to me).
  56.  
  57. Regards,
  58.  
  59.  George.
  60.  
  61. ******************************************
  62.  
  63.  
  64. Porting the 3L Parallel C
  65. Environment to the
  66. Texas Instruments TMS320C40
  67.  
  68. Alan D. Culloch, Director
  69. 3L Ltd., Peel House, Ladywell, Livingston EH54 6AG, Scotland
  70.  
  71.  
  72. Abstract.
  73.  
  74. The TMS320C40 ('C40) is a transputer-like parallel processor from Texas
  75. Instruments.  It is an order of magnitude faster than the T800
  76. transputer.  Parallel C is a popular programming environment for the
  77. transputer.  The properties of both the 'C40 and Parallel C are
  78. described and the significant differences between the 'C40 and the
  79. transputer are pointed out.  The techniques used to overcome these
  80. obstacles to porting Parallel C are presented.  These include building a
  81. new real-time kernel and reusing existing software packages from
  82. industry and academia.  The suitability of the 'C40 for parallel
  83. applications is discussed.
  84.  
  85.  
  86.  
  87.  
  88. 1. The TMS320C40 Chip
  89.  
  90. The TMS320C40 ('C40) is the latest member of Texas Instruments' TMS320 family
  91. of Digital Signal Processing (DSP) chips.  It is the first processor
  92. from a major US semiconductor vendor to feature transputer-like built-in
  93. communications links for parallel processing.  In addition, it gives
  94. state-of-the-art single processor performance equalling or exceeding existing
  95. ``superchips'' such as the i860.  The device is fully described in [1].
  96.  
  97. The performance of the 'C40 is certainly impressive: 275 million
  98. operations per second and 50 MFLOPS.  Six 160Mbit/s communications links
  99. give each node in a network a total communications throughput of 120Mbyte/s.
  100.  
  101. The parallel processing features of the 'C40 were added in response to
  102. feedback from customers.  They indicated that large parallel DSP
  103. and real-time systems were already being built using the previous
  104. generation of standalone chips (the 'C30).  What was wanted was a way to
  105. simplify the design and implementation of such systems.  This was
  106. achieved by adding fast communications links to the processor.  These
  107. make it easy to construct large MIMD parallel systems with no external
  108. communications support logic.
  109.  
  110. 2. Availability
  111.  
  112. Sample 'C40 silicon has been available since this formal launch of the
  113. chip in June 1991.  Board-level hardware became available from European
  114. vendors such as Hema (Germany) and Hunt Engineering (UK) by the end of
  115. 1991.
  116.  
  117. We now look in turn at each of the features of the 'C40 design which are
  118. most significant for parallel systems development.
  119.  
  120. 3. Memory Architecture
  121.  
  122. 'C40 memory is always organised in 32-bit words.  Byte addressing is not
  123. supported.  I.e., the first word in memory is at address 0, the next
  124. word is address 1, and so on.  Integer, 32-bit floating point and
  125. character data items all occupy one word each (although it is possible
  126. to pack characters into integers "by hand" by shifting and masking.)  In
  127. C terms, the sizeof all atomic types is 1.
  128.  
  129. 3.0 Data Formats
  130.  
  131. Floating-point data are held in a proprietary 32-bit format. 
  132. Instructions are provided to convert to and from the IEEE standard
  133. 32-bit format.  Intermediate results can be held in the processor's
  134. internal registers in an extended-precision 40-bit format. 
  135.  
  136. 3.1 Memory Buses
  137.  
  138. The 'C40 has two external memory buses, called the local bus and the
  139. global bus.  The first 2Gword half of the 4Gword (16Gbyte) 32-bit
  140. address space accesses the local bus; the other half accesses the global
  141. bus.  Having two external memory interfaces provides greater total
  142. CPU/memory bandwidth and increases the available parallelism.
  143.  
  144. The first 3Mword of the local bus region is reserved for peripherals
  145. (including internal peripherals like the on-chip timers and DMA engines)
  146. and two blocks of internal RAM.  Depending on the setting of an external
  147. pin, the first 1Mword, from 0-1M, is mapped either to the local bus or
  148. an on-chip ROM containing built-in bootstrap code.
  149.  
  150. 3.2 Internal RAM
  151.  
  152. The 'C40 has two blocks of on-chip RAM.  Each block is 1Kword (4Kbytes)
  153. long.  The on-chip RAM can be used for code or data: it appears at the
  154. end of the 3Mword of reserved space below the local bus region, and is
  155. contiguous with the start of local bus memory.
  156.  
  157. 3.3 Parallel Memory Access
  158.  
  159. Each different block of memory (internal ROM and RAM blocks 0 and 1,
  160. the external memory buses) can support two concurrent accesses, allowing
  161. a considerable amount of micro-parallelism in the execution of
  162. sequential code.  For example: the CPU can access two data values in one
  163. RAM block and perform an external program fetch in parallel with one of
  164. the DMA engines loading another RAM block, all within a single cycle.
  165.  
  166. 3.4 Cache Memory
  167.  
  168. To minimise fetching of program code from relatively slow external memory the
  169. 'C40 contains 512 bytes of on-chip cache for instructions.  This is in
  170. addition to, and operates independently of, the two blocks of
  171. general-purpose on-chip RAM.
  172.  
  173. 4. CPU Architecture
  174.  
  175. 4.1 Register File
  176.  
  177. The CPU has 32 registers.  Twelve of these are general-purpose registers
  178. which can hold either word data or floating-point data in the
  179. processor's extended-precision format (40 bits wide.)  Another eight
  180. general registers can hold word data only.  The remaining registers have
  181. dedicated uses, as stack pointers, index registers, loop counters and so
  182. on.
  183.  
  184. 4.2 Instruction Set and Pipelining
  185.  
  186. 'C40 instructions have a three-address format specifying two source
  187. operands and a destination location.  Various operand addressing modes
  188. are provided (register, immediate, direct, indirect.)
  189. However, addressing is not completely general: instructions generally
  190. restrict the allowed addressing modes for their operands and results in
  191. various ways, for example, by requiring that the result of an operation
  192. be stored into one of the twelve extended-precision registers.
  193.  
  194. All the usual operations on arithmetic and floating-point data are provided.
  195. One interesting group of instructions provides for loop control without
  196. the overhead of embedding compare and branch instructions in the
  197. instruction stream being executed.  The processor contains some
  198. special-purpose registers for loop counting and holding pointers to the
  199. start and end of a block of code to be executed repeatedly.  In its
  200. special "repeat mode" the processor implicitly moves the PC back to the start of
  201. the loop when it steps over the last instruction of the loop block. 
  202. Inner loops can therefore dispense with the overhead of counting,
  203. comparing and branching at the macroinstruction level.
  204.  
  205. As is now the norm for RISC designs, delayed branches allow overlapping
  206. of useful instructions with the fetching of oout-of-sequence
  207. instructions.  The 'C40 in fact goes a lot further down this path to
  208. increased performance, by the provision of quite a large number of
  209. "parallel" instructions.  These allow particular pairs of operations
  210. to be overlapped in a single instruction cycle, for example
  211. multiplication of two floating-point values can be performed in parallel
  212. with storing another floating-point value in memory.  The source and
  213. destination locations for both instructions must be encoded into a
  214. single instruction word, and are therefore more restricted in the
  215. addressing modes allowed than other types of instruction.
  216.  
  217. 5. Inter-Processor Communication
  218.  
  219. 5.1 Communications Ports
  220.  
  221. The 'C40 has six built-in communications ports.  Each can handle
  222. bi-directional communication at 20Mbyte/s, giving a total maximum
  223. throughput of 120MByte/s.  Ports are connected to each other by a
  224. 12-wire parallel interface (8 data bits plus 4 control lines.)
  225.  
  226. Although the links are bi-directional, they are not full duplex.  Data
  227. may only flow across the link in one direction at a time.  However,
  228. "turnaround" of the direction of the traffic is automatic when the link
  229. is accessed.  Ownership of the link is managed by a hardware
  230. token-passing scheme which uses some of the four control lines.
  231.  
  232. On reset, three of the links go into output mode; the other three are
  233. forced to input mode.  A board designer must ensure that in the reset
  234. state outputs are connected only to inputs, and vice versa.  Failure to
  235. do so can destroy the processor.  Thankfully this problem is not visible
  236. to software.
  237.  
  238. 'C40 links are buffered.  Both the input and the output side of each link
  239. have an 8-word hardware FIFO queue attached.  Therefore there is
  240. effectively 16 words of buffering on a full communication.  Writing to a
  241. full FIFO, or reading from an empty one, blocks the CPU until the
  242. condition is cleared.
  243.  
  244. Reading and writing the links is straightforward.  The communication
  245. ports appear as mapped devices in the 'C40 address space.  Sending a
  246. word over an output link is simply a matter of writing a word to the
  247. address of the mapped device.
  248.  
  249. 5.1 The DMA Coprocessor
  250.  
  251. The 'C40 provides an on-chip DMA engine to relieve the CPU of the
  252. need to intervene in inter-processor data transfer.  The DMA engine
  253. has its own separate internal buses connecting it to memory and the
  254. communications ports.  It can therefore transfer data without
  255. interfering with the operation of the CPU.
  256.  
  257. The DMA engine is itself a quite sophisticated programmable device.
  258. It is driven by control blocks in memory which can be linked together to
  259. form DMA "programs".  Each block specifies the source, destination and
  260. size of an individual transfer.  Indexing allows non-contiguous data to
  261. be transferred (e.g., every 10th word from an array.)  Bit-reversed
  262. addressing is provided for FFT applications.
  263.  
  264. The basic operation of the DMA engine is fully general: it can move
  265. words from any part of memory to any other.  After each word is
  266. transferred, the next is addressed by adding an index value from the DMA
  267. control block to the previous address.  This, combined with the fact
  268. that the communications ports are mapped as memory locations, allows the
  269. DMA engine to transfer a block of words to or from a fixed location (such as a
  270. communications port) by specifying a zero "index" value.  A further
  271. benefit of this approach is that data can be routed directly through a 'C40 by
  272. the DMA engine from one communication port to another, without any CPU
  273. intervention at all.
  274.  
  275. 5.2 Timers
  276.  
  277. The 'C40 has two on-chip timer/event counter units which can be used to
  278. generate interrupts and support timeouts on link communications.
  279.  
  280.  
  281. 6. 3L Parallel C
  282.  
  283. Parallel C was originally developed by 3L for the transputer.  To allow
  284. porting of applications, a 'C40 implementation of Parallel C would have
  285. to support the same user interface as the transputer implementation. 
  286.  
  287. The main functions provided by the transputer version of Parallel C
  288. which would have to be reproduced in a 'C40 port are outlined here. 
  289. Parallel C is more fully described in [2] and [3].
  290.  
  291. In addition to a conventional C compiler, linker and run-time
  292. library for the target processor, Parallel C provides the following.
  293.  
  294. 6.1 Extended Run-Time Library
  295.  
  296. The C run-time library is extended with data types representing
  297. transputer channels and with functions to: create new threads of
  298. execution (processes); pass messages between tasks in a synchronised
  299. CSP-style fashion, with optional timeout handling; wait/signal on
  300. semaphores; and perform a CSP-style "alternative wait" operation.  This
  301. last blocks the calling task until one of a number of input channels
  302. becomes ready to communicate. 
  303.  
  304. In the transputer implementation the message-passing functions can be
  305. implemented by in-line code accessing built-in hardware facilities.
  306.  
  307. 6.2 Configurer
  308.  
  309. In Parallel C, complete systems are built by composing independent
  310. software tasks.  Each main task which is to execute in parallel is an
  311. independently compiled and linked C program.  The tool which binds these
  312. linked task images together with various bits of bootstrap and loader
  313. software to produce a bootable multi-tasking application image file is
  314. called the configurer.  It is driven by a user-written text file which
  315. describes the required hardware configuration, specifies the files
  316. containing the software tasks, and indicates which tasks are to be
  317. placed onto which processors.
  318.  
  319. Replicated tasks placed on many different processors are held once in
  320. the application image file and copied from processor to processor
  321. dynamically at load time.
  322.  
  323. 6.3 Flood Configurer
  324.  
  325. This variant configurer takes two special kinds of task, the master and
  326. worker tasks of a processor farm application, and combines them with
  327. standard bootstrap, loader and message-routing software to make a
  328. bootable application image which, when loaded, spreads out and "floods"
  329. every accessible processor in the network with a copy of the same worker
  330. task.  Work packets are distributed from the master to the workers and
  331. result packets are carried back through the network by the routing
  332. software.  Packet broadcasts from the master to all workers are
  333. supported for initial setup of data to be worked on in parallel.
  334.  
  335.  
  336. 7. Rationale for Porting Parallel C
  337.  
  338. >From the description of the 'C40 processor architecture given previously
  339. it should be clear that it fits the original sense of the term
  340. "transputer", in that it is a programmable device with its own integral
  341. memory and inter-processor communications links.  It is therefore
  342. sensible to consider porting parallel software between these platforms.
  343.  
  344. The interesting differences between Inmos' and Texas Instruments'
  345. implementations of this concept are dealt with in a later section.  Here,
  346. we just note that the similarities are sufficient to make it appear
  347. useful and sensible to make existing transputer software available on this
  348. new platform, and that this includes development systems such as
  349. Parallel C.
  350.  
  351. This would be so even if it were not the case that the 'C40 is an order
  352. of magniture faster than the currently-available T800 transputers, in
  353. both raw processing speed and in communications bandwidth.  However,
  354. because there is such a large performance benefit, we expect the take-up
  355. of this new technology by current transputer users to be quicker than
  356. it would otherwise be.
  357.  
  358. The other main reason for undertaking a port was the popularity of Texas
  359. Instruments' previous 'C30 product in DSP work.  The familiarity of DSP
  360. engineers with this product family should lead to fast take-up of the
  361. parallel processing 'C40 and a consequent need for parallel systems
  362. development software such as Parallel C.
  363.  
  364.  
  365. 8. Technical Issues Involved in a Port
  366.  
  367. The main technical issues of interest in the porting process are to do with the
  368. architectural differences between the transputer and the 'C40.
  369.  
  370. 8.1 Communications Links
  371.  
  372. Transputer links differ from 'C40 ones in both the hardware and its
  373. appearance to the software.  The 12-wire links of the 'C40 give greater
  374. speed (20Mbyte/s vs. 20Mbit/s) but require more pins and board space.
  375.  
  376. These links appear as memory locations to be read or written a word at a
  377. time under program control (or under control of the DMA coprocessor.) 
  378. There are six of them rather than four, so a wider range of fixed link
  379. topologies can be built directly, including 3D grids and larger
  380. hypercubes.
  381.  
  382. More importantly, the fact that the 'C40 links are hardware buffered
  383. means that they cannot be used directly to emulate transputer-style
  384. unbuffered, synchronised message passing.  Consider a short message of
  385. two words sent from processor A to processor B.  If the receiving
  386. process on B is not ready to receive the message, then in the transputer
  387. case the sending process will be blocked until the receiver becomes
  388. ready.  If 'C40 links are used "raw", then either the message will be
  389. sent and A will proceed asynchronously, or the FIFOs will be full up,
  390. and the whole of processor A (not just the sending process) will be
  391. blocked.
  392.  
  393. This problem implies that a 'C40 implementation of Parallel C
  394. will require some low-level software to control the hardware links.  All
  395. transputer-style synchronised message traffic on a link must be under the
  396. control of this software.  Note that some or all links may be used "raw"
  397. to avoid the software overhead involved here, but that communications
  398. over those links would not have transputer-like synchronisation
  399. properties and would have to be carefully managed under user control.
  400.  
  401. Ensuring synchronisation of sender and receiver requires the link
  402. control software at both ends of a communication path to exchange
  403. acknowledgements of receipt using some protocol over and above the user
  404. data being transmitted.  The question of what protocol is used is
  405. addressed later.
  406.  
  407. Although 'C40 links are hardware FIFO-buffered, when a buffer fills
  408. up, the whole processor (not just the sending or receiving process) is
  409. blocked.  User code must either poll "ready" flags to avoid the
  410. situation, or make use of interrupt signals which indicate when the
  411. buffers become ready.  These interrupts can be used in combination with
  412. the DMA engine.  To avoid one thread blocking the whole processor, the
  413. handling of the links and these interrupts must be centralised in
  414. the low-level support software.
  415.  
  416. Software is also required to handle the discrepancy between
  417. the number of possible concurrently active communications on the links
  418. (12, one in each direction on six links) and the six available DMA
  419. channels.  This requires dynamic software management of free DMA
  420. channels.
  421.  
  422. 8.2 Processes
  423.  
  424. Unlike the transputer, the 'C40 has no built-in firmware to manage
  425. process creation, timeslicing or message synchronisation: these
  426. functions must be performed by software: another job for the low-level
  427. software.
  428.  
  429. Note that the large number of CPU registers in the 'C40 put a premium on the
  430. run-time efficiecy of such a software context-switching mechanism.
  431.  
  432. There is some built-in software on the 'C40 held in ROM: this is a
  433. bootstrap program which allows networks of 'C40s to be booted from their
  434. links.
  435.  
  436. 8.3 CPU Architecture
  437.  
  438. A number of software changes are obviously implied by the differences in
  439. internal architecture between the two processors.
  440.  
  441. The register vs. stack-based assembly programming model, the very
  442. different instruction set, the non-IEEE floating-point format, and the
  443. lack of byte addressibility obviously all conspire to require a
  444. completely different compiler.
  445.  
  446.  
  447. 9. Overcoming the Differences
  448.  
  449. In deciding how to go about the port and overcome the technical
  450. difficulties mentioned above, two goals were paramount:
  451.  
  452. 1. A robust product was required.
  453. 2. It should be implemented as quickly as possible.
  454. 3. As far as possible the resulting product should retain the
  455.    application programmer interface of the transputer version.
  456.  
  457. This had two main implications for our design:
  458.  
  459. 1. Reuse as much existing, tested software as possible.
  460. 2. A number of transputer features would need to be emulated in software.
  461.  
  462. In the rest of this section, we look at the different software
  463. components of Parallel C, and how they have changed from the transputer
  464. version of the software.
  465.  
  466.  
  467. 9.1 The Compiler and Linker
  468.  
  469. Two options were considered for the compiler: first, use TI's own;
  470. second, re-jig the existing 3L transputer C compiler by replacing its
  471. machine-dependent code generator module with a 'C40 version.
  472.  
  473. This was a relatively easy choice given the previously stated goals. 
  474. Even although the code generator in the existing compiler is quite well
  475. separated from the rest of the program, using the intermediate-code
  476. technology described in [4], and the team had considerable experience
  477. with such work, it is still quite large (15-20K source lines.) Writing a
  478. new code generator would consume a disproportionate fraction of the
  479. resources available to the project.  Since TI's compiler was already in
  480. an advanced state of development at the beginning of the project, and
  481. was an evolution from the existing code-compatible 'C30 compiler, we
  482. decided to use it as the basis of Parallel C.  This met our goal of
  483. minimising development time, and by gaining access to well-tried code
  484. should prove to be robust as well.
  485.  
  486. Subsidiary benefits of this route which also weighed in the decision
  487. were the resulting automatic compatibility with TI's assemblers,
  488. libraries, and any third-party libraries written for that compiler.
  489.  
  490. 9.2 The C Run-Time Library and Host Server
  491.  
  492. Because it was originally designed with standalone DSP applications in
  493. mind rather than more general parallel processing work, TI's C compiler is a
  494. "freestanding" implementation, in the sense of the ANSI standard.  I.e.,
  495. its library does not provide standard I/O and other similar high-level
  496. services.  3L has therefore had to port those parts of its existing C
  497. run-time library to the 'C40, in order to provide the full run-time
  498. environment familiar to users of Parallel C.
  499.  
  500. As on the transputer, the standard I/O services in the run-time library are
  501. provided by means of remote procedure calls from library code on the root
  502. node of the 'C40 network across a link to a host computer.  The protocol
  503. used for communication with the host is a variant of the existing
  504. afserver protocol, again more for speed of implementation of both library
  505. and host server than for elegance (the protocol has a number of
  506. well-known drawbacks.)
  507.  
  508. In addition to providing a full sequential C run-time library, functions
  509. also had to be added to support Parallel C's specialised thread
  510. creation, message passing, sempahore, and timer calls.  On the 'C40 most
  511. of these operations are implemented by extracodes which trap to the
  512. software kernel described in the next section, rather than being
  513. performed in-line as on the transputer.
  514.  
  515. 9.3 The Kernel
  516.  
  517. As described previously, the lack of built-in support on the 'C40 for
  518. processes and timeslicing, the partially asynchronous nature of its
  519. links requiring extra protocol to ensure synchronisation, and the
  520. dynamic management of DMA channels, all require the presence of a small
  521. software kernel on every 'C40 network node running Parallel C.  This is
  522. the main difference from the transputer implementation, which relies
  523. entirely on the processor's firmware kernel, except for network loading
  524. software and the packet routers in a flood-configured application. 
  525.  
  526. Implementing a kernel to manage prioritised process queues, device
  527. interrupts and timers is classic computer science textbook material, but
  528. there are a number of complicating factors.  The first is the necessity
  529. to minimise the software overhead involved in context switching between
  530. processes.  Second, memory management must be able to cope with
  531. essentially any number of threads being created at run time by the
  532. client tasks. 
  533.  
  534. Given that the kernel was to be written from scratch, the choice of
  535. coding language was open.  In the end, both because of the requirement
  536. to minimise context switch times and because a lot of the code in the
  537. kernel was in any case to do with intimate manipulation of the internal
  538. state of the processor, assembly language was chosen.
  539.  
  540. The kernel provides services to client user tasks at the the level of "send this
  541. message to that port", "wait for timer", "create new process".
  542.  
  543. Note that the message operations provided by the kernel are close to the
  544. hardware.  It is responsible for allocating and setting up DMA
  545. channels, initiating transfers, and notifying clients of completion.  It
  546. keeps track of all device interrupts.
  547.  
  548. However, in our design the kernel in the end was not made responsible
  549. for message synchronisation.  This job is done instead by a higher-level
  550. software package; this software is described in the next section, along
  551. with our reasons for separating it from the kernel proper. 
  552.  
  553. 9.4 Message Synchronisation: VCR and UPR
  554.  
  555. For some time before the idea of a port of Parallel C to the 'C40 had
  556. appeared, we had been surveying various of the general-purpose message
  557. routing packages which had become available for the transputer, partly
  558. as a result of 3L's involvement in the SERC/DTI Transputer Initiative's
  559. working groups on parallel systems standardisation.
  560.  
  561. The packages under review included commercial products such as Express
  562. (Parasoft) and FNODE (Sang), academic work like TINY (Edinburgh
  563. University) and VCR/UPR (Southampton University), and numerous bits of
  564. ad-hoc software written by individual users of Parallel C.  In-house
  565. ideas were also being explored. 
  566.  
  567. By the time design of the 'C40 port was under way, VCR/UPR [5],
  568. developed at Southampton University under the auspices of the European
  569. Community's PUMA research programme, had become our "favourite" package,
  570. and detailed in-house evaluation of it was proceeding. 
  571.  
  572. When the question of how we should handle sender/receiver
  573. synchronisation and support for transputer-style ALTs over the basically
  574. asynchronous 'C40 link hardware arose, a ready-made solution was
  575. therefore at hand.  VCR (Virtual Channel Router) provides exactly the
  576. facilities we required (synchronised message send and receive, and ALT
  577. with transputer semantics too) and is layered on top of UPR (Universal
  578. Packet Router), a low-level packet switcher which makes no assumption
  579. that the hardware link layer it runs on has transputer semantics.
  580.  
  581. In the light of our aim of combining speedy development with a robust
  582. end product, the course was clear: we should incorporate VCR/UPR into
  583. Parallel C for the 'C40 as the "link-control software" discussed
  584. previously.  The job of writing a non-deadlocking link protocol handler
  585. would be simplified to adapting VCR/UPR to our software environment. 
  586.  
  587. Using VCR/UPR (written in C) had the additional advantage of simplifying
  588. the job of our (assembler) kernel, making it easier to construct and
  589. more robust.  All the kernel had to do now was provide simplified system
  590. services which could be called from UPR to access the raw link hardware. 
  591.  
  592. Relatively few modifications have had to be made to VCR/UPR itself to adapt the
  593. package to the 3L software environment.  The primary ones have been to
  594. provide emulations of the transputer process-control libraries used by
  595. the original code, and to allow for the possibility that some of the
  596. available links on a node might be dedicated by the configurer to "raw"
  597. (non-virtual) traffic, not under the control of VCR/UPR.
  598.  
  599. VCR/UPR is tightly coded and adds minimal overhead to message transit
  600. times.  Nevertheless, easy direct access to the underlying hardware
  601. without unnecessary overhead has always been a strength of Parallel C. 
  602. A function library providing access to "raw" (unsynchronised,
  603. non-virtual) 'C40 links is therefore to be provided.  This will be of
  604. particular benefit to pipelined DSP applications, allowing peak link
  605. performance to be reached in critical inner loops.  The user retains
  606. control of the tradeoff between the convenience, well-understood
  607. semantics and compatibility of synchronised transputer-style
  608. communication, and the additional performance which going down to the
  609. native hardware mechanisms can bring.
  610.  
  611. Since at present Parallel C only supports nearest-neighbour
  612. communications, those parts of VCR/UPR which handle message routing
  613. between nodes which are not direct neighbours have been eliminated from
  614. the 'C40 version.  This simplified the porting process and also
  615. minimised the amount of code present on each node.  However, it should
  616. be clear that adoption of the VCR/UPR framework provides considerable
  617. scope for future enhancement of Parallel C in this area of general
  618. message routing, both on the 'C40 and the transputer. 
  619.  
  620. 9.5 The Configurers
  621.  
  622. Three main issues arose with the configurers.
  623.  
  624. The first concerned the machine on which the configurer should run.  The
  625. transputer implementations run on a transputer board, using a host file
  626. server for I/O just like normal user programs.  However, the compiler
  627. and linker from TI run as 80x86 programs under DOS, not as 'C40 code
  628. communicating with a file server.
  629.  
  630. Both approaches have their own advantages and disadvantages: the
  631. server-based approach makes porting to different hosts easy; running
  632. directly on the host can sometimes be faster because file I/O does not
  633. have to be performed remotely.  What was certain however, was that a
  634. mixture would only have the worst of both worlds.  Since the TI compiler
  635. and linker were not server-based, the choice was made for us: we would
  636. port the configurers from the transputer to the 80x86. 
  637.  
  638. In fact, even although the C code had originally been written for a
  639. 32-bit machine with a flat address space (the transputer), it proved to
  640. be sufficiently well structured that a 16-bit version for the 286/386
  641. was produced quite swiftly.
  642.  
  643. The second configurer issue arose from the nature of UPR, and the
  644. environment its original designers had assumed.  UPR is driven by
  645. externally-generated routing tables.  In the Southampton implementation,
  646. these tables were calculated "once and for all" for each hardware
  647. topology of interest.  However, because in the 3L implementation the
  648. user's configuration file could specify for performance reasons that
  649. particular hardware links should be dedicated to "raw", non-virtual
  650. traffic, and these links would consequently be unavailable for use by
  651. UPR in routing messages, the routing tables could not be set up before
  652. configuration time.
  653.  
  654. Evidently, UPR routing table generation would have to be deferred until
  655. configuration time.  Not only did this require splicing code from the
  656. table-generation programs into the heart of the configurer, it also
  657. raised the issue of the speed and memory requirements of the routing
  658. table generation algorithms.  In the event, some judicious tuning
  659. sufficed to make routing table generation during configuration feasible.
  660.  
  661. The third main issue requiring modifications to be made to the
  662. configurer concerned the differences between handling the .B4-format
  663. task image files generated by the 3L transputer linker and the
  664. COFF-format images produced by the TI linker.  .B4 files are
  665. position-independent, so the transputer configurer has little work to do
  666. in arranging for arbitrary groups of tasks to be loaded onto a single
  667. node.  COFF objects are position-dependent, but contain the relocation
  668. information required to reposition them.  The required on-the-fly
  669. relocation of COFF task images had to be incorporated into the 'C40
  670. configurers.
  671.  
  672. 9.6 The Host Interface
  673.  
  674. Parallel C applications for the 'C40 expect disk I/O and similar services to
  675. be provided by a server program running on a host computer.  The
  676. Parallel C run-time library communicates with the server by some message
  677. protocol over one of the links of the "root" processor in the network.
  678.  
  679. In the transputer world, in spite of the diversity of available host
  680. hardware, from PCs and Amigas to VAXen and IBM 3090 mainframes, from the
  681. point of view of the transputer end of these host communications the
  682. physical interface was always the same, no matter what host hardware was
  683. in use: the root transputer would simply send and receive server
  684. protocol messages over the link from which it had itself been
  685. bootstrapped.  This meant that the same transputer code would work with
  686. any host system supporting the server protocol.  A superfluity of rather
  687. ill-thought-out, ad-hoc server protocols confused the picture, but that
  688. is a separate issue.
  689.  
  690. Even the host of the party had a fairly easy time, especially if it was
  691. running on an IBM-compatible PC, since the early availability and wide
  692. take-up of Inmos' original B004 development system had led to that
  693. board's ISA-bus hardware interface design becoming a de facto standard
  694. for other PC board vendors.  This led to the happy situation where it
  695. was possible to take PC-oriented transputer software and run it "out of
  696. the box" on boards from a wide variety of different manufacturers.  The
  697. B004 design's limited host I/O bandwidth of the order of 100KB/s eventually
  698. proved overly restrictive, leading to a proliferation of incompatible
  699. "go-faster" interfaces.  Nevertheless, the basic B004 interface was
  700. usually retained as a lowest common denominator for software
  701. portability.  The later B008 interface also achieved wide currency due
  702. to Inmos' decision to be a major player in the market for board-level
  703. transputer systems.
  704.  
  705. The evolution of 'C40 board interfaces already looks set to proceed in a
  706. different direction, largely because no "definitive" hardware design has
  707. become available early enough to set a trend.  TI has successfully
  708. sponsored the "TIM-40" standard [6] for plug-in 'C40 "daughterboard" modules
  709. corresponding in scope to Inmos' TRAM standard, but this clearly could
  710. not set a standard host/motherboard interface for the wide variety of
  711. host buses which must be supported.  In practice all kinds of
  712. host interfaces to TIM-40 motherboards are appearing, ranging from
  713. bit-serial JTAG booting through message communication over one (or two)
  714. of the links on the root 'C40, right up to shared dual-ported
  715. RAM bypassing the links completely.  A number of non-TIM standard boards
  716. are also becoming available.
  717.  
  718. 3L's obvious goal was to support all these diverse interfaces while
  719. minimising the software effort involved.  The software effort is not
  720. confined to the server and so could not easily be left to OEMs and
  721. third-party resellers to handle.  Clearly, the root 'C40 must "know" how
  722. to communicate with the host: should messages be sent over a link (which
  723. one), or written into a shared memory buffer (where, and in what
  724. format)?
  725.  
  726. This knowledge could either be "built-in" to a multitude of variant
  727. hardware-specific versions of 'C40 Parallel C, or we could take a leaf
  728. out of the PC software industry's book (where diversity of graphics
  729. "standards" presents a similar problem) and use hardware-specific software
  730. drivers for different boards.  These drivers can in principle be
  731. created independently of 3L by hardware manufacturers, and would allow
  732. Parallel C to offer timely support for new hardware developments. 
  733.  
  734. A software driver approach has in fact been adopted: all communication
  735. from the root to the host is controlled by the driver, which acts as a
  736. plug-in extension to the kernel.  Note that for users to be able to run
  737. their Parallel C programs "out of the box" on different hardware, a
  738. particular driver cannot be bound into the application image file. 
  739. Instead, the required driver is loaded at run time from the
  740. host-dependent server into the root 'C40, along with the kernel and user
  741. code.
  742.  
  743. 10. Meeting the Management Challenge
  744.  
  745. Having seen the technical problems which had to be addressed in porting
  746. Parallel C to the 'C40, we shall round off this paper by looking briefly
  747. at how the software engineering management problem of sucessfully tackling a
  748. project of this scope with limited resources and a fixed deadline was
  749. addressed.
  750.  
  751. The human resources available consisted of up to four full-time
  752. developers plus two test/QA staff over a planned project timescale of
  753. six months from the start of active work to shipment of initial
  754. software.  The deadline had been self-imposed by the company's decision
  755. to announce publicly from the time the port was agreed with Texas
  756. Instruments in August 1991 that the product was going to be launched
  757. with due fanfare at CeBIT in March 1992 (part of the Hannover Fair.)
  758.  
  759. In fact this deadline, by giving everyone involved in the project a
  760. "red line" to work towards proved to be a blessing, concentrating minds
  761. and effort.
  762.  
  763. Although very little contingency "slack" was available in the plan, an
  764. early start on those parts of the project which were independent of the
  765. hardware, notably porting of the configurers from the transputer to the
  766. 80x86 and learning about the internals of VCR/UPR, allowed us to absorb
  767. what turned out to be a considerable slippage in the planned
  768. availability of the board-level hardware.  Making as much use as
  769. possible of the instruction-level 'C40 simulators which were available
  770. from TI also helped.
  771.  
  772. With limited forces, the disposition of the troops becomes of paramount
  773. importance.  Early agreement on the main goals of the project was the
  774. greatest help in clear decision-making and efficient execution: the
  775. product was to be robust from day one; it was to be ready by March 1992. 
  776. These goals and limited resources meant putting into practice the
  777. prevailing gospel of software reuse.  We could simply not afford the
  778. reinvention of any wheels, large or small.
  779.  
  780. This constraint led directly to the decisions to incorporate TI's
  781. existing compiler and linker into the package, and to adopt a proven
  782. message passing mechanism (VCR/UPR) developed in academia against the
  783. strong and understandable temptation to "roll our own".  Both of these
  784. decisions gave considerable extra "leverage" to the work of our
  785. team by basing our work on the efforts of large groups elsewhere who had
  786. already devoted many man-years of effort to these topics.
  787.  
  788. 3L is particularly proud to have been involved in the commercialisation
  789. of some of the products of EC-sponsored academic research (the VCR/UPR
  790. package developed as part of the PUMA programme of resarch into parallel
  791. architectures.)  A rare feat for a small UK company!
  792.  
  793. 11. Remaining Problems
  794.  
  795. Most Parallel C code for the transputer which does not 
  796. perform unneccessary low-level manipulation of the hardware (fiddling
  797. with process queues or writing directly to hard link channel addresses)
  798. can run happily on the 'C40.
  799.  
  800. The main stumbling blocks are inherent in the 'C40 architecture: some
  801. programs will be unable to cope with an environment where bytes are
  802. word-sized, and where floating point double precision is no wider than
  803. single precision.  Most applications in the DSP and real-time embedded
  804. system area targeted by Texas Instruments for the 'C40 should not find
  805. this too much of a problem.
  806.  
  807. 12. Conclusion
  808.  
  809. The 'C40 is well-suited to running DSP, real-time and desktop
  810. supercomputer applications written in 3L Parallel C an order of
  811. magnitude faster than the previous transputer implementation, although
  812. some applications which require intensive character manipulation or
  813. double-precision floating point may be unsiuted to the 'C40
  814. architecture.
  815.  
  816. Programs written for the 'C40 in Parallel C retain the advantages of
  817. clarity and reliability which Parallel C inherits from its
  818. CSP/transputer roots.  Users who have invested in learning
  819. occam/CSP-style techniques of parallel programming can immediately apply
  820. their experience to this new generation of hardware.  In addition, users
  821. of previous generations of TI DSPs gain access to this powerful body of
  822. technique for reliable parallel systems development which is of proven
  823. utility. 
  824.  
  825. In undertaking this porting exercise, a real commitment to software
  826. reuse has helped us to meet our demanding timescale.
  827.  
  828. The demonstration of 3L's commitment to migration of Parallel C and its
  829. popular Application Program Interface to new state-of-the-art parallel
  830. processors also frees users from undue dependence on a single source for
  831. parallel hardware, which is bound to have a positive effect on the
  832. availability of parallel applications software.
  833.  
  834.  
  835. References
  836.  
  837. [1] TMS320C4x User's Guide.  Texas Instruments.  2564090-9721 revision A.
  838.     May 1991.
  839.  
  840. [2] A.D. Culloch, Parallel Programming Toolkit for 3L-C, Fortran and
  841.     Pascal.  In: Jon Kerridge (Ed.), Proceedings of the 8th Technical
  842.     Meeting of the Occam User Group.  March 1988.
  843.  
  844. [3] Parallel C User Guide.  3L Ltd., 1991.
  845.  
  846. [4] P.S. Robertson, Intermediate Codes for Optimising Compilers.  Ph.D.
  847.     Thesis.  Edinburgh University, 1979.
  848.  
  849. [5] M. Debbage, M.B. Hill and D.A. Nicole.  Virtual Channel Router
  850.     version 2.0 user guide.  Technical Report, University of
  851.     Southampton, June 1991.    
  852.  
  853. [6] "TIM-40" TMS320C4x Module Specification.  Draft 0.105, January 1992.
  854.     Texas Instruments, Manton Lane, Bedford MK41 7PA, England.
  855.  
  856.  
  857. - --
  858. George Vokalek,                                Dept. of Mechanical Engineering,
  859.                                            University of Adelaide, GPO BOX 498, 
  860. gvokalek@augean.eleceng.ua.oz.au                 Adelaide 5001, South Australia
  861.                                          Phone 61-8-228-4704, Fax 61-8-224-0464
  862.  
  863. ------- Received message ends    ----
  864.