.min_data_type_align_size = sizeof(cl_long) * 16,
.single_fp_config = 0, /* XXX */
.global_mem_cache_type = CL_READ_WRITE_CACHE,
-.global_mem_size = 256 * 1024 * 1024,
+.global_mem_size = 128 * 1024 * 1024,
.max_constant_buffer_size = 512 << 10,
.max_constant_args = 8,
.error_correction_support = CL_FALSE,
cl_mem mem = NULL;
cl_int err = CL_SUCCESS;
size_t alignment = 64;
- cl_ulong max_mem_size;
assert(ctx);
- /* Due to alignment, the image size may exceed alloc max size, check global mem instead */
- if ((err = cl_get_device_info(ctx->device,
- CL_DEVICE_GLOBAL_MEM_SIZE,
- sizeof(max_mem_size),
- &max_mem_size,
- NULL)) != CL_SUCCESS) {
- goto error;
- }
- if (UNLIKELY(sz > max_mem_size)) {
- err = CL_INVALID_BUFFER_SIZE;
- goto error;
- }
-
/* Allocate and inialize the structure itself */
if (type == CL_MEM_IMAGE_TYPE) {
struct _cl_mem_image *image = NULL;
cl_int err = CL_SUCCESS;
cl_mem mem = NULL;
+ cl_ulong max_mem_size;
if (UNLIKELY(sz == 0)) {
err = CL_INVALID_BUFFER_SIZE;
goto error;
}
+ if ((err = cl_get_device_info(ctx->device,
+ CL_DEVICE_MAX_MEM_ALLOC_SIZE,
+ sizeof(max_mem_size),
+ &max_mem_size,
+ NULL)) != CL_SUCCESS) {
+ goto error;
+ }
+
+ if (UNLIKELY(sz > max_mem_size)) {
+ err = CL_INVALID_BUFFER_SIZE;
+ goto error;
+ }
+
/* Create the buffer in video memory */
mem = cl_mem_allocate(CL_MEM_BUFFER_TYPE, ctx, flags, sz, CL_FALSE, &err);
if (mem == NULL || err != CL_SUCCESS)
}
sz = aligned_pitch * aligned_h * depth;
+
mem = cl_mem_allocate(CL_MEM_IMAGE_TYPE, ctx, flags, sz, tiling != CL_NO_TILE, &err);
if (mem == NULL || err != CL_SUCCESS)
goto error;