Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make error for dsa-<source-name>.bc #1

Open
ajis01 opened this issue Feb 25, 2021 · 0 comments
Open

Make error for dsa-<source-name>.bc #1

ajis01 opened this issue Feb 25, 2021 · 0 comments

Comments

@ajis01
Copy link

ajis01 commented Feb 25, 2021

SBCONFIG=/root/ajis01/framework/dsa-framework/spatial.json
opt -load /root/ajis01/framework/dsa-framework/dsa-llvm-project/build/lib/DSAPass.so
-stream-specialize accumulate_try.bc -o dsa-accumulate_try.bc
Segmentation fault
[Warning] To hide the latency -1, 8 elements are active
This requires a 9-deep FIFO buffer
[CHECK FAIL] /root/ajis01/framework/dsa-framework/spatial-scheduler/src/insts/ssinst.cpp:2442: false Unknown inst
terminate called without an active exception
Aborted
Both operands to a binary operator are not of the same type!
%48 = add i32 %47, i64 1
Both operands to a binary operator are not of the same type!
%49 = sub i32 %48, i64 1
Both operands to a binary operator are not of the same type!
%50 = sdiv i32 %49, i64 8
Both operands to a binary operator are not of the same type!
%51 = add i32 %50, i64 1
Both operands to a binary operator are not of the same type!
%52 = mul i32 %51, i64 1
in function _Z15accumulate_cgraPKfiiiiPfiiii
LLVM ERROR: Broken function found, compilation aborted!
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: opt -load /root/ajis01/framework/dsa-framework/dsa-llvm-project/build/lib/DSAPass.so -stream-specialize accumulate_try.bc -o dsa-accumulate_try.bc

  1. Running pass 'Function Pass Manager' on module 'accumulate_try.bc'.
  2. Running pass 'Module Verifier' on function '@_Z15accumulate_cgraPKfiiiiPfiiii'
    #0 0x00007fc56c1a4e1c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMSupport.so.12git+0x1a1e1c)
    Make error for dsa-<source-name>.bc #1 0x00007fc56c1a2c74 llvm::sys::RunSignalHandlers() (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMSupport.so.12git+0x19fc74)
    #2 0x00007fc56c1a2dc3 SignalHandler(int) (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMSupport.so.12git+0x19fdc3)
    #3 0x00007fc56b8c8040 (/lib/x86_64-linux-gnu/libc.so.6+0x3f040)
    #4 0x00007fc56b8c7fb7 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3efb7)
    #5 0x00007fc56b8c9921 abort (/lib/x86_64-linux-gnu/libc.so.6+0x40921)
    #6 0x00007fc56c0d85c6 llvm::report_fatal_error(llvm::Twine const&, bool) (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMSupport.so.12git+0xd55c6)
    #7 0x00007fc56c0d86f8 (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMSupport.so.12git+0xd56f8)
    #8 0x00007fc56c65d2ff (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMCore.so.12git+0x2662ff)
    #9 0x00007fc56c5d6c27 llvm::FPPassManager::runOnFunction(llvm::Function&) (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMCore.so.12git+0x1dfc27)
    #10 0x00007fc56c5d7341 llvm::FPPassManager::runOnModule(llvm::Module&) (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMCore.so.12git+0x1e0341)
    #11 0x00007fc56c5d5f9f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/root/ajis01/framework/dsa-framework/ss-tools/lib/libLLVMCore.so.12git+0x1def9f)
    #12 0x0000560276291f14 main (/root/ajis01/framework/dsa-framework/ss-tools/bin/opt+0x1ef14)
    #13 0x00007fc56b8aabf7 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf7)
    #14 0x00005602762927ba _start (/root/ajis01/framework/dsa-framework/ss-tools/bin/opt+0x1f7ba)
    Aborted
    ../../common/Makefile.compile:26: recipe for target 'dsa-accumulate_try.bc' failed
    make: *** [dsa-accumulate_try.bc] Error 134

