From c579731063e86421df18d3ba29b2b8077b32cef2 Mon Sep 17 00:00:00 2001 From: i-evi Date: Mon, 21 Dec 2020 17:00:22 +0800 Subject: [PATCH] ... --- src/additional/ecpufn/ecpufn.c | 160 ++++++++++++++++----------------- src/additional/ecpufn/ecpufn.h | 60 ++++++------- src/cc_tsrmgr.c | 2 +- src/util_list.h | 3 +- util/cclua.c | 10 +-- 5 files changed, 117 insertions(+), 118 deletions(-) diff --git a/src/additional/ecpufn/ecpufn.c b/src/additional/ecpufn/ecpufn.c index b859f5c..71a2d5c 100644 --- a/src/additional/ecpufn/ecpufn.c +++ b/src/additional/ecpufn/ecpufn.c @@ -31,16 +31,16 @@ void naive_conv2d_ ## dtype (const dtype *in, \ } \ } -NAIVE_CONV2D_IMPLEMENTATION (i8); -NAIVE_CONV2D_IMPLEMENTATION (u8); -NAIVE_CONV2D_IMPLEMENTATION (i16); -NAIVE_CONV2D_IMPLEMENTATION (u16); -NAIVE_CONV2D_IMPLEMENTATION (i32); -NAIVE_CONV2D_IMPLEMENTATION (u32); -NAIVE_CONV2D_IMPLEMENTATION (i64); -NAIVE_CONV2D_IMPLEMENTATION (u64); -NAIVE_CONV2D_IMPLEMENTATION (f32); -NAIVE_CONV2D_IMPLEMENTATION (f64); +NAIVE_CONV2D_IMPLEMENTATION (i8) +NAIVE_CONV2D_IMPLEMENTATION (u8) +NAIVE_CONV2D_IMPLEMENTATION (i16) +NAIVE_CONV2D_IMPLEMENTATION (u16) +NAIVE_CONV2D_IMPLEMENTATION (i32) +NAIVE_CONV2D_IMPLEMENTATION (u32) +NAIVE_CONV2D_IMPLEMENTATION (i64) +NAIVE_CONV2D_IMPLEMENTATION (u64) +NAIVE_CONV2D_IMPLEMENTATION (f32) +NAIVE_CONV2D_IMPLEMENTATION (f64) #define DFL_CONV2D_IMPLEMENTATION(dtype) \ void ecpu_conv2d_ ## dtype (const dtype *in, dtype *out, i32 ix, i32 iy, \ @@ -49,16 +49,16 @@ void ecpu_conv2d_ ## dtype (const dtype *in, dtype *out, i32 ix, i32 iy, \ naive_conv2d_ ## dtype(in, out, ix, iy, ox, oy, sx, sy, k, kw); \ } -DFL_CONV2D_IMPLEMENTATION (i8); -DFL_CONV2D_IMPLEMENTATION (u8); -DFL_CONV2D_IMPLEMENTATION (i16); -DFL_CONV2D_IMPLEMENTATION (u16); -DFL_CONV2D_IMPLEMENTATION (i32); -DFL_CONV2D_IMPLEMENTATION (u32); -DFL_CONV2D_IMPLEMENTATION (i64); -DFL_CONV2D_IMPLEMENTATION (u64); -/* DFL_CONV2D_IMPLEMENTATION (f32); */ -DFL_CONV2D_IMPLEMENTATION (f64); +DFL_CONV2D_IMPLEMENTATION (i8) +DFL_CONV2D_IMPLEMENTATION (u8) +DFL_CONV2D_IMPLEMENTATION (i16) +DFL_CONV2D_IMPLEMENTATION (u16) +DFL_CONV2D_IMPLEMENTATION (i32) +DFL_CONV2D_IMPLEMENTATION (u32) +DFL_CONV2D_IMPLEMENTATION (i64) +DFL_CONV2D_IMPLEMENTATION (u64) +/* DFL_CONV2D_IMPLEMENTATION (f32) */ +DFL_CONV2D_IMPLEMENTATION (f64) void ecpu_conv2d_f32(const f32 *in, f32 *out, i32 ix, i32 iy, i32 ox, i32 oy, i32 sx, i32 sy, const f32 *k, i32 kw) @@ -308,16 +308,16 @@ void naive_dot_prod_ ## dtype (const dtype *in, \ } \ } -NAIVE_DOTPROD_IMPLEMENTATION (i8); -NAIVE_DOTPROD_IMPLEMENTATION (u8); -NAIVE_DOTPROD_IMPLEMENTATION (i16); -NAIVE_DOTPROD_IMPLEMENTATION (u16); -NAIVE_DOTPROD_IMPLEMENTATION (i32); -NAIVE_DOTPROD_IMPLEMENTATION (u32); -NAIVE_DOTPROD_IMPLEMENTATION (i64); -NAIVE_DOTPROD_IMPLEMENTATION (u64); -NAIVE_DOTPROD_IMPLEMENTATION (f32); -NAIVE_DOTPROD_IMPLEMENTATION (f64); +NAIVE_DOTPROD_IMPLEMENTATION (i8) +NAIVE_DOTPROD_IMPLEMENTATION (u8) +NAIVE_DOTPROD_IMPLEMENTATION (i16) +NAIVE_DOTPROD_IMPLEMENTATION (u16) +NAIVE_DOTPROD_IMPLEMENTATION (i32) +NAIVE_DOTPROD_IMPLEMENTATION (u32) +NAIVE_DOTPROD_IMPLEMENTATION (i64) +NAIVE_DOTPROD_IMPLEMENTATION (u64) +NAIVE_DOTPROD_IMPLEMENTATION (f32) +NAIVE_DOTPROD_IMPLEMENTATION (f64) #define DFL_DOTPROD_IMPLEMENTATION(dtype) \ void ecpu_dot_prod_ ## dtype (const dtype *in, \ @@ -326,16 +326,16 @@ void ecpu_dot_prod_ ## dtype (const dtype *in, \ naive_dot_prod_ ## dtype (in, out, w, iw); \ } -DFL_DOTPROD_IMPLEMENTATION (i8); -DFL_DOTPROD_IMPLEMENTATION (u8); -DFL_DOTPROD_IMPLEMENTATION (i16); -DFL_DOTPROD_IMPLEMENTATION (u16); -DFL_DOTPROD_IMPLEMENTATION (i32); -DFL_DOTPROD_IMPLEMENTATION (u32); -DFL_DOTPROD_IMPLEMENTATION (i64); -DFL_DOTPROD_IMPLEMENTATION (u64); -/* DFL_DOTPROD_IMPLEMENTATION (f32); */ -DFL_DOTPROD_IMPLEMENTATION (f64); +DFL_DOTPROD_IMPLEMENTATION (i8) +DFL_DOTPROD_IMPLEMENTATION (u8) +DFL_DOTPROD_IMPLEMENTATION (i16) +DFL_DOTPROD_IMPLEMENTATION (u16) +DFL_DOTPROD_IMPLEMENTATION (i32) +DFL_DOTPROD_IMPLEMENTATION (u32) +DFL_DOTPROD_IMPLEMENTATION (i64) +DFL_DOTPROD_IMPLEMENTATION (u64) +/* DFL_DOTPROD_IMPLEMENTATION (f32) */ +DFL_DOTPROD_IMPLEMENTATION (f64) void ecpu_dot_prod_f32(const f32 *in, f32 *out, const f32 *w, i32 iw) { @@ -412,16 +412,16 @@ void naive_max_pool2d_ ## dtype (const dtype *in, \ } \ } -NAIVE_MAXPOOL2D_IMPLEMENTATION (i8); -NAIVE_MAXPOOL2D_IMPLEMENTATION (u8); -NAIVE_MAXPOOL2D_IMPLEMENTATION (i16); -NAIVE_MAXPOOL2D_IMPLEMENTATION (u16); -NAIVE_MAXPOOL2D_IMPLEMENTATION (i32); -NAIVE_MAXPOOL2D_IMPLEMENTATION (u32); -NAIVE_MAXPOOL2D_IMPLEMENTATION (i64); -NAIVE_MAXPOOL2D_IMPLEMENTATION (u64); -NAIVE_MAXPOOL2D_IMPLEMENTATION (f32); -NAIVE_MAXPOOL2D_IMPLEMENTATION (f64); +NAIVE_MAXPOOL2D_IMPLEMENTATION (i8) +NAIVE_MAXPOOL2D_IMPLEMENTATION (u8) +NAIVE_MAXPOOL2D_IMPLEMENTATION (i16) +NAIVE_MAXPOOL2D_IMPLEMENTATION (u16) +NAIVE_MAXPOOL2D_IMPLEMENTATION (i32) +NAIVE_MAXPOOL2D_IMPLEMENTATION (u32) +NAIVE_MAXPOOL2D_IMPLEMENTATION (i64) +NAIVE_MAXPOOL2D_IMPLEMENTATION (u64) +NAIVE_MAXPOOL2D_IMPLEMENTATION (f32) +NAIVE_MAXPOOL2D_IMPLEMENTATION (f64) #define DFL_MAXPOOL2D_IMPLEMENTATION(dtype) \ void ecpu_max_pool2d_ ## dtype ( \ @@ -430,16 +430,16 @@ void ecpu_max_pool2d_ ## dtype ( \ naive_max_pool2d_ ## dtype(in, out, x, y, s); \ } -DFL_MAXPOOL2D_IMPLEMENTATION (i8); -DFL_MAXPOOL2D_IMPLEMENTATION (u8); -DFL_MAXPOOL2D_IMPLEMENTATION (i16); -DFL_MAXPOOL2D_IMPLEMENTATION (u16); -DFL_MAXPOOL2D_IMPLEMENTATION (i32); -DFL_MAXPOOL2D_IMPLEMENTATION (u32); -DFL_MAXPOOL2D_IMPLEMENTATION (i64); -DFL_MAXPOOL2D_IMPLEMENTATION (u64); -/* DFL_MAXPOOL2D_IMPLEMENTATION (f32); */ -DFL_MAXPOOL2D_IMPLEMENTATION (f64); +DFL_MAXPOOL2D_IMPLEMENTATION (i8) +DFL_MAXPOOL2D_IMPLEMENTATION (u8) +DFL_MAXPOOL2D_IMPLEMENTATION (i16) +DFL_MAXPOOL2D_IMPLEMENTATION (u16) +DFL_MAXPOOL2D_IMPLEMENTATION (i32) +DFL_MAXPOOL2D_IMPLEMENTATION (u32) +DFL_MAXPOOL2D_IMPLEMENTATION (i64) +DFL_MAXPOOL2D_IMPLEMENTATION (u64) +/* DFL_MAXPOOL2D_IMPLEMENTATION (f32) */ +DFL_MAXPOOL2D_IMPLEMENTATION (f64) void ecpu_max_pool2d_f32(const f32 *in, f32 *out, i32 x, i32 y, i32 s) { @@ -569,16 +569,16 @@ void naive_avg_pool2d_ ## dtype (const dtype *in, \ } \ } -NAIVE_AVGPOOL2D_IMPLEMENTATION (i8); -NAIVE_AVGPOOL2D_IMPLEMENTATION (u8); -NAIVE_AVGPOOL2D_IMPLEMENTATION (i16); -NAIVE_AVGPOOL2D_IMPLEMENTATION (u16); -NAIVE_AVGPOOL2D_IMPLEMENTATION (i32); -NAIVE_AVGPOOL2D_IMPLEMENTATION (u32); -NAIVE_AVGPOOL2D_IMPLEMENTATION (i64); -NAIVE_AVGPOOL2D_IMPLEMENTATION (u64); -NAIVE_AVGPOOL2D_IMPLEMENTATION (f32); -NAIVE_AVGPOOL2D_IMPLEMENTATION (f64); +NAIVE_AVGPOOL2D_IMPLEMENTATION (i8) +NAIVE_AVGPOOL2D_IMPLEMENTATION (u8) +NAIVE_AVGPOOL2D_IMPLEMENTATION (i16) +NAIVE_AVGPOOL2D_IMPLEMENTATION (u16) +NAIVE_AVGPOOL2D_IMPLEMENTATION (i32) +NAIVE_AVGPOOL2D_IMPLEMENTATION (u32) +NAIVE_AVGPOOL2D_IMPLEMENTATION (i64) +NAIVE_AVGPOOL2D_IMPLEMENTATION (u64) +NAIVE_AVGPOOL2D_IMPLEMENTATION (f32) +NAIVE_AVGPOOL2D_IMPLEMENTATION (f64) #define DFL_AVGPOOL2D_IMPLEMENTATION(dtype) \ void ecpu_avg_pool2d_ ## dtype ( \ @@ -587,16 +587,16 @@ void ecpu_avg_pool2d_ ## dtype ( \ naive_avg_pool2d_ ## dtype(in, out, x, y, s); \ } -DFL_AVGPOOL2D_IMPLEMENTATION (i8); -DFL_AVGPOOL2D_IMPLEMENTATION (u8); -DFL_AVGPOOL2D_IMPLEMENTATION (i16); -DFL_AVGPOOL2D_IMPLEMENTATION (u16); -DFL_AVGPOOL2D_IMPLEMENTATION (i32); -DFL_AVGPOOL2D_IMPLEMENTATION (u32); -DFL_AVGPOOL2D_IMPLEMENTATION (i64); -DFL_AVGPOOL2D_IMPLEMENTATION (u64); -/* DFL_AVGPOOL2D_IMPLEMENTATION (f32); */ -DFL_AVGPOOL2D_IMPLEMENTATION (f64); +DFL_AVGPOOL2D_IMPLEMENTATION (i8) +DFL_AVGPOOL2D_IMPLEMENTATION (u8) +DFL_AVGPOOL2D_IMPLEMENTATION (i16) +DFL_AVGPOOL2D_IMPLEMENTATION (u16) +DFL_AVGPOOL2D_IMPLEMENTATION (i32) +DFL_AVGPOOL2D_IMPLEMENTATION (u32) +DFL_AVGPOOL2D_IMPLEMENTATION (i64) +DFL_AVGPOOL2D_IMPLEMENTATION (u64) +/* DFL_AVGPOOL2D_IMPLEMENTATION (f32) */ +DFL_AVGPOOL2D_IMPLEMENTATION (f64) void ecpu_avg_pool2d_f32(const f32 *in, f32 *out, i32 x, i32 y, i32 s) { diff --git a/src/additional/ecpufn/ecpufn.h b/src/additional/ecpufn/ecpufn.h index 39c66da..9e9e0ac 100644 --- a/src/additional/ecpufn/ecpufn.h +++ b/src/additional/ecpufn/ecpufn.h @@ -29,16 +29,16 @@ void ecpu_conv2d_ ## dtype (const dtype *in, dtype *out, i32 ix, i32 iy, \ void naive_conv2d_ ## dtype (const dtype *in, dtype *out, i32 ix, i32 iy, \ i32 ox, i32 oy, i32 sx, i32 sy, const dtype *k, i32 kw); -ECPU_CONV2D_DECLARATION (i8); -ECPU_CONV2D_DECLARATION (u8); -ECPU_CONV2D_DECLARATION (i16); -ECPU_CONV2D_DECLARATION (u16); -ECPU_CONV2D_DECLARATION (i32); -ECPU_CONV2D_DECLARATION (u32); -ECPU_CONV2D_DECLARATION (i64); -ECPU_CONV2D_DECLARATION (u64); -ECPU_CONV2D_DECLARATION (f32); -ECPU_CONV2D_DECLARATION (f64); +ECPU_CONV2D_DECLARATION (i8) +ECPU_CONV2D_DECLARATION (u8) +ECPU_CONV2D_DECLARATION (i16) +ECPU_CONV2D_DECLARATION (u16) +ECPU_CONV2D_DECLARATION (i32) +ECPU_CONV2D_DECLARATION (u32) +ECPU_CONV2D_DECLARATION (i64) +ECPU_CONV2D_DECLARATION (u64) +ECPU_CONV2D_DECLARATION (f32) +ECPU_CONV2D_DECLARATION (f64) #if (defined(__x86_64) && defined(__SSE__)) || \ (defined(__ARM_NEON)) /* Supported via `sse2neon` */ @@ -70,16 +70,16 @@ void ecpu_dot_prod_ ## dtype ( \ void naive_dot_prod_ ## dtype ( \ const dtype *in, dtype *out, const dtype *w, i32 iw); -ECPU_DOTPROD_DECLARATION (i8); -ECPU_DOTPROD_DECLARATION (u8); -ECPU_DOTPROD_DECLARATION (i16); -ECPU_DOTPROD_DECLARATION (u16); -ECPU_DOTPROD_DECLARATION (i32); -ECPU_DOTPROD_DECLARATION (u32); -ECPU_DOTPROD_DECLARATION (i64); -ECPU_DOTPROD_DECLARATION (u64); -ECPU_DOTPROD_DECLARATION (f32); -ECPU_DOTPROD_DECLARATION (f64); +ECPU_DOTPROD_DECLARATION (i8) +ECPU_DOTPROD_DECLARATION (u8) +ECPU_DOTPROD_DECLARATION (i16) +ECPU_DOTPROD_DECLARATION (u16) +ECPU_DOTPROD_DECLARATION (i32) +ECPU_DOTPROD_DECLARATION (u32) +ECPU_DOTPROD_DECLARATION (i64) +ECPU_DOTPROD_DECLARATION (u64) +ECPU_DOTPROD_DECLARATION (f32) +ECPU_DOTPROD_DECLARATION (f64) #if defined(__x86_64) #if defined(__AVX__) @@ -104,16 +104,16 @@ void ecpu_avg_pool2d_ ## dtype ( \ void naive_avg_pool2d_ ## dtype ( \ const dtype *in, dtype *out, i32 x, i32 y, i32 s); -ECPU_POOL2D_DECLARATION (i8); -ECPU_POOL2D_DECLARATION (u8); -ECPU_POOL2D_DECLARATION (i16); -ECPU_POOL2D_DECLARATION (u16); -ECPU_POOL2D_DECLARATION (i32); -ECPU_POOL2D_DECLARATION (u32); -ECPU_POOL2D_DECLARATION (i64); -ECPU_POOL2D_DECLARATION (u64); -ECPU_POOL2D_DECLARATION (f32); -ECPU_POOL2D_DECLARATION (f64); +ECPU_POOL2D_DECLARATION (i8) +ECPU_POOL2D_DECLARATION (u8) +ECPU_POOL2D_DECLARATION (i16) +ECPU_POOL2D_DECLARATION (u16) +ECPU_POOL2D_DECLARATION (i32) +ECPU_POOL2D_DECLARATION (u32) +ECPU_POOL2D_DECLARATION (i64) +ECPU_POOL2D_DECLARATION (u64) +ECPU_POOL2D_DECLARATION (f32) +ECPU_POOL2D_DECLARATION (f64) #if defined(__x86_64) && defined(__SSE__) #define ALT_MAXPOOL2D_F32_S2 sse_max_pool2d_f32_s2 diff --git a/src/cc_tsrmgr.c b/src/cc_tsrmgr.c index e8bad82..96ee50b 100644 --- a/src/cc_tsrmgr.c +++ b/src/cc_tsrmgr.c @@ -335,4 +335,4 @@ void cc_tsrmgr_gc(enum cc_tsrmgr_ctrl ctrl) /* Do nothing */ break; } -} \ No newline at end of file +} diff --git a/src/util_list.h b/src/util_list.h index 5e8183e..78b12ea 100644 --- a/src/util_list.h +++ b/src/util_list.h @@ -81,8 +81,7 @@ struct list { }; }; -#define LIST_INFO_LEN (sizeof(struct list) - \ - sizeof(struct { void *_[4]; })) +#define LIST_INFO_LEN (sizeof(struct list) - sizeof(void *[4])) #define LIST_INFO_OFFSET (sizeof(struct list) - LIST_INFO_LEN) #define LIST_FLAG_DEFAULT 0x00 diff --git a/util/cclua.c b/util/cclua.c index 2dda9ef..a001c1d 100644 --- a/util/cclua.c +++ b/util/cclua.c @@ -7751,12 +7751,12 @@ static void _print_item(lua_State *L,int i){ switch(lua_type(L,i)){ case 0:printf("nil");break; case 1:printf("%s",lua_toboolean(L,i)?"true":"false");break; -case 2:printf("lightuserdata: %p",index2adr(L,i));break; +case 2:printf("lightuserdata: %p",(void*)index2adr(L,i));break; case 3:case 4:printf("%s",lua_tostring(L,i));break; -case 5:printf("table: %p",index2adr(L,i));break; -case 6:printf("function: %p",index2adr(L,i));break; -case 7:printf("userdata: %p",index2adr(L,i));break; -case 8:printf("thread: %p",index2adr(L,i));break; +case 5:printf("table: %p",(void*)index2adr(L,i));break; +case 6:printf("function: %p",(void*)index2adr(L,i));break; +case 7:printf("userdata: %p",(void*)index2adr(L,i));break; +case 8:printf("thread: %p",(void*)index2adr(L,i));break; default:printf("unknown: %d", lua_type(L,i));} }