summaryrefslogtreecommitdiff
path: root/src/cl_command_queue_gen7.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cl_command_queue_gen7.c')
-rw-r--r--src/cl_command_queue_gen7.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/cl_command_queue_gen7.c b/src/cl_command_queue_gen7.c
index cc835561..fa28b74c 100644
--- a/src/cl_command_queue_gen7.c
+++ b/src/cl_command_queue_gen7.c
@@ -30,6 +30,7 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#define MAX_GROUP_SIZE_IN_HALFSLICE 512
static INLINE size_t cl_kernel_compute_batch_sz(cl_kernel k) { return 256+256; }
@@ -126,9 +127,22 @@ error:
static int
cl_upload_constant_buffer(cl_command_queue queue, cl_kernel ker, cl_gpgpu gpgpu)
{
- /* calculate constant buffer size
- * we need raw_size & aligned_size
- */
+ if (interp_kernel_get_ocl_version(ker->opaque) >= 200) {
+ // pass the starting of constant address space
+ int32_t constant_addrspace = interp_kernel_get_curbe_offset(ker->opaque, GBE_CURBE_CONSTANT_ADDRSPACE, 0);
+ if (constant_addrspace >= 0) {
+ size_t global_const_size = interp_program_get_global_constant_size(ker->program->opaque);
+ if (global_const_size > 0) {
+ *(uint64_t*)(ker->curbe + constant_addrspace) = (uint64_t)ker->program->global_data_ptr;
+ cl_gpgpu_bind_buf(gpgpu, ker->program->global_data, constant_addrspace, 0, ALIGN(global_const_size, getpagesize()), BTI_CONSTANT);
+ }
+ }
+ return 0;
+ }
+ // TODO this is only valid for OpenCL 1.2,
+ // under ocl1.2 we gather all constant into one dedicated surface.
+ // but in 2.0 we put program global into one surface, but constants
+ // pass through kernel argument in each separate buffer
int32_t arg;
size_t offset = 0;
uint32_t raw_size = 0, aligned_size =0;