Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/acl_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgIntelFPGA(cl_kernel kernel,
break;

case ACL_ARG_ADDR_NONE:
if (arg_value == NULL) {
ERR_RET(CL_INVALID_ARG_VALUE, context, "Argument value is NULL");
}
if (is_sampler && arg_value != 0 &&
acl_sampler_is_valid_ptr(*((cl_sampler *)arg_value))) {
if (arg_size != sizeof(cl_sampler)) {
Expand All @@ -425,9 +428,6 @@ CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgIntelFPGA(cl_kernel kernel,
} else if (arg_size != arg_info->size) {
ERR_RET(CL_INVALID_ARG_SIZE, context, "Argument size is the wrong size");
}
if (arg_value == 0) {
ERR_RET(CL_INVALID_ARG_VALUE, context, "Argument value is NULL");
}
break;
}

Expand All @@ -436,6 +436,7 @@ CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgIntelFPGA(cl_kernel kernel,
// shouldn't spend time setting up the argument properly.
if (is_pipe) {
cl_mem pipe_ptr = *((cl_mem *)arg_value);
assert(pipe_ptr != NULL);

kernel->arg_is_svm[arg_index] = CL_FALSE;
kernel->arg_is_ptr[arg_index] = CL_FALSE;
Expand Down Expand Up @@ -639,6 +640,8 @@ CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgIntelFPGA(cl_kernel kernel,
kernel->arg_is_ptr[arg_index] = CL_FALSE;
} else if (is_sampler) {
cl_sampler sampler = *(cl_sampler *)arg_value;
assert(sampler != NULL);

int sampler_bitfield = 0;

sampler_bitfield = 0;
Expand Down
6 changes: 6 additions & 0 deletions test/acl_kernel_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,12 @@ MT_TEST(acl_kernel, set_kernel_arg) {
clSetKernelArg(kernel, 4, sizeof(cl_mem),
&src_mem)); // can pass mem object to __constant arg

// Invalid null arg.
CHECK_EQUAL(
CL_INVALID_ARG_VALUE,
clSetKernelArg(kernel, 1, sizeof(cl_mem),
nullptr)); // cannot pass NULL ARG as a non-memory type

// Check that we can set a pipe argument
// At the moment we don't do anything with the pipe argument, so we
// just want to make sure that if we create a pipe and pass it to a
Expand Down