Ignore:
Timestamp:
Dec 6, 2017, 5:41:27 PM (18 months ago)
Author:
nmedfort
Message:

Bug fixes + more assertions to prevent similar errors.

Location:
icGREP/icgrep-devel/icgrep/toolchain
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/toolchain/pipeline.cpp

    r5755 r5757  
    646646}
    647647
    648 inline const Binding & getBinding(const Kernel * k, const std::string & name) {
    649     Port port; unsigned index;
    650     std::tie(port, index) = k->getStreamPort(name);
    651     if (port == Port::Input) {
    652         return k->getStreamInput(index);
    653     } else {
    654         return k->getStreamOutput(index);
    655     }
    656 }
    657 
    658 ProcessingRate::RateValue getUpperBound(const Kernel * const k, const ProcessingRate & rate) {
    659     if (rate.isFixed() || rate.isBounded()) {
    660         return rate.getUpperBound();
    661     } else if (rate.isRelative()) {
    662         return rate.getRate() * getUpperBound(k, getBinding(k, rate.getReference()).getRate());
    663     } else { // if (rate.isUnknown())
    664         return 0;
    665     }
    666 }
    667 
    668648void applyOutputBufferExpansions(const std::unique_ptr<KernelBuilder> & b, const Kernel * k) {
    669649    const auto & outputs = k->getStreamSetOutputBuffers();
    670650    for (unsigned i = 0; i < outputs.size(); i++) {
    671651        if (isa<DynamicBuffer>(outputs[i])) {
    672             const auto ub = getUpperBound(k, k->getStreamOutput(i).getRate());
     652            const auto ub = k->getUpperBound(k->getStreamOutput(i).getRate());
    673653            const auto baseSize = (ub.numerator() * k->getStride() + ub.denominator() - 1) / ub.denominator();
    674654            if (LLVM_LIKELY(baseSize > 0)) {
  • icGREP/icgrep-devel/icgrep/toolchain/toolchain.cpp

    r5755 r5757  
    5757
    5858
    59 static cl::opt<int, true> BlockSizeOption("BlockSize", cl::location(BlockSize), cl::init(0),
     59static cl::opt<unsigned, true> BlockSizeOption("BlockSize", cl::location(BlockSize), cl::init(0),
    6060                                          cl::desc("specify a block size (defaults to widest SIMD register width in bits)."), cl::cat(CodeGenOptions));
    6161
    6262
    63 static cl::opt<int, true> SegmentSizeOption("segment-size", cl::location(SegmentSize), cl::init(8),
     63static cl::opt<unsigned, true> SegmentSizeOption("segment-size", cl::location(SegmentSize), cl::init(8),
    6464                                            cl::desc("Segment Size"), cl::value_desc("positive integer"));
    6565
    66 static cl::opt<int, true> BufferSegmentsOption("buffer-segments", cl::location(BufferSegments), cl::init(1),
     66static cl::opt<unsigned, true> BufferSegmentsOption("buffer-segments", cl::location(BufferSegments), cl::init(1),
    6767                                               cl::desc("Buffer Segments"), cl::value_desc("positive integer"));
    6868
    6969
    70 static cl::opt<int, true> ThreadNumOption("thread-num", cl::location(ThreadNum), cl::init(2),
     70static cl::opt<unsigned, true> ThreadNumOption("thread-num", cl::location(ThreadNum), cl::init(2),
    7171                                          cl::desc("Number of threads used for segment pipeline parallel"), cl::value_desc("positive integer"));
    7272
     
    8181                                 cl::desc("Run on GPU only."), cl::cat(CodeGenOptions));
    8282
    83 static cl::opt<int, true> GroupNumOption("group-num", cl::location(GroupNum), cl::init(256),
     83static cl::opt<unsigned, true> GroupNumOption("group-num", cl::location(GroupNum), cl::init(256),
    8484                                         cl::desc("NUmber of groups declared on GPU"), cl::value_desc("positive integer"), cl::cat(CodeGenOptions));
    8585
     
    9292const char * ObjectCacheDir;
    9393
    94 int BlockSize;
     94unsigned BlockSize;
    9595
    96 int SegmentSize;
     96unsigned SegmentSize;
    9797
    98 int BufferSegments;
     98unsigned BufferSegments;
    9999
    100 int ThreadNum;
     100unsigned ThreadNum;
    101101
    102102bool EnableObjectCache;
     
    111111}(NVPTXOption);
    112112
    113 int GroupNum;
     113unsigned GroupNum;
    114114
    115115const llvm::Reloc::Model RelocModel = ::RelocModel;
     
    128128
    129129bool DebugOptionIsSet(const DebugFlags flag) {
     130    if (flag == EnableAsserts) return true;
    130131    return DebugOptions.isSet(flag);
    131132}
  • icGREP/icgrep-devel/icgrep/toolchain/toolchain.h

    r5755 r5757  
    6666extern const char * ObjectCacheDir;
    6767extern llvm::CodeGenOpt::Level OptLevel;  // set from command line
    68 extern int BlockSize;  // set from command line
    69 extern int SegmentSize;  // set from command line
    70 extern int BufferSegments;
    71 extern int ThreadNum;
     68extern unsigned BlockSize;  // set from command line
     69extern unsigned SegmentSize;  // set from command line
     70extern unsigned BufferSegments;
     71extern unsigned ThreadNum;
    7272extern bool EnableObjectCache;
    7373extern bool NVPTX;
    74 extern int GroupNum;
     74extern unsigned GroupNum;
    7575extern std::string ProgramName;
    7676extern llvm::TargetOptions Options;
Note: See TracChangeset for help on using the changeset viewer.