Changeset 5251


Ignore:
Timestamp:
Jan 8, 2017, 7:58:02 PM (9 months ago)
Author:
cameron
Message:

Stream set buffer maps

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

Legend:

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

    r5247 r5251  
    3737     
    3838     */
     39   
     40    std::string getName() { return mKernelName;}
    3941       
    4042    std::vector<Binding> getStreamInputs() {return mStreamSetInputs;}
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5250 r5251  
    7272
    7373    virtual ~KernelBuilder() = 0;
     74   
     75    std::vector<StreamSetBuffer *> getStreamSetInputBuffers() {return mStreamSetInputBuffers;}
     76    std::vector<StreamSetBuffer *> getStreamSetOutputBuffers() {return mStreamSetOutputBuffers;}
     77
    7478
    7579protected:
  • icGREP/icgrep-devel/icgrep/kernels/pipeline.cpp

    r5242 r5251  
    1111#include <kernels/s2p_kernel.h>
    1212#include <iostream>
     13#include <unordered_map>
    1314
    1415using namespace kernel;
     16
     17using BufferMap = std::unordered_map<StreamSetBuffer *, std::pair<KernelBuilder *, unsigned>>;
     18
     19
     20static void createStreamBufferMap(BufferMap bufferMap, std::vector<KernelBuilder *> kernels) {
     21    for (auto k: kernels) {
     22        auto outputSets = k->getStreamSetOutputBuffers();
     23        for (unsigned i = 0; i < outputSets.size(); i++) {
     24            bufferMap.insert(std::make_pair(outputSets[i], std::make_pair(k, i)));
     25        }
     26    }
     27    for (auto k: kernels) {
     28        auto inputSets = k->getStreamSetInputBuffers();
     29        for (unsigned i = 0; i < inputSets.size(); i++) {
     30            if (bufferMap.find(inputSets[i]) == bufferMap.end()) {
     31                llvm::report_fatal_error("Pipeline error: input buffer #" + std::to_string(i) + " of " + k->getName() + ": no corresponding output buffer. ");
     32            }
     33        }
     34    }
     35}
     36
    1537
    1638Function * generateSegmentParallelPipelineThreadFunction(std::string name, IDISA::IDISA_Builder * iBuilder, std::vector<KernelBuilder *> kernels, Type * sharedStructType, int id) {
     
    88110    return threadFunc;
    89111}
     112
     113// Given a computation expressed as a logical pipeline of K kernels k0, k_1, ...k_(K-1)
     114// operating over an input stream set S, a segment-parallel implementation divides the input
     115// into segments and coordinates a set of T <= K threads to each process one segment at a time.   
     116// Let S_0, S_1, ... S_N be the segments of S.   Segments are assigned to threads in a round-robin
     117// fashion such that processing of segment S_i by the full pipeline is carried out by thread i mod T.
     118
    90119
    91120void generateSegmentParallelPipeline(IDISA::IDISA_Builder * iBuilder, std::vector<KernelBuilder *> kernels) {
Note: See TracChangeset for help on using the changeset viewer.