Changeset 4950


Ignore:
Timestamp:
Mar 3, 2016, 7:03:27 AM (3 years ago)
Author:
cameron
Message:

Removing compile-time BLOCK_SIZE

File:
1 edited

Legend:

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

    r4946 r4950  
    5050#include <re/printer_re.h>
    5151#include <pablo/printer_pablos.h>
     52// Dynamic processor detection
     53#define ISPC_LLVM_VERSION ISPC_LLVM_3_6
     54#include "ispc.cpp"
    5255
    5356using namespace pablo;
     
    202205}
    203206
    204 // Dynamic AVX2 confirmation
    205 #if (BLOCK_SIZE == 256)
    206 #define ISPC_LLVM_VERSION ISPC_LLVM_3_6
    207 #include "ispc.cpp"
    208 #endif
    209 
    210207
    211208IDISA::IDISA_Builder * GetNativeIDISA_Builder(Module * mod, Type * bitBlockType) {
    212209
    213 #if (BLOCK_SIZE == 256)
    214     if ((strncmp(lGetSystemISA(), "avx2", 4) == 0)) {
    215         return new IDISA::IDISA_AVX2_Builder(mod, bitBlockType);
    216         //std::cerr << "IDISA_AVX2_Builder selected\n";
    217     }
    218     else{
    219         return new IDISA::IDISA_SSE2_Builder(mod, bitBlockType);
    220         //std::cerr << "Generic IDISA_Builder selected\n";
    221     }
    222 #elif (BLOCK_SIZE == 64)
    223     return new IDISA::IDISA_I64_Builder(mod, bitBlockType);
    224 #else   
     210    int blockSize = bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth();
     211    if (blockSize == 256) {
     212        if ((strncmp(lGetSystemISA(), "avx2", 4) == 0)) {
     213            return new IDISA::IDISA_AVX2_Builder(mod, bitBlockType);
     214        }
     215        else{
     216            return new IDISA::IDISA_SSE2_Builder(mod, bitBlockType);
     217        }
     218    }
     219    else if (blockSize == 64)
     220        return new IDISA::IDISA_I64_Builder(mod, bitBlockType); 
    225221    return new IDISA::IDISA_SSE2_Builder(mod, bitBlockType);
    226 #endif
    227222}
    228223
     
    241236    builder.setOptLevel(CodeGenOpt::Level::None);
    242237
    243 #if (BLOCK_SIZE == 256)
    244238    if (!DisableAVX2 && (strncmp(lGetSystemISA(), "avx2", 4) == 0)) {
    245239            std::vector<std::string> attrs;
    246240            attrs.push_back("avx2");
    247241            builder.setMAttrs(attrs);
    248     //std::cerr << "+avx2 set" << std::endl;
    249     }
    250 #endif
     242    }
     243
    251244    //builder.setOptLevel(mMaxWhileDepth ? CodeGenOpt::Level::Less : CodeGenOpt::Level::None);
    252245    ExecutionEngine * engine = builder.create();
Note: See TracChangeset for help on using the changeset viewer.