Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
i-evi committed Dec 21, 2020
1 parent 95f9460 commit c579731
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 118 deletions.
160 changes: 80 additions & 80 deletions src/additional/ecpufn/ecpufn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand All @@ -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)
Expand Down Expand Up @@ -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, \
Expand All @@ -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)
{
Expand Down Expand Up @@ -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 ( \
Expand All @@ -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)
{
Expand Down Expand Up @@ -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 ( \
Expand All @@ -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)
{
Expand Down
60 changes: 30 additions & 30 deletions src/additional/ecpufn/ecpufn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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` */
Expand Down Expand Up @@ -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__)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/cc_tsrmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,4 @@ void cc_tsrmgr_gc(enum cc_tsrmgr_ctrl ctrl)
/* Do nothing */
break;
}
}
}
3 changes: 1 addition & 2 deletions src/util_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions util/cclua.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));}
}

Expand Down

0 comments on commit c579731

Please sign in to comment.