INSERT_REG(goffset0, GLOBAL_OFFSET_X, 1)
INSERT_REG(goffset1, GLOBAL_OFFSET_Y, 1)
INSERT_REG(goffset2, GLOBAL_OFFSET_Z, 1)
+ INSERT_REG(workdim, WORK_DIM, 1)
INSERT_REG(numgroup0, GROUP_NUM_X, 1)
INSERT_REG(numgroup1, GROUP_NUM_Y, 1)
INSERT_REG(numgroup2, GROUP_NUM_Z, 1)
reg == ir::ocl::goffset0 ||
reg == ir::ocl::goffset1 ||
reg == ir::ocl::goffset2 ||
+ reg == ir::ocl::workdim ||
reg == ir::ocl::constoffst)
return true;
return false;
allocatePayloadReg(GBE_CURBE_GLOBAL_OFFSET_X, ocl::goffset0);
allocatePayloadReg(GBE_CURBE_GLOBAL_OFFSET_Y, ocl::goffset1);
allocatePayloadReg(GBE_CURBE_GLOBAL_OFFSET_Z, ocl::goffset2);
+ allocatePayloadReg(GBE_CURBE_WORK_DIM, ocl::workdim);
allocatePayloadReg(GBE_CURBE_GROUP_NUM_X, ocl::numgroup0);
allocatePayloadReg(GBE_CURBE_GROUP_NUM_Y, ocl::numgroup1);
allocatePayloadReg(GBE_CURBE_GROUP_NUM_Z, ocl::numgroup2);
GBE_CURBE_GROUP_NUM_X,
GBE_CURBE_GROUP_NUM_Y,
GBE_CURBE_GROUP_NUM_Z,
+ GBE_CURBE_WORK_DIM,
GBE_CURBE_GLOBAL_CONSTANT_OFFSET,
GBE_CURBE_GLOBAL_CONSTANT_DATA,
GBE_CURBE_IMAGE_INFO,
DECL_NEW_REG(FAMILY_DWORD, barrierid);
DECL_NEW_REG(FAMILY_DWORD, threadn);
DECL_NEW_REG(FAMILY_DWORD, constoffst);
+ DECL_NEW_REG(FAMILY_DWORD, workdim);
}
#undef DECL_NEW_REG
static const Register barrierid = Register(20);// barrierid
static const Register threadn = Register(21); // number of threads
static const Register constoffst = Register(22); // offset of global constant array's curbe
- static const uint32_t regNum = 23; // number of special registers
+ static const Register workdim = Register(23); // work dimention.
+ static const uint32_t regNum = 24; // number of special registers
extern const char *specialRegMean[]; // special register name.
} /* namespace ocl */
regTranslator.newScalarProxy(ir::ocl::goffset1, dst); break;
case GEN_OCL_GET_GLOBAL_OFFSET2:
regTranslator.newScalarProxy(ir::ocl::goffset2, dst); break;
+ case GEN_OCL_GET_WORK_DIM:
+ regTranslator.newScalarProxy(ir::ocl::workdim, dst); break;
case GEN_OCL_COS:
case GEN_OCL_SIN:
case GEN_OCL_SQR:
DECL_LLVM_GEN_FUNCTION(GET_GLOBAL_OFFSET0, __gen_ocl_get_global_offset0)
DECL_LLVM_GEN_FUNCTION(GET_GLOBAL_OFFSET1, __gen_ocl_get_global_offset1)
DECL_LLVM_GEN_FUNCTION(GET_GLOBAL_OFFSET2, __gen_ocl_get_global_offset2)
+DECL_LLVM_GEN_FUNCTION(GET_WORK_DIM, __gen_ocl_get_work_dim)
// Math function
DECL_LLVM_GEN_FUNCTION(ABS, __gen_ocl_fabs)
/////////////////////////////////////////////////////////////////////////////
// Work Items functions (see 6.11.1 of OCL 1.1 spec)
/////////////////////////////////////////////////////////////////////////////
-// TODO get_global_offset
-// TODO get_work_dim
+
+PURE CONST uint __gen_ocl_get_work_dim(void);
+INLINE uint get_work_dim(void) {
+ return __gen_ocl_get_work_dim();
+}
#define DECL_INTERNAL_WORK_ITEM_FN(NAME) \
PURE CONST unsigned int __gen_ocl_##NAME##0(void); \
DECL_INTERNAL_WORK_ITEM_FN(get_local_id)
DECL_INTERNAL_WORK_ITEM_FN(get_local_size)
DECL_INTERNAL_WORK_ITEM_FN(get_global_size)
+DECL_INTERNAL_WORK_ITEM_FN(get_global_offset)
DECL_INTERNAL_WORK_ITEM_FN(get_num_groups)
#undef DECL_INTERNAL_WORK_ITEM_FN
DECL_PUBLIC_WORK_ITEM_FN(get_local_id)
DECL_PUBLIC_WORK_ITEM_FN(get_local_size)
DECL_PUBLIC_WORK_ITEM_FN(get_global_size)
+DECL_PUBLIC_WORK_ITEM_FN(get_global_offset)
DECL_PUBLIC_WORK_ITEM_FN(get_num_groups)
#undef DECL_PUBLIC_WORK_ITEM_FN
/* Do device specific checks are enqueue the kernel */
err = cl_command_queue_ND_range(command_queue,
kernel,
+ work_dim,
fixed_global_off,
fixed_global_sz,
fixed_local_sz);
}
#endif
-extern cl_int cl_command_queue_ND_range_gen7(cl_command_queue, cl_kernel, const size_t *, const size_t *, const size_t *);
+extern cl_int cl_command_queue_ND_range_gen7(cl_command_queue, cl_kernel, uint32_t, const size_t *, const size_t *, const size_t *);
static cl_int
cl_kernel_check_args(cl_kernel k)
LOCAL cl_int
cl_command_queue_ND_range(cl_command_queue queue,
cl_kernel k,
+ const uint32_t work_dim,
const size_t *global_wk_off,
const size_t *global_wk_sz,
const size_t *local_wk_sz)
#endif /* USE_FULSIM */
if (ver == 7 || ver == 75)
- TRY (cl_command_queue_ND_range_gen7, queue, k, global_wk_off, global_wk_sz, local_wk_sz);
+ TRY (cl_command_queue_ND_range_gen7, queue, k, work_dim, global_wk_off, global_wk_sz, local_wk_sz);
else
FATAL ("Unknown Gen Device");
/* Map ND range kernel from OCL API */
extern cl_int cl_command_queue_ND_range(cl_command_queue queue,
cl_kernel ker,
+ const uint32_t work_dim,
const size_t *global_work_offset,
const size_t *global_work_size,
const size_t *local_work_size);
/* Will return the total amount of slm used */
static int32_t
cl_curbe_fill(cl_kernel ker,
+ const uint32_t work_dim,
const size_t *global_wk_off,
const size_t *global_wk_sz,
const size_t *local_wk_sz,
UPLOAD(GBE_CURBE_GROUP_NUM_Y, global_wk_sz[1]/local_wk_sz[1]);
UPLOAD(GBE_CURBE_GROUP_NUM_Z, global_wk_sz[2]/local_wk_sz[2]);
UPLOAD(GBE_CURBE_THREAD_NUM, thread_n);
+ UPLOAD(GBE_CURBE_WORK_DIM, work_dim);
UPLOAD(GBE_CURBE_GLOBAL_CONSTANT_OFFSET, gbe_kernel_get_curbe_offset(ker->opaque, GBE_CURBE_GLOBAL_CONSTANT_DATA, 0) + 32);
#undef UPLOAD
LOCAL cl_int
cl_command_queue_ND_range_gen7(cl_command_queue queue,
cl_kernel ker,
+ const uint32_t work_dim,
const size_t *global_wk_off,
const size_t *global_wk_sz,
const size_t *local_wk_sz)
/* Curbe step 1: fill the constant buffer data shared by all threads */
if (ker->curbe)
- kernel.slm_sz = cl_curbe_fill(ker, global_wk_off, global_wk_sz, local_wk_sz, thread_n);
+ kernel.slm_sz = cl_curbe_fill(ker, work_dim, global_wk_off, global_wk_sz, local_wk_sz, thread_n);
/* Setup the kernel */
cl_gpgpu_state_init(gpgpu, ctx->device->max_compute_unit, cst_sz / 32);