From 784dfe725e57f709ea8f559b7bc7782039a7cdc5 Mon Sep 17 00:00:00 2001 From: magnum Date: Thu, 3 Jan 2013 20:00:23 +0100 Subject: [PATCH] ssha-opencl: Check device max allocation size. --- src/opencl_nsldaps_fmt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opencl_nsldaps_fmt.c b/src/opencl_nsldaps_fmt.c index 06c4821..7d92d88 100644 --- a/src/opencl_nsldaps_fmt.c +++ b/src/opencl_nsldaps_fmt.c @@ -175,8 +175,9 @@ static void find_best_gws(int do_benchmark, struct fmt_main *self) int optimal_kpc=2048; int gws, i = 0; cl_uint *tmpbuffer; + size_t maxgws = get_max_mem_alloc_size(ocl_gpu_id) / PLAINTEXT_LENGTH; - for(gws = local_work_size << 2; gws <= 8*1024*1024; gws <<= 1) { + for(gws = local_work_size << 2; gws <= maxgws; gws <<= 1) { create_clobj(gws, self); advance_cursor(); queue_prof = clCreateCommandQueue( context[ocl_gpu_id], devices[ocl_gpu_id], CL_QUEUE_PROFILING_ENABLE, &ret_code); -- 1.8.0.1