Ignore:
Timestamp:
May 31, 2017, 4:25:33 PM (2 years ago)
Author:
nmedfort
Message:

Initial attempt to improve debugging capabilities with compilation stack traces on error.

File:
1 edited

Legend:

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

    r5474 r5486  
    1111#include <boost/container/flat_set.hpp>
    1212#include <boost/container/flat_map.hpp>
     13#include <llvm/Support/CommandLine.h>
    1314#include <kernels/kernel_builder.h>
    1415
     
    1920using namespace llvm;
    2021
     22// static cl::opt<bool> UseYield("yield", cl::desc("yield after waiting"), cl::init(false));
    2123
    2224template <typename Value>
     
    105107
    106108        BasicBlock * const segmentWait = BasicBlock::Create(iBuilder->getContext(), kernel->getName() + "Wait", threadFunc);
     109
     110        BasicBlock * segmentYield = segmentWait;
     111//        if (UseYield) {
     112//            segmentYield = BasicBlock::Create(iBuilder->getContext(), kernel->getName() + "Yield", threadFunc);
     113//        }
     114
    107115        iBuilder->CreateBr(segmentWait);
    108116
     
    120128
    121129        if (kernel->hasNoTerminateAttribute()) {
    122             iBuilder->CreateCondBr(ready, segmentLoopBody, segmentWait);
     130            iBuilder->CreateCondBr(ready, segmentLoopBody, segmentYield);
    123131        } else { // If the kernel was terminated in a previous segment then the pipeline is done.
    124132            BasicBlock * completionTest = BasicBlock::Create(iBuilder->getContext(), kernel->getName() + "Completed", threadFunc, 0);
    125133            BasicBlock * exitBlock = BasicBlock::Create(iBuilder->getContext(), kernel->getName() + "Exit", threadFunc, 0);
    126             iBuilder->CreateCondBr(ready, completionTest, segmentWait);
     134            iBuilder->CreateCondBr(ready, completionTest, segmentYield);
    127135
    128136            iBuilder->SetInsertPoint(completionTest);
     
    134142            iBuilder->CreateBr(exitThreadBlock);
    135143        }
     144
     145//        if (UseYield) {
     146//            // Yield the thread after waiting
     147//            iBuilder->SetInsertPoint(segmentYield);
     148//            iBuilder->CreatePThreadYield();
     149//            iBuilder->CreateBr(segmentWait);
     150//        }
    136151
    137152        // Execute the kernel segment
     
    171186        if (codegen::EnableCycleCounter) {
    172187            cycleCountEnd = iBuilder->CreateReadCycleCounter();
    173             //Value * counterPtr = iBuilder->CreateGEP(mCycleCounts, {iBuilder->getInt32(0), iBuilder->getInt32(k)});
    174188            Value * counterPtr = iBuilder->getScalarFieldPtr(Kernel::CYCLECOUNT_SCALAR);
    175189            iBuilder->CreateStore(iBuilder->CreateAdd(iBuilder->CreateLoad(counterPtr), iBuilder->CreateSub(cycleCountEnd, cycleCountStart)), counterPtr);
Note: See TracChangeset for help on using the changeset viewer.