using different search indices (i and j) for bufferInfo and devBuffers in allocateBuf...
authorPritish Jetley <pjetley2@illinois.edu>
Sun, 8 Feb 2009 00:12:36 +0000 (00:12 +0000)
committerPritish Jetley <pjetley2@illinois.edu>
Sun, 8 Feb 2009 00:12:36 +0000 (00:12 +0000)
src/arch/cuda/hybridAPI/cuda-hybrid-api.cu

index 4df76d91fcd04e5e12e131681535ac3257fc0ff2..db77cf61af363442f33a9a40d3dca8317b24d575 100644 (file)
@@ -115,10 +115,10 @@ void allocateBuffers(workRequest *wr) {
       // if index value is invalid, use an available ID  
       if (index < 0 || index >= NUM_BUFFERS) {
        int found = 0; 
-       for (int i=nextBuffer; i<NUM_BUFFERS*2; i++) {
-         if (devBuffers[i] == NULL) {
-           bufferInfo[i].bufferID = i
-           index = i;
+       for (int j=nextBuffer; j<NUM_BUFFERS*2; j++) {
+         if (devBuffers[j] == NULL) {
+           bufferInfo[i].bufferID = j
+           index = j;
            found = 1; 
            break;
          }
@@ -129,10 +129,10 @@ void allocateBuffers(workRequest *wr) {
         */
        
        if (!found) {
-         for (int i=NUM_BUFFERS; i<nextBuffer; i++) {
-           if (devBuffers[i] == NULL) {
-             bufferInfo[i].bufferID = i
-             index = i;
+         for (int j=NUM_BUFFERS; j<nextBuffer; j++) {
+           if (devBuffers[j] == NULL) {
+             bufferInfo[i].bufferID = j
+             index = j;
              found = 1; 
              break;
            }