Project

General

Profile

Bug #128 ยป 0001-added-x86_64-for-the-b2g-cuda-code.patch

Anoop Saldanha, 04/15/2010 07:40 AM

View differences:

src/util-mpm-b2g-cuda.c
B2gCudaCtx *ctx = (B2gCudaCtx *)mpm_ctx->ctx;
/* search kernel */
if (SCCudaParamSetv(ctx->cuda_search_kernel, B2G_CUDA_KERNEL_ARG2_OFFSET,
if (SCCudaParamSetv(ctx->cuda_search_kernel, ctx->cuda_search_kernel_arg2_offset,
(void *)&ctx->cuda_g_u8_lowercasetable,
sizeof(void *)) == -1) {
goto error;
......
SCLogError(SC_ERR_B2G_CUDA_ERROR, "Error getting a cuda function");
}
/* we will need this for debugging purposes. keep it here now */
//#define ALIGN_UP(offset, alignment)
// (offset) = ((offset) + (alignment) - 1) & ~((alignment) - 1)
//
// int offset = 0;
//
// ALIGN_UP(offset, __alignof(void *));
// arg0 = offset;
// offset += sizeof(void *);
//
// ALIGN_UP(offset, __alignof(void *));
// arg1 = offset;
// offset += sizeof(void *);
//
// ALIGN_UP(offset, __alignof(void *));
// arg2 = offset;
// offset += sizeof(void *);
//
// ALIGN_UP(offset, __alignof(void *));
// arg3 = offset;
// offset += sizeof(void *);
//
// ALIGN_UP(offset, __alignof(unsigned short));
// arg4 = offset;
// offset += sizeof(unsigned short);
//
// ALIGN_UP(offset, __alignof(unsigned int));
// arg5 = offset;
// offset += sizeof(unsigned int);
//
// printf("arg0: %d\n", arg0);
// printf("arg1: %d\n", arg1);
// printf("arg2: %d\n", arg2);
// printf("arg3: %d\n", arg3);
// printf("arg4: %d\n", arg4);
// printf("arg5: %d\n", arg5);
//
// arg_total = offset;
//
// printf("arg_total: %d\n", arg_total);
#define ALIGN_UP(offset, alignment) (offset) = ((offset) + (alignment) - 1) & ~((alignment) - 1)
int offset = 0;
ALIGN_UP(offset, __alignof(void *));
ctx->cuda_search_kernel_arg0_offset = offset;
offset += sizeof(void *);
ALIGN_UP(offset, __alignof(void *));
ctx->cuda_search_kernel_arg1_offset = offset;
offset += sizeof(void *);
ALIGN_UP(offset, __alignof(void *));
ctx->cuda_search_kernel_arg2_offset = offset;
offset += sizeof(void *);
ALIGN_UP(offset, __alignof(void *));
ctx->cuda_search_kernel_arg3_offset = offset;
offset += sizeof(void *);
ALIGN_UP(offset, __alignof(unsigned short));
ctx->cuda_search_kernel_arg4_offset = offset;
offset += sizeof(unsigned short);
ALIGN_UP(offset, __alignof(unsigned int));
ctx->cuda_search_kernel_arg5_offset = offset;
offset += sizeof(unsigned int);
ctx->cuda_search_kernel_arg_total = offset;
//printf("arg0: %d\n", arg0);
//printf("arg1: %d\n", arg1);
//printf("arg2: %d\n", arg2);
//printf("arg3: %d\n", arg3);
//printf("arg4: %d\n", arg4);
//printf("arg5: %d\n", arg5);
//printf("arg_total: %d\n", arg_total);
return;
}
......
goto error;
}
if (SCCudaParamSetv(ctx->cuda_search_kernel, B2G_CUDA_KERNEL_ARG0_OFFSET,
if (SCCudaParamSetv(ctx->cuda_search_kernel, ctx->cuda_search_kernel_arg0_offset,
(void *)&cuda_offsets, sizeof(void *)) == -1) {
goto error;
}
if (SCCudaParamSetv(ctx->cuda_search_kernel, B2G_CUDA_KERNEL_ARG1_OFFSET,
if (SCCudaParamSetv(ctx->cuda_search_kernel, ctx->cuda_search_kernel_arg1_offset,
(void *)&ctx->cuda_B2G, sizeof(void *)) == -1) {
goto error;
}
if (SCCudaParamSetv(ctx->cuda_search_kernel, B2G_CUDA_KERNEL_ARG3_OFFSET,
if (SCCudaParamSetv(ctx->cuda_search_kernel, ctx->cuda_search_kernel_arg3_offset,
(void *)&cuda_buf, sizeof(void *)) == -1) {
goto error;
}
if (SCCudaParamSeti(ctx->cuda_search_kernel, B2G_CUDA_KERNEL_ARG4_OFFSET,
if (SCCudaParamSeti(ctx->cuda_search_kernel, ctx->cuda_search_kernel_arg4_offset,
buflen) == -1) {
goto error;
}
if (SCCudaParamSeti(ctx->cuda_search_kernel, B2G_CUDA_KERNEL_ARG5_OFFSET,
if (SCCudaParamSeti(ctx->cuda_search_kernel, ctx->cuda_search_kernel_arg5_offset,
ctx->m) == -1) {
goto error;
}
if (SCCudaParamSetSize(ctx->cuda_search_kernel, B2G_CUDA_KERNEL_TOTAL_ARG_SIZE) == -1)
if (SCCudaParamSetSize(ctx->cuda_search_kernel, ctx->cuda_search_kernel_arg_total) == -1)
goto error;
if (SCCudaFuncSetBlockShape(ctx->cuda_search_kernel, CUDA_THREADS, 1, 1) == -1)
src/util-mpm-b2g-cuda.h
/* the search kernel */
CUfunction cuda_search_kernel;
/* the cuda_search_kernel argument offsets */
uint8_t cuda_search_kernel_arg0_offset;
uint8_t cuda_search_kernel_arg1_offset;
uint8_t cuda_search_kernel_arg2_offset;
uint8_t cuda_search_kernel_arg3_offset;
uint8_t cuda_search_kernel_arg4_offset;
uint8_t cuda_search_kernel_arg5_offset;
uint8_t cuda_search_kernel_arg_total;
/* cuda device pointer to thelower case table g_u8_lowercasetable */
CUdeviceptr cuda_g_u8_lowercasetable;
/* cuda device pointer to B2gCudaCtx->B2G */
    (1-1/1)