Changeset 6055


Ignore:
Timestamp:
May 21, 2018, 9:49:22 PM (4 weeks ago)
Author:
cameron
Message:

Various small fixes

Location:
icGREP/icgrep-devel/icgrep
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_avx_builder.cpp

    r6046 r6055  
    88#include <toolchain/toolchain.h>
    99#include <llvm/Support/raw_ostream.h>
     10#include <llvm/IR/Intrinsics.h>
    1011
    1112using namespace llvm;
     
    407408}
    408409
     410#if LLVM_VERSION_INTEGER >= LLVM_VERSION_CODE(3, 8, 0)
     411
    409412std::string IDISA_AVX512F_Builder::getBuilderUniqueName() {
    410413    return mBitBlockWidth != 512 ? "AVX512F_" + std::to_string(mBitBlockWidth) : "AVX512BW";
     
    728731    }
    729732}
    730 
    731 
    732 }
     733#endif
     734
     735
     736}
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_avx_builder.h

    r6045 r6055  
    88
    99#include <IR_Gen/idisa_sse_builder.h>
     10#include <toolchain/toolchain.h>
    1011
    1112namespace IDISA {
     
    5960};
    6061
     62#if LLVM_VERSION_INTEGER >= LLVM_VERSION_CODE(3, 8, 0)
    6163class IDISA_AVX512F_Builder : public IDISA_AVX2_Builder {
    6264public:
     
    98100    Features hostCPUFeatures;
    99101};
    100 
     102#endif
    101103
    102104}
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_sse_builder.cpp

    r6050 r6055  
    66
    77#include "idisa_sse_builder.h"
     8#include <llvm/IR/Intrinsics.h>
    89
    910using namespace llvm;
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_target.cpp

    r5975 r6055  
    5959    if (LLVM_LIKELY(codegen::BlockSize == 0)) {  // No BlockSize override: use processor SIMD width
    6060
     61#if LLVM_VERSION_INTEGER >= LLVM_VERSION_CODE(3, 8, 0)
    6162        if (hostCPUFeatures.hasAVX512F) codegen::BlockSize = 512;
    62         else if (hostCPUFeatures.hasAVX2) codegen::BlockSize = 256;
     63        else
     64#endif
     65        if (hostCPUFeatures.hasAVX2) codegen::BlockSize = 256;
    6366        else codegen::BlockSize = 128;
    6467    }
     
    6669        llvm::report_fatal_error("BlockSize must be a power of 2 and >=64");
    6770    }
     71#if LLVM_VERSION_INTEGER >= LLVM_VERSION_CODE(3, 8, 0)
    6872    if (codegen::BlockSize >= 512) {
    6973        // AVX512BW builder can only be used for BlockSize multiples of 512
     
    7276        }
    7377    }
     78#endif
    7479    if (codegen::BlockSize >= 256) {
    7580        // AVX2 or AVX builders can only be used for BlockSize multiples of 256
  • icGREP/icgrep-devel/icgrep/character_deposit.cpp

    r6047 r6055  
    3030#include <toolchain/cpudriver.h>
    3131#include <iostream>
     32#include <fstream>
    3233#include <kernels/deletion.h>
    3334#include <kernels/pdep_kernel.h>
     
    131132    // Deposit
    132133    StreamSetBuffer * depositedBits = pxDriver.addBuffer<DynamicBuffer>(iBuilder, iBuilder->getStreamSetTy(8), bufferBlocks, 1);
    133     Kernel * pdepK = pxDriver.addKernelInstance<BitStreamPDEPKernel>(iBuilder, 8);
    134     pxDriver.makeKernelCall(pdepK, {depositMarker, compressedBits}, {depositedBits});
     134    // Kernel * pdepK = pxDriver.addKernelInstance<BitStreamPDEPKernel>(iBuilder, 8);
     135    //pxDriver.makeKernelCall(pdepK, {depositMarker, compressedBits}, {depositedBits});
     136   
     137    StreamDepositCompiler depositCompiler(pxDriver, iBuilder->getStreamSetTy(8), bufferBlocks);
     138    depositCompiler.makeCall(depositMarker, compressedBits, depositedBits);
     139
    135140
    136141    return depositedBits;
  • icGREP/icgrep-devel/icgrep/kernels/bitstream_gather_pdep_kernel.cpp

    r6043 r6055  
    44#include <llvm/Support/raw_ostream.h>
    55#include <toolchain/toolchain.h>
     6#include <llvm/IR/Intrinsics.h>
    67
    78using namespace llvm;
     
    5152        std::vector<PHINode*> bufferVecPhiArray(mNumberOfStream / 4, NULL);
    5253        std::vector<Value*> bufferVecArray(mNumberOfStream / 4, NULL);
    53         for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
     54        for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
    5455            PHINode * const bufferPhi = b->CreatePHI(b->getBitBlockType(), 2, "bufferPhi");
    5556            bufferPhi->addIncoming(Constant::getNullValue(b->getBitBlockType()), entry);
     
    9798
    9899            std::vector<PHINode * > updatedBufferVecArray(mNumberOfStream / 4, NULL);
    99             for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
     100            for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
    100101                Value* buffer = bufferVecArray[iStreamSetIndex / 4];
    101102                PHINode * const updatedBuffer = b->CreatePHI(buffer->getType(), 2);
     
    111112
    112113
    113             for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
     114            for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
    114115                // gather instruction can process 4 streams each time
    115116                Value *streamSetBlockBasePtr = b->getInputStreamBlockPtr("source", b->getSize(iStreamSetIndex),
     
    165166            Value * const mask = b->CreateExtractElement(selectors, i);
    166167
    167             for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
     168            for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
    168169                Value * source_field = bufferVecArray[iStreamSetIndex / 4];
    169                 for (int iStreamIndex = iStreamSetIndex; iStreamIndex < iStreamSetIndex + 4; iStreamIndex++) {
     170                for (unsigned iStreamIndex = iStreamSetIndex; iStreamIndex < iStreamSetIndex + 4; iStreamIndex++) {
    170171                    Value * PDEP_field = b->CreateCall(pdep, {b->CreateExtractElement(source_field, iStreamIndex - iStreamSetIndex), mask});
    171172                    resultArray[iStreamIndex] = b->CreateInsertElement(resultArray[iStreamIndex], PDEP_field, i);
     
    177178        }
    178179
    179         for (int iStreamIndex = 0; iStreamIndex < mNumberOfStream; iStreamIndex++) {
     180        for (unsigned iStreamIndex = 0; iStreamIndex < mNumberOfStream; iStreamIndex++) {
    180181            // Store the result
    181182            Value * const outputStreamPtr = b->getOutputStreamBlockPtr("output", b->getSize(iStreamIndex), strideIndex);
     
    187188        bufferSizePhi->addIncoming(bufferSize, finishedBlock);
    188189
    189         for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
     190        for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStream; iStreamSetIndex += 4) {
    190191            bufferVecPhiArray[iStreamSetIndex / 4]->addIncoming(bufferVecArray[iStreamSetIndex / 4], finishedBlock);
    191192        }
  • icGREP/icgrep-devel/icgrep/kernels/bitstream_pdep_kernel.cpp

    r6043 r6055  
    88#include <llvm/Support/raw_ostream.h>
    99#include <toolchain/toolchain.h>
     10#include <llvm/IR/Intrinsics.h>
    1011
    1112using namespace llvm;
  • icGREP/icgrep-devel/icgrep/kernels/deletion.cpp

    r6047 r6055  
    1010#include <llvm/Support/raw_ostream.h>
    1111#include <IR_Gen/idisa_target.h>
     12#include <llvm/IR/Intrinsics.h>
    1213
    1314using namespace llvm;
  • icGREP/icgrep-devel/icgrep/kernels/lz4/lz4_bitstream_match_copy_kernel.cpp

    r6047 r6055  
    77#include <vector>
    88#include <llvm/Support/raw_ostream.h>
     9#include <llvm/IR/Intrinsics.h>
    910
    1011
     
    2425        Value* extractIndex = b->CreateURem(i64PackIndex, b->getSize(4));
    2526
    26         for (int i = 0; i < mNumberOfStreams; i++) {
     27        for (unsigned i = 0; i < mNumberOfStreams; i++) {
    2728            Value* bitBlockPtr =  b->CreateGEP(basePtr, b->CreateAdd(b->CreateMul(bitBlockIndex, b->getSize(mNumberOfStreams)), b->getSize(i)));
    2829            bitBlockPtr = b->CreatePointerCast(bitBlockPtr, b->getInt64Ty()->getPointerTo());
     
    189190                                                                                 carryCopyFromBlockIndex);
    190191
    191         for (int i = 0; i < mNumberOfStreams; i++) {
     192        for (unsigned i = 0; i < mNumberOfStreams; i++) {
    192193            Value* v = initSourceDataWithCarry[i];
    193194            v = b->CreateLShr(v, carryCopyFromOffset);
     
    210211
    211212        std::vector<PHINode*> outputData;
    212         for (int i = 0; i < mNumberOfStreams; i++) {
     213        for (unsigned i = 0; i < mNumberOfStreams; i++) {
    213214            PHINode* outputValue = b->CreatePHI(b->getInt64Ty(), 3);
    214215            outputValue->addIncoming(initSourceData[i], processLoopBody);
     
    285286
    286287        vector<Value*> pdepSourceData;
    287         for (int i = 0; i < mNumberOfStreams; i++) {
     288        for (unsigned i = 0; i < mNumberOfStreams; i++) {
    288289            Value* fromBlockValue = fromBlockValues[i];
    289290            // when dataBlockIndex == matchCopyFromBlockIndex, we need to use current output value as input
     
    345346        b->SetInsertPoint(doubleSourceDataExit);
    346347        // At this point, we can guarantee we have enough data for pdep
    347         for (int i = 0; i < mNumberOfStreams; i++) {
     348        for (unsigned i = 0; i < mNumberOfStreams; i++) {
    348349            // Do Match Copy by PDEP
    349350            Value* source_field = phiPdepSourceData[i];
     
    391392        Value* extractIndex = b->CreateURem(i64PackIndex, b->getSize(4));
    392393
    393         for (int i = 0; i < mNumberOfStreams; i++) {
     394        for (unsigned i = 0; i < mNumberOfStreams; i++) {
    394395            Value* bitBlockPtr =  b->CreateGEP(basePtr, b->CreateAdd(b->CreateMul(bitBlockIndex, b->getSize(mNumberOfStreams)), b->getSize(i)));
    395396            bitBlockPtr = b->CreatePointerCast(bitBlockPtr, b->getInt64Ty()->getPointerTo());
  • icGREP/icgrep-devel/icgrep/kernels/lz4/lz4_swizzled_match_copy_kernel.cpp

    r6047 r6055  
    77#include <vector>
    88#include <llvm/Support/raw_ostream.h>
     9#include <llvm/IR/Intrinsics.h>
    910
    1011
  • icGREP/icgrep-devel/icgrep/kernels/pdep_kernel.cpp

    r6047 r6055  
    1010#include <toolchain/cpudriver.h>
    1111#include <IR_Gen/idisa_target.h>
     12#include <llvm/IR/Intrinsics.h>
    1213#include <llvm/IR/Module.h>
    1314
  • icGREP/icgrep-devel/icgrep/kernels/swizzled_multiple_pdep_kernel.cpp

    r6041 r6055  
    77#include <kernels/kernel_builder.h>
    88#include <toolchain/toolchain.h>
     9#include <llvm/IR/Intrinsics.h>
    910
    1011using namespace llvm;
     
    2122{}, {}, {})
    2223, mSwizzleFactor(swizzleFactor), mNumberOfStreamSet(numberOfStreamSet) {
    23     for (int i = 1; i < numberOfStreamSet; i++) {
     24    for (unsigned i = 1; i < numberOfStreamSet; i++) {
    2425        mStreamSetInputs.push_back(Binding{b->getStreamSetTy(swizzleFactor), "source" + std::to_string(i), RateEqualTo("source0"), BlockSize(b->getBitBlockWidth() / swizzleFactor) });
    2526        mStreamSetOutputs.push_back(Binding{b->getStreamSetTy(swizzleFactor), "output" + std::to_string(i), RateEqualTo("output0"), BlockSize(b->getBitBlockWidth() / swizzleFactor)});
     
    5657    std::vector<PHINode*> bufferPhiArray(mNumberOfStreamSet, NULL);
    5758    std::vector<Value*> bufferArray(mNumberOfStreamSet, NULL);
    58     for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
     59    for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
    5960        PHINode * const bufferPhi = b->CreatePHI(b->getBitBlockType(), 2);
    6061        bufferPhi->addIncoming(Constant::getNullValue(b->getBitBlockType()), entry);
     
    9495
    9596        std::vector<PHINode * > updatedBufferArray(mNumberOfStreamSet, NULL);
    96         for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
     97        for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
    9798            Value* buffer = bufferArray[iStreamSetIndex];
    9899            PHINode * const updatedBuffer = b->CreatePHI(buffer->getType(), 2);
     
    107108        Value * const swizzleOffset = b->CreateURem(updatedSourceOffset, PDEP_WIDTH);
    108109
    109         for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
     110        for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
    110111            Value * const swizzle = b->CreateBlockAlignedLoad(b->getInputStreamBlockPtr("source" + std::to_string(iStreamSetIndex), swizzleIndex, blockOffset));
    111112
     
    143144        Value * const mask = b->CreateExtractElement(selectors, i);
    144145        Value * const usedShift = b->simd_fill(pdepWidth, required);
    145         for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
     146        for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
    146147            Value* result = b->simd_pdep(pdepWidth, bufferArray[iStreamSetIndex], b->simd_fill(pdepWidth, mask));
    147148            // Store the result
     
    159160    sourceOffsetPhi->addIncoming(sourceOffset, finishedBlock);
    160161    bufferSizePhi->addIncoming(bufferSize, finishedBlock);
    161     for (int iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
     162    for (unsigned iStreamSetIndex = 0; iStreamSetIndex < mNumberOfStreamSet; iStreamSetIndex++) {
    162163        bufferPhiArray[iStreamSetIndex]->addIncoming(bufferArray[iStreamSetIndex], finishedBlock);
    163164    }
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r5992 r6055  
    3636#include <llvm/IR/Type.h>
    3737#include <llvm/Support/raw_os_ostream.h>
     38#include <llvm/ADT/STLExtras.h> // for make_unique
    3839
    3940using namespace llvm;
Note: See TracChangeset for help on using the changeset viewer.