Changeset 5594


Ignore:
Timestamp:
Aug 4, 2017, 6:32:41 AM (3 months ago)
Author:
cameron
Message:

Simplification of MultiBlockKernel? builder: stream set pointers are to the block base position

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5553 r5594  
    938938    }
    939939    for (unsigned i = 0; i < mStreamSetInputs.size(); i++) {
    940         Value * bufPtr = kb->getRawInputPointer(mStreamSetInputs[i].name, kb->getInt32(0), processedItemCount[i]);
    941         bufPtr = kb->CreatePointerCast(bufPtr, mStreamSetInputBuffers[i]->getPointerType());
    942         doMultiBlockArgs.push_back(bufPtr);
     940        //Value * bufPtr = kb->getRawInputPointer(mStreamSetInputs[i].name, kb->getInt32(0), processedItemCount[i]);
     941        //bufPtr = kb->CreatePointerCast(bufPtr, mStreamSetInputBuffers[i]->getPointerType());
     942        doMultiBlockArgs.push_back(inputBlockPtr[i]);
    943943    }
    944944    for (unsigned i = 0; i < mStreamSetOutputs.size(); i++) {
    945         Value * bufPtr = kb->getRawOutputPointer(mStreamSetOutputs[i].name, kb->getInt32(0), producedItemCount[i]);
    946         bufPtr = kb->CreatePointerCast(bufPtr, mStreamSetOutputBuffers[i]->getPointerType());
    947         doMultiBlockArgs.push_back(bufPtr);
     945        //Value * bufPtr = kb->getRawOutputPointer(mStreamSetOutputs[i].name, kb->getInt32(0), producedItemCount[i]);
     946        //bufPtr = kb->CreatePointerCast(bufPtr, mStreamSetOutputBuffers[i]->getPointerType());
     947        doMultiBlockArgs.push_back(outputBlockPtr[i]);
    948948    }
    949949
     
    10741074                kb->SetInsertPoint(copyDone);
    10751075            }
    1076             Value * itemAddress = kb->getRawInputPointer(mStreamSetInputs[i].name, kb->getInt32(0), processedItemCount[i]);
    1077             itemAddress = kb->CreatePtrToInt(itemAddress, intAddrTy);
    1078             Value * baseAddress = inputBlockPtr[i];
    1079             baseAddress = kb->CreatePtrToInt(baseAddress, intAddrTy);
    1080             Value * tempAddress = kb->CreateAdd(kb->CreatePtrToInt(tempBufPtr, intAddrTy), kb->CreateSub(itemAddress, baseAddress));
    1081             tempArgs.push_back(kb->CreateIntToPtr(tempAddress, bufPtrType));
     1076            tempArgs.push_back(tempBufPtr);
    10821077        }
    10831078        else {
     
    10951090        outputBasePos[i] = kb->CreateAnd(producedItemCount[i], blockBaseMask);
    10961091        mStreamSetOutputBuffers[i]->createBlockAlignedCopy(kb.get(), tempBufPtr, outputBlockPtr[i], kb->CreateSub(producedItemCount[i], outputBasePos[i]));
    1097         Value * itemAddress = kb->CreatePtrToInt(kb->getRawOutputPointer(mStreamSetOutputs[i].name, kb->getInt32(0), producedItemCount[i]), intAddrTy);
    1098         Value * outputPtr = kb->getOutputStreamBlockPtr(mStreamSetOutputs[i].name, kb->getInt32(0));
    1099         Value * baseAddress = kb->CreatePtrToInt(outputPtr, intAddrTy);
    1100         Value * tempAddress = kb->CreateAdd(kb->CreatePtrToInt(tempBufPtr, intAddrTy), kb->CreateSub(itemAddress, baseAddress));
    1101         tempArgs.push_back(kb->CreateIntToPtr(tempAddress, bufPtrType));
     1092        tempArgs.push_back(tempBufPtr);
    11021093    }
    11031094
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5552 r5594  
    343343      there will be two buffer pointers for that stream set, one for accessing stream set
    344344      items without lookahead and one for accessing the items with lookahead.   
    345     * pointers are to the address of the first unprocessed item of the first stream
    346       of the stream set.
     345    * pointers are to the beginning of the block corresponding to the
     346      processedItemCount or producedItemCount of the given stream set.
    347347    * the base type of each pointer is the StreamSetBlockType of that streamset
    348348
     
    371371    * for any input pointer p, a GEP instruction with a single int32 index i
    372372      will produce a pointer to the buffer position corresponding to the ith block of the
    373       input stream set.
     373      input stream set, relative to the initial block based on the processedItemCount.
    374374    * for any output stream set declared with a Fixed or Add1 processing rate with respect
    375375      to the principal input stream set, a GEP instruction with a single int32 index i
    376376      will produce a pointer to the buffer position corresponding to the ith block of the
    377       stream set.
     377      stream set, relative to the initial block based on the producedItemCount.
    378378
    379379#.  Upon completion of multi-block processing, the Multi-Block Kernel Builder will arrange that
  • icGREP/icgrep-devel/icgrep/kernels/radix64.cpp

    r5508 r5594  
    7979
    8080    // The main loop processes 3 packs of data at a time.
     81    // The initial pack offsets may be nonzero.
    8182   
    8283    Value * sourcePackPtr = iBuilder->CreateBitCast(sourceStream, iBuilder->getBitBlockType()->getPointerTo());
     84    Value * offset = iBuilder->CreateURem(iBuilder->getProcessedItemCount("sourceStream"), iBuilder->getSize(iBuilder->getBitBlockWidth()));
     85    sourcePackPtr = iBuilder->CreateGEP(sourcePackPtr, iBuilder->CreateUDiv(offset, iBuilder->getSize(PACK_SIZE)));
    8386    Value * outputPackPtr = iBuilder->CreateBitCast(expandedStream, iBuilder->getBitBlockType()->getPointerTo());
     87    offset = iBuilder->CreateURem(iBuilder->getProducedItemCount("expand34Stream"), iBuilder->getSize(iBuilder->getBitBlockWidth()));
     88    outputPackPtr = iBuilder->CreateGEP(outputPackPtr, iBuilder->CreateUDiv(offset, iBuilder->getSize(PACK_SIZE)));
    8489
    8590    iBuilder->CreateCondBr(iBuilder->CreateICmpSGT(itemsToDo, iBuilder->getSize(0)), expand_3_4_loop, expand3_4_exit);
  • icGREP/icgrep-devel/icgrep/kernels/swizzle.h

    r5440 r5594  
    3232
    3333// For example: consider the following 4 streams (32 bits each)
    34 // Stream 1:   abcdef00 ghi00000 jk000000 lmnop000
    35 // Stream 2:   qrstuv00 wxy00000 z1000000 23456000
    36 // Stream 3:   ABCDEF00 GHI00000 JK000000 LMNOP000
    37 // Stream 4:   QRSTUV00 WZY00000 Z1000000 23456000
     34// Stream 1:   000pomnl 000000kj 00000ihg 00fedcba
     35// Stream 2:   00065432 0000001z 00000yxw 00vutsrq
     36// Stream 3:   000POMNL 000000KJ 00000IHG 00FEDCBA
     37// Stream 4:   00065432 0000001Z 00000YXW 00VUTSRQ
    3838//
    3939// The swizzled output using a field width of 8 produces the following swizzles.
    4040//
    41 // Swizzle 1:  abcdef00 qrstuv00 ABCDEF00 QRSTUV00
    42 // Swizzle 2:  ghi00000 wxy00000 GHI00000 WZY00000
    43 // Swizzle 3:  jk000000 z1000000 JK000000 Z1000000
    44 // Swizzle 4:  lmnop000 23456000 LMNOP000 23456000
     41// Swizzle 1:  00VUTSRQ 00FEDCBA 00vutsrq 00fedcba
     42// Swizzle 2:  00000YXW 00000IHG 00000yxw 00000ihg
     43// Swizzle 3:  0000001Z 000000KJ 0000001z 000000kj
     44// Swizzle 4:  00065432 000POMNL 00065432 000pomnl
    4545//
    4646// Now it might be convenient to compress all fields of swizzle 1 by 2, all fields of swizzle 2 by 5
Note: See TracChangeset for help on using the changeset viewer.