Ignore:
Timestamp:
Jan 17, 2017, 12:00:43 PM (2 years ago)
Author:
cameron
Message:

New doSegment partial progress

File:
1 edited

Legend:

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

    r5260 r5263  
    8282
    8383    // Create the doSegment function prototype.
    84     std::vector<Type *> doSegmentParameters = {selfType, iBuilder->getSizeTy()};
     84    std::vector<Type *> doSegmentParameters = {selfType, iBuilder->getInt1Ty()};
     85    for (auto ss : mStreamSetInputs) {
     86        doSegmentParameters.push_back(iBuilder->getSizeTy());
     87    }
    8588    FunctionType * doSegmentFunctionType = FunctionType::get(iBuilder->getVoidTy(), doSegmentParameters, false);
    8689    std::string doSegmentName = mKernelName + doSegment_suffix;
     
    9295    arg->setName("self");
    9396    arg = &*(args++);
    94     arg->setName("blockCnt");
     97    arg->setName("doFinal");
     98    for (auto ss : mStreamSetInputs) {
     99        arg = &*(args++);
     100        arg->setName(ss.name + "_availableItems");
     101    }
    95102    doSegmentFn->setDoesNotCapture(1); // for self parameter only.
    96     //
    97     // Create the finalSegment function prototype.
    98     std::vector<Type *> finalSegmentParameters = {selfType, iBuilder->getSizeTy()};
    99     FunctionType * finalSegmentFunctionType = FunctionType::get(iBuilder->getVoidTy(), finalSegmentParameters, false);
    100     std::string finalSegmentName = mKernelName + finalSegment_suffix;
    101     Function * finalSegmentFn = Function::Create(finalSegmentFunctionType, GlobalValue::ExternalLinkage, finalSegmentName, client);
    102     finalSegmentFn->setCallingConv(CallingConv::C);
    103     finalSegmentFn->setDoesNotThrow();
    104     Function::arg_iterator finalSegmentArgs = finalSegmentFn->arg_begin();
    105     Value * finalSegmentArg = &*(finalSegmentArgs++);
    106     finalSegmentArg->setName("self");
    107     finalSegmentArg = &*(finalSegmentArgs++);
    108     finalSegmentArg->setName("blockCnt");
    109     finalSegmentFn->setDoesNotCapture(1); // for self parameter only.
    110103    iBuilder->setModule(saveModule);
    111104    iBuilder->restoreIP(savePoint);
     
    139132
    140133
    141 Value * KernelInterface::createDoSegmentCall(Value * self, Value * blksToDo) const {
     134Value * KernelInterface::createDoSegmentCall(std::vector<Value *> args) const {
    142135    Module * m = iBuilder->getModule();
    143136    std::string fnName = mKernelName + doSegment_suffix;
     
    146139        throw std::runtime_error("Cannot find " + fnName);
    147140    }
    148     return iBuilder->CreateCall(method, {self, blksToDo});
    149 }
    150 
    151 Value * KernelInterface::createFinalSegmentCall(Value * self, Value * blksToDo) const {
    152     Module * m = iBuilder->getModule();
    153     std::string fnName = mKernelName + finalSegment_suffix;
    154     Function * method = m->getFunction(fnName);
    155     if (!method) {
    156         throw std::runtime_error("Cannot find " + fnName);
    157     }
    158     return iBuilder->CreateCall(method, {self, blksToDo});
     141    return iBuilder->CreateCall(method, args);
    159142}
    160143
Note: See TracChangeset for help on using the changeset viewer.