diff --git a/src/fpga/common/fpga_common.cpp b/src/fpga/common/fpga_common.cpp index ad238c51efb33cc1d3a35bc9d6bc1dc2dcec75dd..06b0b365bdde87cd9940315382572533987b263c 100644 --- a/src/fpga/common/fpga_common.cpp +++ b/src/fpga/common/fpga_common.cpp @@ -197,5 +197,17 @@ uint64_t vaddr_to_paddr(void *address) { return 0; #endif } + +uint32_t paddle_mobile_version() { + uint32_t v_master = 34; + uint32_t v_slave = 34; + + uint32_t first = 1, second = 2, fourth_master = 1, fourth_slave = 2; + uint32_t master = first << 24 | second << 16 | v_master << 8 | fourth_master; + uint32_t slave = first << 24 | second << 16 | v_slave << 8 | fourth_slave; + + return slave; +} + } // namespace fpga } // namespace paddle_mobile diff --git a/src/fpga/common/fpga_common.h b/src/fpga/common/fpga_common.h index fc3ca28cc95df503756d722142abf70ad5108308..bc882bed5e79428294b104b96c5225beaf1a7a90 100644 --- a/src/fpga/common/fpga_common.h +++ b/src/fpga/common/fpga_common.h @@ -30,6 +30,7 @@ limitations under the License. */ namespace paddle_mobile { namespace fpga { + enum DataType { DATA_TYPE_INT8 = 2, DATA_TYPE_FP32 = 1, @@ -275,5 +276,8 @@ uint64_t vaddr_to_paddr(void* address); void expand_conv_arg(ConvArgs* arg); void expand_EW_arg(EWAddArgs* arg); inline int32_t convertmantissa(int32_t i); + +uint32_t paddle_mobile_version(); + } // namespace fpga } // namespace paddle_mobile diff --git a/src/io/paddle_inference_api.h b/src/io/paddle_inference_api.h index 36435e07e6bad84527b58c0216cc12df557a8ab7..e8c2c1daaa7bb41ccb7da0a969d941e0131249ab 100644 --- a/src/io/paddle_inference_api.h +++ b/src/io/paddle_inference_api.h @@ -30,10 +30,12 @@ limitations under the License. */ namespace paddle_mobile { #ifdef PADDLE_MOBILE_FPGA + namespace fpga { int open_device(); void* fpga_malloc(size_t size); void fpga_free(void* ptr); +uint32_t paddle_mobile_version(); } // namespace fpga #endif diff --git a/test/fpga/test_marker_api.cpp b/test/fpga/test_marker_api.cpp index 2b25f8f6d1d9e247d10a9338e60b9c19a5a9c68d..48038e7b8fa9213e983f3ab25b17c6e8b83b84db 100644 --- a/test/fpga/test_marker_api.cpp +++ b/test/fpga/test_marker_api.cpp @@ -139,6 +139,9 @@ PaddleMobileConfig GetConfig1() { int main() { open_device(); + timeval start11, end11; + long dif_sec, dif_usec; // NOLINT + PaddleMobileConfig config = GetConfig(); auto predictor = CreatePaddlePredictorPredict_From_To(0, -1); gettimeofday(&end11, NULL); @@ -189,8 +190,9 @@ int main() { std::cout << "Output number is " << v.size() << std::endl; for (int fetchNum = 0; fetchNum < v.size(); fetchNum++) { std::string dumpName = "marker_api_fetch_" + std::to_string(fetchNum); - dump_stride(dumpName, v[fetchNum]); + // dump_stride(dumpName, v[fetchNum]); } + fpga_free(img); PaddleMobileConfig config1 = GetConfig1(); auto predictor1 = @@ -233,6 +235,7 @@ int main() { std::string dumpName = "marker2_api_fetch_" + std::to_string(fetchNum); dump_stride(dumpName, v1[fetchNum]); } + fpga_free(img1); } return 0; } diff --git a/test/fpga/test_rfcn_api.cpp b/test/fpga/test_rfcn_api.cpp index a52be938dee6df098a1f20a5df5cd852e0bfe37f..c62eeda9929ecaf1a3aca624301fd274872ea919 100644 --- a/test/fpga/test_rfcn_api.cpp +++ b/test/fpga/test_rfcn_api.cpp @@ -16,6 +16,7 @@ limitations under the License. */ #define PADDLE_MOBILE_FPGA #endif #include +#include #include #include "../../src/io/paddle_inference_api.h" @@ -69,7 +70,7 @@ PaddleMobileConfig GetConfig1() { int main() { open_device(); - +#if 0 PaddleMobileConfig config1 = GetConfig1(); auto predictor1 = CreatePaddlePredictorFetchPaddleTensors(&v1); // Old data in v will be cleared std::cout << "Output number is " << v1.size() << std::endl; std::cout << "out[0] length " << v1[0].data.length() << std::endl; - + fpga_free(img1); +#endif //////////////////////////// PaddleMobileConfig config = GetConfig(); @@ -160,6 +162,11 @@ int main() { } } std::cout << "Finish getting vector values" << std::endl; + fpga_free(img); + + auto version = fpga::paddle_mobile_version(); + + std::cout << "0X0" << std::hex << version << std::endl; return 0; }