diff --git a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/test_ops.cc b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/test_ops.cc index c0952440da74b420f4069c9523da5b677d4da037..fc8b1aa755068832b4b92c393bfa7dc413a7f107 100644 --- a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/test_ops.cc +++ b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/test_ops.cc @@ -546,11 +546,11 @@ void testPerforation(){ //printTensorValues(input); - void* res = tensorConvPerfCuda(input, filter, 0, 0, 1, 1, 1, 1, 2, 1, 0); + void* res = tensorConvPerfCuda(input, filter, 0, 0, 1, 1, 1, 1, 2, 1, 1); printTensorValues(res); - void* res2 = tensorConvApproxHalf2(input, filter, 0, 0, 1, 1, 1, 1, 2, 1, 1, 0); + void* res2 = tensorConvApproxHalf2(input, filter, 0, 0, 1, 1, 1, 1, 2, 1, 1, 1); //void* res2 = tensorConvPerfCuda(input, filter, 0, 0, 1, 1, 1, 1, 2, 1, 0); @@ -559,22 +559,67 @@ void testPerforation(){ printTensorValues(res2); - void* res3 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 3, 1, 1, 0); + void* res3 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 2, 1, 1, 1); printTensorValues(res3); - //void* res4 = tensorConvPerfSim(input, filter, 0, 0, 1, 1, 1, 1, 2, 1); + //void* res4 = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0); + + //printTensorValues(res4); - //printTensorValues(res4); } -void testSampling(){ + +void testPerforation2(){ printf("***** Testing Perforation ***** \n\n"); + Tensor* input = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 1, 1, 8, 8); + fillTensorWithVal(input, 3); + //fillWithOnesAndTwos(input); + + Tensor* filter = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 1, 1, 3, 3); + fillTensorWithVal(filter, 2); + + float* host_ptr = (float*) ((struct Tensor*) input)->host_data; + host_ptr[16] = 0; + host_ptr[17] = 0; + host_ptr[18] = 0; + host_ptr[19] = 0; + host_ptr[20] = 0; + host_ptr[21] = 0; + host_ptr[22] = 0; + host_ptr[23] = 0; + + + host_ptr[56] = 0; + host_ptr[57] = 0; + host_ptr[58] = 0; + host_ptr[59] = 0; + host_ptr[60] = 0; + host_ptr[61] = 0; + host_ptr[62] = 0; + host_ptr[63] = 0; + + + void* res2 = tensorConvApproxHalf2(input, filter, 0, 0, 1, 1, 1, 1, 4, 1, 1, 1); + + convertToFP32((struct Tensor*) res2); + + printTensorValues(res2); + +} + + + + + +void testSampling(){ + + printf("***** Testing Sampling ***** \n\n"); Tensor* input = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 1, 3, 4, 4); fillTensorWithVal(input, 1); //fillWithOnesAndTwos(input); @@ -599,6 +644,28 @@ void testSampling(){ +void testSampling2(){ + + printf("***** TestingSampling2 ***** \n\n"); + Tensor* input = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 1, 3, 2, 2); + fillTensorWithVal(input, 2); + //fillWithOnesAndTwos(input); + + Tensor* filter = (Tensor*) create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 4, 3, 1, 1); + fillTensorWithVal(filter, 2); + + // Interpolation not being applied most likely + void* res = tensorConvApprox(input, filter, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1); + + printTensorValues(res); + +} + + + + + + @@ -631,11 +698,17 @@ int main(){ //testSampleFilter(); - //--- testPerforation(); + //testPerforation(); + + + // testPerforation2(); - testSampling(); + //-- testSampling(); + + testSampling2(); + stopProfiling();