Ignore:
Timestamp:
Jan 14, 2018, 3:30:04 PM (21 months ago)
Author:
nmedfort
Message:

Potential bug fix for 32-bit

File:
1 edited

Legend:

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

    r5830 r5831  
    1717namespace kernel {
    1818
    19 const unsigned packSize = 64;
    20    
    21 llvm::Value * UntilNkernel::generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & b, llvm::Value * const numOfStrides) {
     19void UntilNkernel::generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> & b, llvm::Value * const numOfStrides) {
    2220
    2321/* 
     
    3937*/
    4038
     39    const unsigned packSize = b->getSizeTy()->getBitWidth();
    4140    Constant * const ZERO = b->getSize(0);
    4241    Constant * const ONE = b->getSize(1);
     
    101100    //Value * const packPtr = b->CreateGEP(b->CreatePointerCast(groupPtr, packPtrTy), packOffset);
    102101    //Value * const packBits = b->CreateLoad(packPtr);
    103     Value * const packCount = b->CreatePopcount(packBits);
     102    Value * const packCount = b->CreateZExtOrTrunc(b->CreatePopcount(packBits), b->getSizeTy());
    104103    Value * const observedUpTo = b->CreateNUWAdd(observed, packCount);
    105104
     
    173172    b->setProducedItemCount("uptoN", producedCount);
    174173
    175     return numOfStrides;
     174}
     175
     176unsigned LLVM_READNONE calculateRate(const std::unique_ptr<kernel::KernelBuilder> & b) {
     177    const unsigned packSize = b->getSizeTy()->getBitWidth();
     178    return (packSize * packSize) / b->getBitBlockWidth();
    176179}
    177180
    178181UntilNkernel::UntilNkernel(const std::unique_ptr<kernel::KernelBuilder> & b)
    179 : MultiBlockKernel("UntilN",
     182: MultiBlockKernel("UntilN_" + std::to_string(calculateRate(b)),
    180183// inputs
    181 {Binding{b->getStreamSetTy(), "bits", FixedRate((packSize * packSize) / b->getBitBlockWidth())}},
     184{Binding{b->getStreamSetTy(), "bits", FixedRate(calculateRate(b))}},
    182185// outputs
    183 {Binding{b->getStreamSetTy(), "uptoN", BoundedRate(0, (packSize * packSize) / b->getBitBlockWidth())}},
     186{Binding{b->getStreamSetTy(), "uptoN", BoundedRate(0, calculateRate(b))}},
    184187// input scalar
    185188{Binding{b->getSizeTy(), "N"}}, {},
Note: See TracChangeset for help on using the changeset viewer.