For the following source code
`

#include "sim_timing.h"
#include "string.h"
#include "errno.h"
#include "assert.h"
#include
#include
#include
//#include <opencv2/highgui.hpp>
//#include<opencv2/imgproc.hpp>

#define TYPE float
#define CACHE_WARMUP 1
#undef N

//Algorithm Parameters
#define row_size 585
//#define col_size 1024
#define col_size 1087
//#define row_size 16
//#define col_size 33
#define N row_sizecol_size
#define NN N
N
#define C 1
#define block_size 8
#define NUMOFBLOCKS N/block_size/block_size

#ifndef U
#define U 8
#endif

void bbgemm(TYPE m1[N], TYPE m2[N], TYPE prod[N]){
#pragma ss config
{
int i, k, j, jj, kk;
int i_row, k_row;
TYPE temp_x, mul;

for (jj = 0; jj < row_size; jj += block_size){
    //for (kk = 0; kk < row_size; kk += block_size){
        for ( i = 0; i < row_size; ++i){
		#pragma ss stream nonblock
            for (k = 0; k < row_size; ++k){
                i_row = i * row_size;
                //k_row = (k  + kk) * row_size;
                kk = 0;
                temp_x = m1[i_row + k + kk];
                #pragma ss dfg dedicated unroll(U)
                for (j = 0; j < block_size; ++j){
                    mul = temp_x * m2[k_row + j + jj];
                    prod[i_row + j + jj] += mul;
                }
            }
        }
    //}
}

}
}

void accumulate_cgra(TYPE const* src, int srcRows, int srcCols, int srcStep, int srcChannels,
TYPE* dest, int destRows, int destCols, int destStep, int destChannels){
assert(srcRows == destRows && srcCols == destCols && srcStep == destStep && srcChannels==destChannels);

#pragma ss config
{
int jj, i, j, k;
TYPE temp1, temp2;
int rows = srcRows; 
int cols = srcCols; 
int channels = srcChannels;
    for(jj=0; jj<cols; jj+=block_size){
        for(i=0; i<rows; ++i){
	int residue = std::min(jj+block_size,cols);
            #pragma ss stream nonblock
        #pragma ss dfg dedicated unroll(U)
            for(j=jj; j<residue; ++j){
                for(k=0; k<channels; ++k){
                temp1 = dest[i*cols + j*channels + k];
	        temp2 = src[i*cols + j*channels + k];
	        temp1 += temp2;
	        dest[i*cols + j*channels + k] = temp1;
                }
            }
        }
    }
}

}

void accumulate(TYPE src[N], int srcRows, int srcCols,
TYPE dest[N], int destRows, int destCols){

assert(srcRows == destRows && srcCols == destCols);
#pragma ss config
{
int jj, i, j;
TYPE temp1, temp2;
int rows = srcRows; 
int cols = srcCols; 
    for(jj=0; jj<cols; jj+=block_size){
        for(i=0; i<rows; ++i){
	int residue = std::min(jj+block_size,cols);
            #pragma ss stream nonblock
        //#pragma ss dfg dedicated unroll(U)
            for(j=jj; j<residue; ++j){
            temp1 = dest[i*cols + j];
	    temp2 = src[i*cols + j];
	    temp1 += temp2;
	    dest[i*cols + j] = temp1;
            }
        }
    }
}

}

//TYPE a[N], b[N], c[N];
TYPE* src, *dest;

int main() {
srand (static_cast (time(0)));
src = (TYPE*) malloc(sizeof(TYPE)row_sizecol_sizeC);
if(!src){
fprintf(stderr, "ERROR: Could not malloc src, %s", strerror(errno));
}
dest = (TYPE
) malloc(sizeof(TYPE)row_sizecol_size*C);
if(!dest){
fprintf(stderr, "ERROR: Could not malloc dest, %s", strerror(errno));
}

for(int i=0; i<row_size; ++i){
for(int j=0; j<col_size; ++j){
for(int k=0; k<C; ++k){
src[icol_size + jC + k] = static_cast (rand()) / static_cast (RAND_MAX);;
}
}
}

//cache warmup
for(int i=0;i<CACHE_WARMUP;++i)
accumulate_cgra(src, row_size, col_size, col_size, C, dest, row_size, col_size, col_size, C);

begin_roi();
accumulate_cgra(src, row_size, col_size, col_size, C, dest, row_size, col_size, col_size, C);
//bbgemm(a,b,c);
end_roi();
sb_stats();
free(src);
free(dest);
return 0;
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant