Beispiel #1
0
void fuser(bh_ir &bhir, FuseCache &cache)
{
    if(bhir.kernel_list.size() != 0)
        throw logic_error("The kernel_list is not empty!");

    BatchHash batch(bhir.instr_list);
    if(not cache.lookup(batch, bhir, bhir.kernel_list))
    {
        do_fusion(bhir);
        cache.insert(batch, bhir.kernel_list);
    }
}
Beispiel #2
0
    // All fusers checks the cache before doing fusion
    // If cache miss, we call the do_fuction() function, which anyone
    // inherent from this class should implement
    virtual void execute(bh_ir *bhir) {

        if(bhir->kernel_list.size() != 0)
            throw std::logic_error("The kernel_list is not empty!");

        if(_cache.enabled) {
            BatchHash hash(bhir->instr_list);
            if(not _cache.lookup(hash, *bhir, bhir->kernel_list)) {//Fuse cache miss!
                do_fusion(*bhir);
                _cache.insert(hash, bhir->kernel_list);
            }
        } else {
            do_fusion(*bhir);
        }
        child.execute(bhir);
    }