Skip to content

Commit 8851292

Browse files
committed
Errors all around.
1 parent 14cae83 commit 8851292

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

src/gpuarray_buffer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "gpuarray/buffer_collectives.h"
77
#include "gpuarray/error.h"
88

9+
#include "util/error.h"
910
#include "private.h"
1011

1112
extern const gpuarray_buffer_ops cuda_ops;
@@ -22,7 +23,7 @@ const gpuarray_buffer_ops *gpuarray_get_ops(const char *name) {
2223
int gpu_get_platform_count(const char* name, unsigned int* platcount) {
2324
const gpuarray_buffer_ops* ops = gpuarray_get_ops(name);
2425
if (ops == NULL) {
25-
return GA_INVALID_ERROR;
26+
return error_set(&global_err, GA_INVALID_ERROR, "Invalid platform");
2627
}
2728
return ops->get_platform_count(platcount);
2829
}
@@ -31,7 +32,7 @@ int gpu_get_device_count(const char* name, unsigned int platform,
3132
unsigned int* devcount) {
3233
const gpuarray_buffer_ops* ops = gpuarray_get_ops(name);
3334
if (ops == NULL) {
34-
return GA_INVALID_ERROR;
35+
return error_set(&global_err, GA_INVALID_ERROR, "Invalid platform");
3536
}
3637
return ops->get_device_count(platform, devcount);
3738
}
@@ -121,7 +122,7 @@ int gpudata_transfer(gpudata *dst, size_t dstoff, gpudata *src, size_t srcoff,
121122
/* Fallback to host copy */
122123
tmp = malloc(sz);
123124
if (tmp == NULL)
124-
return GA_MEMORY_ERROR;
125+
return error_sys(ctx->err, "malloc");
125126
res = src_ctx->ops->buffer_read(tmp, src, srcoff, sz);
126127
if (res != GA_NO_ERROR) {
127128
free(tmp);

src/gpuarray_buffer_opencl.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -808,14 +808,6 @@ static int cl_check_extensions(const char **preamble, unsigned int *count,
808808
if (flags & GA_USE_COMPLEX) {
809809
return error_set(ctx->err, GA_UNSUPPORTED_ERROR, "Complex are not supported yet");
810810
}
811-
// GA_USE_HALF should always work
812-
/*
813-
if (flags & GA_USE_HALF) {
814-
if (check_ext(ctx, CL_HALF)) return GA_DEVSUP_ERROR;
815-
preamble[*count] = PRAGMA CL_HALF ENABLE;
816-
(*count)++;
817-
}
818-
*/
819811
if (flags & GA_USE_CUDA) {
820812
return error_set(ctx->err, GA_DEVSUP_ERROR, "Cuda kernels not supported on opencl devices");
821813
}

0 commit comments

Comments
 (0)