Ignore:
Timestamp:
Mar 24, 2016, 4:28:31 PM (3 years ago)
Author:
cameron
Message:

casefold sample application/pipeline

File:
1 edited

Legend:

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

    r4987 r4988  
    1212}
    1313
    14 inline void p2s(IDISA::IDISA_Builder * iBuilder, Value * p[], Value * output) {
     14inline void p2s(IDISA::IDISA_Builder * iBuilder, Value * p[], Value * s[]) {
    1515    Value * bit00004444[2];
    1616    Value * bit22226666[2];
     
    2828        p2s_step(iBuilder, bit11115555[j], bit33337777[j],iBuilder->simd_himask(4), 2, bit11335577[2*j+1], bit11335577[2*j]);
    2929    }
    30     Value * s[8];
    3130    for (unsigned j = 0; j<4; j++) {
    3231        p2s_step(iBuilder, bit00224466[j], bit11335577[j], iBuilder->simd_himask(2), 1, s[2*j+1], s[2*j]);
    3332    }
    34     for (unsigned j = 0; j < 8; ++j) {
    35         iBuilder->CreateBlockAlignedStore(s[j], output, {iBuilder->getInt32(j)});
    36     }
    3733}
    3834               
    39 void generateP2SKernel(Module *, IDISA::IDISA_Builder * iBuilder, KernelBuilder * kBuilder) {
     35void generateP2SKernel(Module * m, IDISA::IDISA_Builder * iBuilder, KernelBuilder * kBuilder) {
    4036    for (unsigned i = 0; i < 8; ++i) {
    4137        kBuilder->addInputStream(1);
     
    4440    kBuilder->prepareFunction();
    4541    Value * input[8];
    46     Value * output = kBuilder->getOutputStream(0);
    4742    for (unsigned j = 0; j < 8; ++j) {
    4843        input[j] = iBuilder->CreateBlockAlignedLoad(kBuilder->getInputStream(j));
    4944    }
     45    Value * output[8];
    5046    p2s(iBuilder, input, output);
     47    Value * output_ptr = kBuilder->getOutputStream(0);
     48    for (unsigned j = 0; j < 8; ++j) {
     49
     50        iBuilder->CreateBlockAlignedStore(output[j], iBuilder->CreateGEP(output_ptr, std::vector<Value *>({ iBuilder->getInt32(0), iBuilder->getInt32(j) })));
     51    }
    5152    kBuilder->finalize();
     53    m->dump();
    5254}
    5355
Note: See TracChangeset for help on using the changeset viewer.