Skip to content
Snippets Groups Projects
Commit 22504c76 authored by Yifan Zhao's avatar Yifan Zhao
Browse files

Fixed up signatures on compiler side

parent 214ed0c6
No related branches found
No related tags found
No related merge requests found
......@@ -324,26 +324,34 @@ let TargetPrefix = "visc" in {
llvm_i32_ty,
llvm_i32_ty,
llvm_i32_ty], []>;
// Image processing functions
// See projects/hpvm-tensor-rt/tensor_runtime/include/img_tensor_runtime.h
def int_visc_tensor_fft: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty
], []>;
def int_visc_tensor_cosineT: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty
], []>;
def int_visc_tensor_reduce: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty, llvm_i32_ty, llvm_ptrptr_ty, llvm_i32_ty
llvm_ptr_ty, llvm_i32_ty, llvm_ptr_ty
], []>;
def int_visc_tensor_projectiveT: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty, llvm_ptr_ty
], []>;
def int_visc_tensor_map1: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty, llvm_ptrptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty
llvm_ptr_ty, llvm_ptr_ty
], []>;
def int_visc_tensor_map2: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty, llvm_ptr_ty, llvm_ptrptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty
], []>;
def int_visc_tensor_map3: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_ptrptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty
], []>;
// Tentative functions without an impl yet
def int_visc_tensor_cosineT: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty
], []>;
def int_visc_tensor_stencil: Intrinsic<[llvm_ptr_ty], [
llvm_ptr_ty
], []>;
}
......@@ -1185,37 +1185,42 @@ errs() << "TensorII: " << *TensorII << "\n";
break;
case Intrinsic::visc_tensor_fft:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorFFT", strRef, 1);
}
break;
case Intrinsic::visc_tensor_cosineT:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensor_cosineT", strRef, 1);
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorFft", strRef, 1);
}
break;
case Intrinsic::visc_tensor_reduce:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensor_reduce", strRef, 4);
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorReduce", strRef, 3);
}
break;
case Intrinsic::visc_tensor_projectiveT:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensor_projectiveT", strRef, 2);
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorProjectiveT", strRef, 2);
}
break;
case Intrinsic::visc_tensor_map1:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensor_map1", strRef, 5);
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorMap1", strRef, 2);
}
break;
case Intrinsic::visc_tensor_map2:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensor_map2", strRef, 6);
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorMap2", strRef, 3);
}
break;
case Intrinsic::visc_tensor_map3:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensor_map3", strRef, 7);
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorMap3", strRef, 4);
}
break;
case Intrinsic::visc_tensor_cosineT:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorCosineT", strRef, 1);
}
break;
case Intrinsic::visc_tensor_stencil:
{
codeGenCommonRoutine(M, RtM, F, TensorII, Args, "wrapper_tensorStencil", strRef, 1);
}
break;
/*
......
......@@ -179,12 +179,14 @@ IS_VISC_CALL(tensor_sigmoid)
IS_VISC_CALL(tensor_softmax)
// Image processing tensor operators
IS_VISC_CALL(tensor_fft)
IS_VISC_CALL(tensor_cosineT)
IS_VISC_CALL(tensor_reduce)
IS_VISC_CALL(tensor_projectiveT)
IS_VISC_CALL(tensor_map1)
IS_VISC_CALL(tensor_map2)
IS_VISC_CALL(tensor_map3)
// Image processing tensor operators (tentative)
IS_VISC_CALL(tensor_cosineT)
IS_VISC_CALL(tensor_stencil)
// Return the constant integer represented by value V
static unsigned getNumericValue(Value* V) {
......@@ -1319,9 +1321,6 @@ bool GenVISC::runOnModule(Module &M) {
if (isVISCCall_tensor_fft(I)) {
ReplaceCallWithIntrinsic(I, Intrinsic::visc_tensor_fft, &toBeErased);
}
if (isVISCCall_tensor_cosineT(I)) {
ReplaceCallWithIntrinsic(I, Intrinsic::visc_tensor_cosineT, &toBeErased);
}
if (isVISCCall_tensor_reduce(I)) {
ReplaceCallWithIntrinsic(I, Intrinsic::visc_tensor_reduce, &toBeErased);
}
......@@ -1337,6 +1336,12 @@ bool GenVISC::runOnModule(Module &M) {
if (isVISCCall_tensor_map3(I)) {
ReplaceCallWithIntrinsic(I, Intrinsic::visc_tensor_map3, &toBeErased);
}
if (isVISCCall_tensor_cosineT(I)) {
ReplaceCallWithIntrinsic(I, Intrinsic::visc_tensor_cosineT, &toBeErased);
}
if (isVISCCall_tensor_stencil(I)) {
ReplaceCallWithIntrinsic(I, Intrinsic::visc_tensor_stencil, &toBeErased);
}
}
// Erase the __visc__node calls
......
......@@ -104,12 +104,13 @@ void* __visc__tensor_tanh(void*);
void* __visc__tensor_softmax(void*);
// Tensor ops for image processing
void* __visc__tensor_fft(void*);
void* __visc__tensor_cosineT(void*);
void* __visc__tensor_reduce(void*, int, void**, int);
void* __visc__tensor_reduce(void*, int, void*);
void* __visc__tensor_projectiveT(void*, void*);
void* __visc__tensor_map1(void*, void**, int, int, int);
void* __visc__tensor_map2(void*, void*, void**, int, int, int);
void* __visc__tensor_map3(void*, void*, void*, void**, int, int, int);
void* __visc__tensor_map1(void*, void*);
void* __visc__tensor_map2(void*, void*, void*);
void* __visc__tensor_map3(void*, void*, void*, void*);
void* __visc__tensor_cosineT(void*);
void* __visc__tensor_stencil(void*);
#include <unistd.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment