提交 b5c14d86 编写于 作者: Z zhangyang0701 提交者: GitHub

Merge pull request #679 from chonwhite/develop

fix:#678
...@@ -58,9 +58,9 @@ void fpga_copy(void *dest, const void *src, size_t num) { ...@@ -58,9 +58,9 @@ void fpga_copy(void *dest, const void *src, size_t num) {
memcpy(dest, src, num); memcpy(dest, src, num);
} }
int ComputeFpgaConv(struct FpgaConvArgs args) {} int ComputeFpgaConv(struct ConvArgs args) {}
int ComputeFpgaPool(struct FpgaPoolArgs args) {} int ComputeFpgaPool(struct PoolingArgs args) {}
int ComputeFpgaEWAdd(struct FpgaEWAddArgs args) {} int ComputeFpgaEWAdd(struct EWAddArgs args) {}
} // namespace fpga } // namespace fpga
} // namespace paddle_mobile } // namespace paddle_mobile
...@@ -58,7 +58,8 @@ struct KernelArgs { ...@@ -58,7 +58,8 @@ struct KernelArgs {
}; };
struct ImageInputArgs { struct ImageInputArgs {
void* address; // input featuremap virtual address void* address; // input featuremap virtual address
float* scale_address; // input scale address;
uint32_t channels; uint32_t channels;
uint32_t width; // featuremap width uint32_t width; // featuremap width
uint32_t height; uint32_t height;
...@@ -73,29 +74,26 @@ struct ImageOutputArgs { ...@@ -73,29 +74,26 @@ struct ImageOutputArgs {
struct ConvArgs { struct ConvArgs {
bool relu_enabled; bool relu_enabled;
float scale; // input scale;
void* bias_address; void* bias_address;
void* filter_address; void* filter_address;
uint32_t filter_num; uint32_t filter_num;
uint32_t group_num; uint32_t group_num;
struct BNArgs bn; struct BNArgs bn;
struct KernelArgs kernel;
struct ImageInputArgs image; // input image; struct ImageInputArgs image; // input image;
struct ImageOutputArgs output; struct ImageOutputArgs output;
struct KernelArgs kernel;
}; };
struct PoolingArgs { struct PoolingArgs {
float scale; struct KernelArgs kernel;
struct ImageInputArgs image; // input image; struct ImageInputArgs image; // input image;
struct ImageOutputArgs output; struct ImageOutputArgs output;
struct KernelArgs kernel;
}; };
// elementwise add arguments // elementwise add arguments
struct EWAddArgs { struct EWAddArgs {
bool relu_enabled; bool relu_enabled;
float scale;
float const0; // output0 = const0 x input0 + const1 x input1; float const0; // output0 = const0 x input0 + const1 x input1;
float const1; float const1;
...@@ -130,11 +128,35 @@ struct FpgaRegReadArgs { ...@@ -130,11 +128,35 @@ struct FpgaRegReadArgs {
#define IOCTL_CONFIG_POOLING _IOW(IOCTL_FPGA_MAGIC, 22, struct PoolingArgs) #define IOCTL_CONFIG_POOLING _IOW(IOCTL_FPGA_MAGIC, 22, struct PoolingArgs)
#define IOCTL_CONFIG_EW _IOW(IOCTL_FPGA_MAGIC, 23, struct EWAddArgs) #define IOCTL_CONFIG_EW _IOW(IOCTL_FPGA_MAGIC, 23, struct EWAddArgs)
enum FPGA_ERR_TYPE {
ERR_IOCTL_CMD = -1,
ERR_TIMEOUT = -2,
ERR_COMPLETION_TIMEOUT = -3,
ERR_INVALID_FPGA_ADDR = -4,
ERR_NOMEM = -5,
ERR_NO_RESERVE_MEM = -6,
ERR_COPY_FROM_USER = -7,
ERR_COPY_TO_USER = -8,
ERR_DEL_TIMER = -9,
ERR_ENABLE_MSI = -10,
ERR_REGISTER_IRQ = -11,
ERR_PCIE_REGISTER = -12,
ERR_PCIE_PROBE = -13,
ERR_REGISTER_BLOCK = -14,
ERR_ALLOC_GENDISK = -15,
ERR_INIT_QUEUE = -16,
ERR_WAIT = -17,
ERR_ECC_ERROR = -31,
ERR_FPGA_FAIL_STOP = -64,
ERR_FPGA_DEBUG_STOP = -113,
DEV_TMP_UNAVAILABLE = -128
};
//============================== API ============================= //============================== API =============================
int ComputeFpgaConv(struct FpgaConvArgs args); int ComputeFpgaConv(struct ConvArgs args);
int ComputeFpgaPool(struct FpgaPoolArgs args); int ComputeFpgaPool(struct PoolingArgs args);
int ComputeFpgaEWAdd(struct FpgaEWAddArgs args); int ComputeFpgaEWAdd(struct EWAddArgs args);
} // namespace fpga } // namespace fpga
} // namespace paddle_mobile } // namespace paddle_mobile
...@@ -262,11 +262,11 @@ class ElementwiseAddParam : OpParam { ...@@ -262,11 +262,11 @@ class ElementwiseAddParam : OpParam {
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
private: private:
fpga::FpgaEWAddArgs fpga_EW_add_args; fpga::EWAddArgs fpga_EW_add_args;
public: public:
const fpga::FpgaEWAddArgs &FpgaArgs() const { return fpga_EW_add_args; } const fpga::EWAddArgs &FpgaArgs() const { return fpga_EW_add_args; }
void SetFpgaArgs(const fpga::FpgaEWAddArgs &args) { fpga_EW_add_args = args; } void SetFpgaArgs(const fpga::EWAddArgs &args) { fpga_EW_add_args = args; }
#endif #endif
}; };
...@@ -465,11 +465,11 @@ class PoolParam : public OpParam { ...@@ -465,11 +465,11 @@ class PoolParam : public OpParam {
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
private: private:
fpga::FpgaPoolArgs fpga_pool_args; fpga::PoolingArgs fpga_pool_args;
public: public:
const fpga::FpgaPoolArgs &FpgaArgs() const { return fpga_pool_args; } const fpga::PoolingArgs &FpgaArgs() const { return fpga_pool_args; }
void SetFpgaArgs(const fpga::FpgaPoolArgs &args) { fpga_pool_args = args; } void SetFpgaArgs(const fpga::PoolingArgs &args) { fpga_pool_args = args; }
#endif #endif
}; };
#endif #endif
...@@ -933,11 +933,11 @@ class FusionFcParam : public OpParam { ...@@ -933,11 +933,11 @@ class FusionFcParam : public OpParam {
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
private: private:
fpga::FpgaConvArgs fpga_conv_args; fpga::ConvArgs fpga_conv_args;
public: public:
const fpga::FpgaConvArgs &FpgaArgs() const { return fpga_conv_args; } const fpga::ConvArgs &FpgaArgs() const { return fpga_conv_args; }
void SetFpgaArgs(const fpga::FpgaConvArgs &args) { fpga_conv_args = args; } void SetFpgaArgs(const fpga::ConvArgs &args) { fpga_conv_args = args; }
#endif #endif
}; };
...@@ -991,11 +991,11 @@ class FusionConvAddParam : public OpParam { ...@@ -991,11 +991,11 @@ class FusionConvAddParam : public OpParam {
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
private: private:
fpga::FpgaConvArgs fpga_conv_args; fpga::ConvArgs fpga_conv_args;
public: public:
const fpga::FpgaConvArgs &FpgaArgs() const { return fpga_conv_args; } const fpga::ConvArgs &FpgaArgs() const { return fpga_conv_args; }
void SetFpgaArgs(const fpga::FpgaConvArgs &args) { fpga_conv_args = args; } void SetFpgaArgs(const fpga::ConvArgs &args) { fpga_conv_args = args; }
#endif #endif
}; };
...@@ -1096,11 +1096,11 @@ class FusionConvAddBNReluParam : public OpParam { ...@@ -1096,11 +1096,11 @@ class FusionConvAddBNReluParam : public OpParam {
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
private: private:
fpga::FpgaConvArgs fpga_conv_args; fpga::ConvArgs fpga_conv_args;
public: public:
const fpga::FpgaConvArgs &FpgaArgs() const { return fpga_conv_args; } const fpga::ConvArgs &FpgaArgs() const { return fpga_conv_args; }
void SetFpgaArgs(const fpga::FpgaConvArgs &args) { fpga_conv_args = args; } void SetFpgaArgs(const fpga::ConvArgs &args) { fpga_conv_args = args; }
#endif #endif
}; };
#endif #endif
...@@ -1190,11 +1190,11 @@ class FusionConvAddBNParam : public OpParam { ...@@ -1190,11 +1190,11 @@ class FusionConvAddBNParam : public OpParam {
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
private: private:
fpga::FpgaConvArgs fpga_conv_args; fpga::ConvArgs fpga_conv_args;
public: public:
const fpga::FpgaConvArgs &FpgaArgs() const { return fpga_conv_args; } const fpga::ConvArgs &FpgaArgs() const { return fpga_conv_args; }
void SetFpgaArgs(const fpga::FpgaConvArgs &args) { fpga_conv_args = args; } void SetFpgaArgs(const fpga::ConvArgs &args) { fpga_conv_args = args; }
#endif #endif
}; };
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册