void internal_lessequal(long a, float b) { //printf("Inside internal add\n"); //b must be wrapped in a PyArrayObject PyArrayObject *scalar = (PyArrayObject*)_malloc_align(sizeof(PyArrayObject),7); scalar->blockData = (char**)_malloc_align(sizeof(char*),7); scalar->blockData[0] = (char*)_malloc_align(sizeof(float),7); ((float*)(scalar->blockData[0]))[0] = b; scalar->numberOfBlocks = 1; //Setting the Operation object Operation_t op1; op1.shaderSize = arraylessequal_arrayscalar_size; op1.EA_shader = arraylessequal_arrayscalar; op1.obj[0] = a; op1.obj[1] = scalar; op1.obj[2] = a; //printf("arraymultiply: %d\n",arraydivide); //printf("&arraymultiply: %d\n",&arraydivide); op1.num_SPES = speThreads; unsigned int i = 0; for(i = 0;i<speThreads;i++) { spe_pointer_addr[i][0] = &op1; } //printf("Adr of op1 sat. It is: %x\n",&op1); unsigned int state = 1; unsigned int y; for ( y = 0 ; y < speThreads ; y++ ) { //printf("Sending state to disp\n"); spe_in_mbox_write ( speData[y].spe_ctx, &state, 1, SPE_MBOX_ALL_BLOCKING ); //printf("TO THE DISP. THE SUM STATE: %d, has just been sent\n",&state); //printf("This is the actual value: %d\n",state); } //printf("ADD Waiting for the SPE's\n");//ALSO, check that the structure used is correct! // Waiting for SPEs! //printf( "Waiting for SPEs\n" ); unsigned int checked = 0; unsigned int r; while( checked < speThreads ) { if ( spe_out_mbox_status( speData[checked].spe_ctx ) ) { spe_out_mbox_read( speData[checked].spe_ctx, &r, 1 ); checked++; //printf("Something read on the inbox\n"); } } //printf("Done waiting on threads to finish in LESSEQUAL\n"); }
void Scene::KDInitBuild(int maxleafsize, int extradepth, bool loadpolys) { if(loadpolys) LoadPolygons(this, &worldaabb); else ComputeWorldAABB(&worldaabb, this); if(numnodes > 0) { #ifdef _CELL _free_align(nodes); #else delete [] nodes; #endif #ifdef _CELL _free_align(leafpolys); _free_align(leaves); #else delete [] leafpolys; delete [] leaves; #endif numnodes = 0; } if(numpolys < maxleafsize) maxnumleaves = numpolys; else maxnumleaves = numpolys / maxleafsize; maxdepth = (int)(log2(maxnumleaves) + 0.5 + extradepth); maxnumleaves = (int)pow(2.0f, maxdepth); numnodes = (int)pow(2.0f, maxdepth+1) - 1; #ifdef _CELL leafpolys = (kdleafpoly_t*)_malloc_align(sizeof(kdleafpoly_t) * maxnumleaves, 4); leaves = (int*)_malloc_align(maxnumleaves*sizeof(int), 7); #else leafpolys = new kdleafpoly_t[maxnumleaves]; leaves = new int[maxnumleaves]; #endif for(int i=0; i < maxnumleaves; i++) leaves[i] = 0; numleaves = maxnumleaves; numleafpolys = 0; #ifdef _CELL nodes = (kdnode_t*)_malloc_align(numnodes*sizeof(kdnode_t), 7); #else nodes = new kdnode_t[numnodes]; #endif }
void KDBuildJob::ResetMinMaxBin(minmaxbin_t *mmb, int nbins, int index) { if(nbins != numbins[index]) { if(numbins[index] > 0) { #ifdef _CELL _free_align(minbins[index]); _free_align(maxbins[index]); #else delete [] minbins[index]; delete [] maxbins[index]; #endif } numbins[index] = nbins; #ifdef _CELL minbins[index] = (bin_t*)_malloc_align(numbins[index] * sizeof(bin_t), 7); maxbins[index] = (bin_t*)_malloc_align(numbins[index] * sizeof(bin_t), 7); #else minbins[index] = new bin_t[numbins[index]]; maxbins[index] = new bin_t[numbins[index]]; #endif } int i; #ifdef _CELL vector float zero = spu_splats(0.0f); vector float *vminbins = (vector float*)minbins[index]; vector float *vmaxbins = (vector float*)maxbins[index]; for(i=0; i < numbins[index]; i++) { vminbins[i] = zero; vmaxbins[i] = zero; } #else for(i=0; i < numbins[index]; i++) { minbins[index][i].b[0] = maxbins[index][i].b[0] = 0; minbins[index][i].b[1] = maxbins[index][i].b[1] = 0; minbins[index][i].b[2] = maxbins[index][i].b[2] = 0; } #endif mmb->minbins = minbins[index]; mmb->maxbins = maxbins[index]; mmb->numbins = numbins[index]; mmb->bestcost = 1000000; }
PyObject *setcbe(PyObject *self, PyObject *args) { PyArrayObjectTest *resultObj = _malloc_align(sizeof(PyArrayObjectTest),7); PyObject *result = NULL; //We read a, but so far we don't use it. long a; resultObj->a = 7; resultObj->b = 8; if (PyArg_ParseTuple(args, "i", &a)) { result = Py_BuildValue("i", resultObj); } /* otherwise there is an error, * the exception already raised by PyArg_ParseTuple, and NULL is * returned. */ //Call something interesting //testFunction(5); return result; }
void sMakeMatrix( unsigned int x, unsigned int y, unsigned int blocksize, float value, PyArrayObject *obj ) { //obj->blockData = (char **)memalign( 16, ( 4 * x * y + 15 ) & ~15 ); obj->blockData = (char **)_malloc_align( 4 * x * y, 4 ); //printf( "TEST=%u\n", ( 4 * x * y + 15 ) & ~15 ); obj->numberOfBlocks = x * y; obj->numberOfBlocksXDim = x; obj->numberOfBlocksYDim = y; obj->paddingx = paddingx; obj->size_in_bytes = 4; obj->blockSizes = blocksize*blocksize; void *tmp[_CHEAT_LEVEL]; unsigned int i; for( i = 0 ; i < _CHEAT_LEVEL ; i++ ) { tmp[i] = sMakeBlock( blocksize*blocksize, value ); } for( i = 0 ; i < x ; i++ ) { obj->blockData[i] = tmp[i%_CHEAT_LEVEL]; //printf( "1.=%f\n", *(float*)obj->blockData[i] ); } }
void LoadPolygons(Scene *scene, aabb_t *worldaabb) { if(numpolys > 0) { #ifdef _CELL _free_align(polys); #else delete [] polys; #endif numpolys = 0; } vector<Mesh*>::iterator it; numpolys = 0; for(it = scene->meshlist.begin(); it != scene->meshlist.end(); it++) { Mesh *m = (*it); numpolys += m->NumTriangles(); } #ifdef _CELL polys = (kdpolyp_t*)_malloc_align(sizeof(kdpolyp_t) * numpolys, 7); #else polys = new kdpolyp_t[numpolys]; #endif int index = 0; AABB waabb(worldaabb); waabb.Reset(); for(it = scene->meshlist.begin(); it != scene->meshlist.end(); it++) { Mesh *m = (*it); triangle_t *triangles = m->GetTriangles(); normal_t *normals = m->GetNormals(); color_t *colors = m->GetColors(); aabb_t *m_aabbs = m->GetAABBs(); for(int i=0; i < m->NumTriangles(); i++) { polys[index].triangle = &triangles[i]; polys[index].normal = &normals[i]; polys[index].color = colors[i].c; m_aabbs[i].poly = &polys[index]; waabb.Union(&m_aabbs[i]); index++; } } }
PyObject *_initializeVector(PyObject *self, PyObject *args) { PyObject *result = NULL; long a; PyArrayObject *resultObj = _malloc_align(sizeof(PyArrayObject),7); result = Py_BuildValue("i", resultObj); /* otherwise there is an error, * the exception already raised by PyArg_ParseTuple, and NULL is * returned. */ //Setting the PyArrayObject resultObj->numberOfBlocks = _numberOfBlocks*_numberOfBlocks; resultObj->numberOfBlocksXDim = _numberOfBlocks*_numberOfBlocks; resultObj->numberOfBlocksYDim = 1; resultObj->blockSize = _blockSize;//in elements resultObj->nd = 1; resultObj->blockData = (char**)_malloc_align(sizeof(char*)*_numberOfBlocks*_numberOfBlocks,7); unsigned int i = 0; resultObj->blockData[0] = (char*)_malloc_align(sizeof(char)*_blockSize*_blockSize*4,7); //printf("start blockData[0] : %d,%x\n",resultObj->blockData[0],resultObj->blockData[0]); for(i = 1;i<_numberOfBlocks*_numberOfBlocks;i++) { resultObj->blockData[i] = resultObj->blockData[0]; //printf("In loop\n"); //printf("blockData[i] : %d,%x\n",resultObj->blockData[i],resultObj->blockData[i]); //printf("blockData[0] : %d,%x\n",resultObj->blockData[0],resultObj->blockData[0]); //printf("In loop out\n"); } //printf("blockData[0] : %d,%x\n",resultObj->blockData[0],resultObj->blockData[0]); //printf("blockData[1] : %d,%x\n",resultObj->blockData[1],resultObj->blockData[1]); //printf("Based on sizes: %d and %d: \n",sizeof(char*)*_numberOfBlocks*_numberOfBlocks,sizeof(char)*_blockSize*_blockSize*4); //Fill zeros in the block for(i=0;i<_blockSize*_blockSize;i++) { ((unsigned int*)resultObj->blockData[0])[i] = 0; } return result; }
void *sMakeBlock( unsigned int elements, float value ) { //void *block = (void *)memalign( 16, ( 4 * elements + 15 ) & ~15 ); void *block = (void*)_malloc_align( 4 * elements, 7 ); void *p = block; unsigned int i; for( i = 0 ; i < elements ; i++ ) { //*(float*)p = i; *(float*)p = value; //printf( "%f, ", *(float*)p ); p += 4; } return block; }
void* malloc_align(size_t count, size_t align) { return _malloc_align(count, align); }
/* loads the scene using DMA - blocks until done */ void load_scene(unsigned long long ea, scene_t *scene) { unsigned int i = 0; object3d_t *objects = 0; pointlight_t *lights = 0; point_t *v = 0; #if defined(_DEBUG) && _DEBUG > 2 printf("Transferring %d bytes to LSaddr(%8lX) from EAadd(%8lX:%8lX) for SCENE\n", sizeof(scene_t), &scene, mfc_ea2h(ea), mfc_ea2l(ea)); #endif /* DMA request for scene */ spu_mfcdma64(scene, mfc_ea2h(ea), mfc_ea2l(ea), sizeof(scene_t), SPUDMA_SCENE, MFC_GET_CMD); /* wait for request to complete */ spu_writech(MFC_WrTagMask, 1 << SPUDMA_SCENE); mfc_read_tag_status_all(); /* copy over objects */ objects = _malloc_align(sizeof(object3d_t) * scene->nObjects, 4); #if defined(_DEBUG) && _DEBUG > 2 printf("Transferring %d bytes to LSaddr(%8lX) from EAadd(%8lX:%8lX) for OBJECTS\n", sizeof(object3d_t) * scene->nObjects, objects, mfc_ea2h(scene->objects_ea), mfc_ea2l(scene->objects_ea)); #endif /* initiate DMA */ spu_mfcdma64(objects, mfc_ea2h(scene->objects_ea), mfc_ea2l(scene->objects_ea), sizeof(object3d_t) * scene->nObjects, SPUDMA_OBJECTS, MFC_GET_CMD); /* copy over lights */ lights = _malloc_align(sizeof(pointlight_t) * scene->nLights, 4); #if defined(_DEBUG) && _DEBUG > 2 printf("Transferring %d bytes to LSaddr(%8X) from EAadd(%8lX:%8lX) for LIGHTS\n", sizeof(pointlight_t) * scene->nLights, lights, mfc_ea2h(scene->lights_ea), mfc_ea2l(scene->lights_ea)); #endif /* initiate DMA for lights */ spu_mfcdma64(lights, mfc_ea2h(scene->lights_ea), mfc_ea2l(scene->lights_ea), sizeof(pointlight_t) * scene->nLights, SPUDMA_LIGHTS, MFC_GET_CMD); /* wait for objects to complete */ spu_writech(MFC_WrTagMask, 1 << SPUDMA_OBJECTS); mfc_read_tag_status_all(); /* assign local store pointer to objects */ scene->objects = objects; /* iterate each object locally */ for(; i < scene->nObjects; ++i) { if(objects[i].geometryType == GEOMETRY_POLYGON) { /* allocate memory for vertex */ v = _malloc_align(sizeof(point_t) * objects[i].poly_obj.nVerticies, 4); /* initiate DMA to get verticies */ spu_mfcdma64(v, mfc_ea2h(objects[i].poly_obj.vertex_ea), mfc_ea2l(objects[i].poly_obj.vertex_ea), sizeof(point_t) * objects[i].poly_obj.nVerticies, SPUDMA_VERTEXES, MFC_GET_CMD); /* assign local store pointer - WARNING - safe? */ objects[i].poly_obj.vertex = v; } } /* wait for all DMA to finish (vertexes, lights) */ spu_writech(MFC_WrTagMask, 1 << SPUDMA_LIGHTS | 1 << SPUDMA_VERTEXES ); mfc_read_tag_status_all(); /* assign local store lights pointer */ scene->lights = lights; }
int main( unsigned long long id __attribute__ ((unused)), unsigned long long argv ) { unsigned int i, EA = argv; /* * Allocate memory * */ // Info LS_ShaderInfo shaderinfo; // Memory for the shader unsigned int *shader[__NUMBER_OF_SHADERS]; for( i = 0 ; i < __NUMBER_OF_SHADERS ; i++ ) { shader[i] = (unsigned int *)_malloc_align( __SHADER_SIZE, 7 ); } // Memory for the blocks char *blocks[(__NUMBER_OF_BLOCKS_IN_MEM) * 2]; for( i = 0 ; i < __NUMBER_OF_BLOCKS_IN_MEM * 2 ; i++ ) { blocks[i] = (char *)_malloc_align( __BLOCK_DATA_SIZE, 7 ); shaderinfo.LS_blockDataArea[i] = blocks[i]; } // Memory for metadata char *meta = (char *)_malloc_align( __META_DATA_SIZE, 7 ); shaderinfo.LS_shaderMemory = meta; Operation_t myop[__NUMBER_OF_SHADERS]; unsigned int PPE_addr[__NUMBER_OF_SHADERS] __attribute__((aligned(16))); unsigned int EA_result[__NUMBER_OF_SHADERS]; // Getting SPE id SPE_id = mb_getmbox( ); // SELF CHECK //if ( SPE_id == 0 ) SelfCheck(); //printf( "SPE[%u]: SPE_* is at %#x\n", SPE_id, EA ); //printf( "[SPE(%u)]Check!!!\n", SPE_id ); // SPU program fragment prototype void (*run)( unsigned int SPE_id, LS_ShaderInfo *info, Operation_t *myop, Functions_t *funcs ) = NULL; void (*runr)( unsigned int SPE_id, unsigned int EA_result, LS_ShaderInfo *info, Operation_t *myop, Functions_t *funcs ) = NULL; // Getting SPE id unsigned int seed = mb_getmbox( ); // Init random mc_rand_ks_init( seed ); // Common Functions Functions_t funcs; funcs.printuint = PrintUInt; funcs.printint = PrintInt; funcs.printe = PrintE; funcs.printchar = PrintChar; funcs.printfloat = PrintFloat; funcs.printaddr = PrintAddr; funcs.printstr = PrintString; funcs.printfloat3 = PrintFloat3; funcs.printfloat3v = PrintFloat3v; funcs.printfloatv = PrintFloatv; funcs.printfloatrow = PrintFloatRow; //funcs.printf = printf2; funcs.rand_0_to_1_f = mc_rand_ks_0_to_1_f4; //funcs.rand_0_to_1_fm = mc_rand_ks_0_to_1_array_f4; unsigned int running = 1, task = 0; // prof_clear(); // prof_start(); unsigned int idt; // THA LOOP while( running ) { task = mb_getmbox( ); Printf1( "[SPE(%u)]Got state %u\n", SPE_id, task ); // Transfer operation and run shader with no return value // 0 -> 99 if( task < 100 ) { idt = task; CHECKBOUNDS( idt ); Printf1( "SPE[%u]: Get shader for slot %u\n", SPE_id, idt ); GetSPEAddr( EA, PPE_addr ); GetOperation( PPE_addr[idt], &myop[idt] ); GetShader( (unsigned int)myop[idt].EA_shader, myop[idt].shaderSize, shader[idt] ); Printf1( "SPE[%u]: Shader recieved for slot\n", SPE_id ); run = (void *)shader[0]; Printf1( "SPE[%u]: --- Running shader! ----------\n", SPE_id ); run( SPE_id, &shaderinfo, &myop[idt], &funcs ); Printf1( "SPE[%u]: --- End of shader! -----------\n", SPE_id ); spu_writech( SPU_WrOutMbox, 1 ); } // Transfer operation and run shader WITH return value // 100 -> 199 else if( task < 200 ) { idt = task - 100; CHECKBOUNDS( idt ); Printf1( "SPE[%u]: Get shader with return value for slot %u\n", SPE_id, idt ); EA_result[idt] = mb_getmbox( ); GetSPEAddr( EA, PPE_addr ); GetOperation( PPE_addr[idt], &myop[idt] ); GetShader( (unsigned int)myop[idt].EA_shader, myop[idt].shaderSize, shader[idt] ); runr = (void *)shader[idt]; Printf1( "SPE[%u]: --- Running shader! ----------\n", SPE_id ); runr( SPE_id, EA_result[idt], &shaderinfo, &myop[idt], &funcs ); Printf1( "SPE[%u]: --- End of shader! -----------\n", SPE_id ); spu_writech( SPU_WrOutMbox, 1 ); } // Transfer operation and shader WITHOUT return value // 200 -> 299 else if( task < 300 ) { idt = task - 200; CHECKBOUNDS( idt ); Printf1( "SPE[%u]: Get shader for slot %u\n", SPE_id, idt ); GetSPEAddr( EA, PPE_addr ); GetOperation( PPE_addr[idt], &myop[idt] ); GetShader( (unsigned int)myop[idt].EA_shader, myop[idt].shaderSize, shader[idt] ); spu_writech( SPU_WrOutMbox, 1 ); } // Run shader with no return value // 300 -> 399 else if( task < 400 ) { idt = task - 300; CHECKBOUNDS( idt ); Printf1( "SPE[%u]: Run shader from slot %u\n", SPE_id, idt ); run = (void *)shader[idt]; run( SPE_id, &shaderinfo, &myop[idt], &funcs ); spu_writech( SPU_WrOutMbox, 1 ); } // Transfer operation and shader WITH return value // 400 -> 499 else if( task < 500 ) { idt = task - 400; CHECKBOUNDS( idt ); Printf1( "SPE[%u]: Get shader with return value for slot %u\n", SPE_id, idt ); EA_result[idt] = mb_getmbox( ); GetSPEAddr( EA, PPE_addr ); GetOperation( PPE_addr[idt], &myop[idt] ); GetShader( (unsigned int)myop[idt].EA_shader, myop[idt].shaderSize, shader[idt] ); Printf1( "SPE[%u]: Done getting operation %u\n", SPE_id, idt ); spu_writech( SPU_WrOutMbox, 1 ); } // Run shader WITH return value // 500 -> 599 else if( task < 600 ) { idt = task - 500; CHECKBOUNDS( idt ); Printf1( "SPE[%u]: Run shader with return value from slot %u\n", SPE_id, idt ); runr = (void *)shader[0]; runr( SPE_id, EA_result[idt], &shaderinfo, &myop[0], &funcs ); spu_writech( SPU_WrOutMbox, 1 ); } // Sanity check!!! else if( task == 1000 ) { spu_writech( SPU_WrOutMbox, 123 ); } // DEFAULT else { Printf1( "[SPE(%u)]No such instruction, quitting\n", SPE_id ); running = 0; } // switch( task ) // { // case 0: // QUIT // Printf1( "[SPE(%u)]Quitting\n", SPE_id ); // // running = 0; // break; // // /* // * Get an operation with no return value // * // */ // case 1: // Get operation and run // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[0], &myop[0] ); // GetShader( (unsigned int)myop[0].EA_shader, myop[0].shaderSize, shader[0] ); // run = (void *)shader[0]; // // Printf1( "SPE[%u]: --- Running shader! ----------\n", SPE_id ); // run( SPE_id, &shaderinfo, &myop[0], &funcs ); // Printf1( "SPE[%u]: --- End of shader! -----------\n", SPE_id ); // // spu_writech( SPU_WrOutMbox, 1 ); // break; // // /* // * Get an operation with a return value // * // */ // case 2: // Get operation with return value and run // EA_result = mb_getmbox( ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[0], &myop[0] ); // GetShader( (unsigned int)myop[0].EA_shader, myop[0].shaderSize, shader[0] ); // runr = (void *)shader[0]; // // Printf1( "SPE[%u]: --- Running shader! ----------\n", SPE_id ); // runr( SPE_id, EA_result, &shaderinfo, &myop[0], &funcs ); // // Printf1( "SPE[%u]: --- End of shader! -----------\n", SPE_id ); // // spu_writech( SPU_WrOutMbox, 1 ); // break; // // case 3: // Get operation without return value NO RUN! // // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[0], &myop[0] ); // GetShader( (unsigned int)myop[0].EA_shader, myop[0].shaderSize, shader[0] ); // run = (void *)shader[0]; // // spu_writech( SPU_WrOutMbox, 1 ); // break; // // // case 4: // Get operation with return value NO RUN! // // EA_result = mb_getmbox( ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[0], &myop[0] ); // GetShader( (unsigned int)myop[0].EA_shader, myop[0].shaderSize, shader[0] ); // runr = (void *)shader[0]; // // spu_writech( SPU_WrOutMbox, 1 ); // break; // // case 5: // RUN!!!! with _NO_ return value // Printf1( "SPE[%u]: --- Running shader! ----------\n", SPE_id ); // // run( SPE_id, &shaderinfo, &myop[0], &funcs ); // Printf1( "SPE[%u]: --- End of shader! -----------\n", SPE_id ); // spu_writech( SPU_WrOutMbox, 1 ); // break; // // case 6: // RUN!!!! with return value // // Printf1( "SPE[%u]: --- Running shader! ----------\n", SPE_id ); // // runr( SPE_id, EA_result, &shaderinfo, &myop[0], &funcs ); // // Printf1( "SPE[%u]: --- End of shader! -----------\n", SPE_id ); // // spu_writech( SPU_WrOutMbox, 1 ); // break; // // /* // * Operations with no return values // */ // case 100: // Get a shader for slot 0 // Printf1( "SPE[%u]: Get shader for slot 0\n", SPE_id ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[0], &myop[0] ); // GetShader( (unsigned int)myop[0].EA_shader, myop[0].shaderSize, shader[0] ); // break; // // case 101: // Get a shader for slot 1 // Printf1( "SPE[%u]: Get shader for slot 1\n", SPE_id ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[1], &myop[1] ); // GetShader( (unsigned int)myop[1].EA_shader, myop[1].shaderSize, shader[1] ); // break; // // case 102: // Get a shader for slot 2 // Printf1( "SPE[%u]: Get shader for slot 2\n", SPE_id ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[2], &myop[2] ); // GetShader( (unsigned int)myop[2].EA_shader, myop[2].shaderSize, shader[2] ); // break; // // case 103: // Get a shader for slot 3 // Printf1( "SPE[%u]: Get shader for slot 3\n", SPE_id ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[3], &myop[3] ); // GetShader( (unsigned int)myop[3].EA_shader, myop[3].shaderSize, shader[3] ); // break; // // case 110: // Run slot 0 // Printf1( "SPE[%u]: Run shader from slot 0\n", SPE_id ); // run = (void *)shader[0]; // run( SPE_id, &shaderinfo, &myop[0], &funcs ); // spu_writech( SPU_WrOutMbox, 1 ); // break; // // case 111: // Run slot 1 // Printf1( "SPE[%u]: Run shader from slot 1\n", SPE_id ); // run = (void *)shader[1]; // run( SPE_id, &shaderinfo, &myop[1], &funcs ); // spu_writech( SPU_WrOutMbox, 1 ); // break; // // case 112: // Run slot 2 // Printf1( "SPE[%u]: Run shader from slot 2\n", SPE_id ); // run = (void *)shader[2]; // run( SPE_id, &shaderinfo, &myop[2], &funcs ); // spu_writech( SPU_WrOutMbox, 1 ); // break; // // case 113: // Run slot 3 // Printf1( "SPE[%u]: Run shader from slot 3\n", SPE_id ); // run = (void *)shader[3]; // Printf1( "SPE[%u]: Run shader from slot 3\n", SPE_id ); // run( SPE_id, &shaderinfo, &myop[3], &funcs ); // spu_writech( SPU_WrOutMbox, 1 ); // break; // // /* // * Update operations // */ // // case 120: // Update operation for slot 0 // Printf1( "SPE[%u]: Update operation for slot 0\n", SPE_id ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[0], &myop[0] ); // break; // // case 121: // Update operation for slot 1 // Printf1( "SPE[%u]: Update operation for slot 1\n", SPE_id ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[1], &myop[1] ); // break; // // case 122: // Update operation for slot 2 // Printf1( "SPE[%u]: Update operation for slot 2\n", SPE_id ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[2], &myop[2] ); // break; // // case 123: // Update operation for slot 3 // Printf1( "SPE[%u]: Update operation for slot 3\n", SPE_id ); // GetSPEAddr( EA, PPE_addr ); // GetOperation( PPE_addr[3], &myop[3] ); // break; // // /* // * Operations with return values // */ // case 200: // Get a shader for slot 0 // Printf1( "SPE[%u]: Run shader with return value from slot 0\n", SPE_id ); // EA_result = mb_getmbox( ); // GetOperation( PPE_addr[0], &myop[0] ); // GetShader( (unsigned int)myop[0].EA_shader, myop[0].shaderSize, shader[0] ); // break; // // case 201: // Get a shader for slot 1 // Printf1( "SPE[%u]: Run shader with return value from slot 1\n", SPE_id ); // EA_result = mb_getmbox( ); // GetOperation( PPE_addr[0], &myop[1] ); // GetShader( (unsigned int)myop[1].EA_shader, myop[1].shaderSize, shader[1] ); // break; // // case 210: // Run slot 0 // runr = (void *)shader[0]; // runr( SPE_id, EA_result, &shaderinfo, &myop[0], &funcs ); // spu_writech( SPU_WrOutMbox, 1 ); // break; // // case 211: // Run slot 1 // runr = (void *)shader[1]; // runr( SPE_id, EA_result, &shaderinfo, &myop[1], &funcs ); // spu_writech( SPU_WrOutMbox, 1 ); // break; // // case 1000: // Sanity check // spu_writech( SPU_WrOutMbox, 123 ); // break; // // // default: // Printf1( "[SPE(%u)]No such instruction, quitting\n", SPE_id ); // running = 0; // } } //prof_stop(); return 1; }
void* malloc_align7(unsigned int size) { return _malloc_align(size, 7); }