Day1-15_Hands-on_DMA_SPU-to-SPU

Day1-15_Hands-on_DMA_SPU-to-SPU - IBM Systems & Technology...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Cell Programming Workshop 3/2/2008 © 2007 IBM Corporation 1 Hands-on – SPU to SPU DMA Transfer Cell Programming Workshop Cell Ecosystem Solutions Enablement
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 2 Class Objectives ! Objective: Learn how to do basic DMA transfers ! ‘Hello World’ already uses DMA to send data to an SPU ! We will modify ‘Hello world’ example to: Send data from an SPU back to the PPU Send data between SPUs /opt/cell_class/Hands-on-30/spu-spu/libspe2
Background image of page 2
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 3 ‘Hello World’ Review ! PPU creates NUM_THREADS threads ! Each pthread starts a copy of the SPU program ! SPU program does a DMA transfer to receive a string ! SPU program prints the string and exits . . . /* Here is the actual DMA call */ /* the first parameter is the address in local store to place the data */ /* the second parameter holds the main memory address */ /* the third parameter holds the number of bytes to DMA */ /* the fourth parameter identifies a "tag" to associate with this DMA */ /* (this should be a number between 0 and 31, inclusive) */ /* the last two parameters are only useful if you've implemented your */ /* own cache replacement management policy. Otherwise set them to 0. */ mfc_get(parameter_area, argp.ull, 128, 31, 0, 0); /* Now, we set the "tag bit" into the correct channel on the hardware */ /* this is always 1 left-shifted by the tag specified with the DMA */ /* for whose completion you wish to wait. */ mfc_write_tag_mask(1<<31); /* Wait for the data array DMA to complete. */ mfc_read_tag_status_all(); printf("SPE: Data received is: %s", parameter_area ); . . .
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 4 Next Step: Data Transfer back to PPU ! DMA Puts look exactly like DMA Gets . . . mfc_get(parameter_area, argp.ull, 128, 31, 0, 0); /* Now, we set the "tag bit" into the correct channel on the hardware */ /* this is always 1 left-shifted by the tag specified with the DMA */ /* for whose completion you wish to wait. */ mfc_write_tag_mask(1<<31); /* Wait for the data array DMA to complete. */ mfc_read_tag_status_all(); printf("SPE: Data received is: %s", parameter_area ); sprintf( parameter_area, "%llx: Back at you\n", speid ); // Now send it back. mfc_put(parameter_area, argp.ull, 128, 31, 0, 0); mfc_write_tag_mask(1<<31); mfc_read_tag_status_all(); . . .
Background image of page 4
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 5 SPU to SPU Transfer ! Passes data from PPU to SPU, SPU to SPU, then back to the PPU. ! New concepts/constructs:
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/03/2011 for the course CDA 6938 taught by Professor Zou,c during the Spring '08 term at University of Central Florida.

Page1 / 12

Day1-15_Hands-on_DMA_SPU-to-SPU - IBM Systems & Technology...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online