Skip to content

Commit b04034a

Browse files
authored
add APIs and enums for cl_intel_unified_shared_memory (#65)
* add APIs and enums for cl_intel_unified_shared_memory * remove CL_MEM_ALLOC_DEFAULT_INTEL This value is not in the latest rev of the spec. * add aliases for cl_mem_migration_flags Fixes compilation pre-OpenCL 1.2, where cl_mem_migration_flags is not defined. * for now, remove aliases to cl_mem_migration_flags Instead of adding aliases to cl_mem_migration_flags and associated enums, restrict the clEnqueueMigrateMemINTEL API to OpenCL 1.2 or newer, which satisfies all current use-cases. If needed, the aliases can be re-introduced at a later date, since adding them does not change the ABI.
1 parent dbb17cd commit b04034a

1 file changed

Lines changed: 273 additions & 3 deletions

File tree

CL/cl_ext_intel.h

Lines changed: 273 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
******************************************************************************/
1717
/*****************************************************************************\
1818
19-
Copyright (c) 2013-2019 Intel Corporation All Rights Reserved.
19+
Copyright (c) 2013-2020 Intel Corporation All Rights Reserved.
2020
2121
THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2222
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -283,8 +283,8 @@ typedef cl_uint cl_diagnostics_verbose_level;
283283
#define CL_DEVICE_AVC_ME_SUPPORTS_TEXTURE_SAMPLER_USE_INTEL 0x410C
284284
#define CL_DEVICE_AVC_ME_SUPPORTS_PREEMPTION_INTEL 0x410D
285285

286-
#define CL_AVC_ME_VERSION_0_INTEL 0x0; // No support.
287-
#define CL_AVC_ME_VERSION_1_INTEL 0x1; // First supported version.
286+
#define CL_AVC_ME_VERSION_0_INTEL 0x0 /* No support. */
287+
#define CL_AVC_ME_VERSION_1_INTEL 0x1 /* First supported version. */
288288

289289
#define CL_AVC_ME_MAJOR_16x16_INTEL 0x0
290290
#define CL_AVC_ME_MAJOR_16x8_INTEL 0x1
@@ -405,6 +405,276 @@ typedef cl_uint cl_diagnostics_verbose_level;
405405
#define CL_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL 0x0
406406
#define CL_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL 0x1
407407

408+
/*******************************************
409+
* cl_intel_unified_shared_memory extension *
410+
********************************************/
411+
412+
/* These APIs are in sync with Revision O of the cl_intel_unified_shared_memory spec! */
413+
414+
#define cl_intel_unified_shared_memory 1
415+
416+
/* cl_device_info */
417+
#define CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL 0x4190
418+
#define CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL 0x4191
419+
#define CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4192
420+
#define CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4193
421+
#define CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL 0x4194
422+
423+
typedef cl_bitfield cl_device_unified_shared_memory_capabilities_intel;
424+
425+
/* cl_device_unified_shared_memory_capabilities_intel - bitfield */
426+
#define CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL (1 << 0)
427+
#define CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL (1 << 1)
428+
#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL (1 << 2)
429+
#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL (1 << 3)
430+
431+
typedef cl_bitfield cl_mem_properties_intel;
432+
433+
/* cl_mem_properties_intel */
434+
#define CL_MEM_ALLOC_FLAGS_INTEL 0x4195
435+
436+
typedef cl_bitfield cl_mem_alloc_flags_intel;
437+
438+
/* cl_mem_alloc_flags_intel - bitfield */
439+
#define CL_MEM_ALLOC_WRITE_COMBINED_INTEL (1 << 0)
440+
441+
typedef cl_uint cl_mem_info_intel;
442+
443+
/* cl_mem_alloc_info_intel */
444+
#define CL_MEM_ALLOC_TYPE_INTEL 0x419A
445+
#define CL_MEM_ALLOC_BASE_PTR_INTEL 0x419B
446+
#define CL_MEM_ALLOC_SIZE_INTEL 0x419C
447+
#define CL_MEM_ALLOC_DEVICE_INTEL 0x419D
448+
/* Enum values 0x419E-0x419F are reserved for future queries. */
449+
450+
typedef cl_uint cl_unified_shared_memory_type_intel;
451+
452+
/* cl_unified_shared_memory_type_intel */
453+
#define CL_MEM_TYPE_UNKNOWN_INTEL 0x4196
454+
#define CL_MEM_TYPE_HOST_INTEL 0x4197
455+
#define CL_MEM_TYPE_DEVICE_INTEL 0x4198
456+
#define CL_MEM_TYPE_SHARED_INTEL 0x4199
457+
458+
typedef cl_uint cl_mem_advice_intel;
459+
460+
/* cl_mem_advice_intel */
461+
/* Enum values 0x4208-0x420F are reserved for future memory advices. */
462+
463+
/* cl_kernel_exec_info */
464+
#define CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL 0x4200
465+
#define CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL 0x4201
466+
#define CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL 0x4202
467+
#define CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL 0x4203
468+
469+
/* cl_command_type */
470+
#define CL_COMMAND_MEMFILL_INTEL 0x4204
471+
#define CL_COMMAND_MEMCPY_INTEL 0x4205
472+
#define CL_COMMAND_MIGRATEMEM_INTEL 0x4206
473+
#define CL_COMMAND_MEMADVISE_INTEL 0x4207
474+
475+
extern CL_API_ENTRY void* CL_API_CALL
476+
clHostMemAllocINTEL(
477+
cl_context context,
478+
const cl_mem_properties_intel* properties,
479+
size_t size,
480+
cl_uint alignment,
481+
cl_int* errcode_ret);
482+
483+
typedef CL_API_ENTRY void* (CL_API_CALL *
484+
clHostMemAllocINTEL_fn)(
485+
cl_context context,
486+
const cl_mem_properties_intel* properties,
487+
size_t size,
488+
cl_uint alignment,
489+
cl_int* errcode_ret);
490+
491+
extern CL_API_ENTRY void* CL_API_CALL
492+
clDeviceMemAllocINTEL(
493+
cl_context context,
494+
cl_device_id device,
495+
const cl_mem_properties_intel* properties,
496+
size_t size,
497+
cl_uint alignment,
498+
cl_int* errcode_ret);
499+
500+
typedef CL_API_ENTRY void* (CL_API_CALL *
501+
clDeviceMemAllocINTEL_fn)(
502+
cl_context context,
503+
cl_device_id device,
504+
const cl_mem_properties_intel* properties,
505+
size_t size,
506+
cl_uint alignment,
507+
cl_int* errcode_ret);
508+
509+
extern CL_API_ENTRY void* CL_API_CALL
510+
clSharedMemAllocINTEL(
511+
cl_context context,
512+
cl_device_id device,
513+
const cl_mem_properties_intel* properties,
514+
size_t size,
515+
cl_uint alignment,
516+
cl_int* errcode_ret);
517+
518+
typedef CL_API_ENTRY void* (CL_API_CALL *
519+
clSharedMemAllocINTEL_fn)(
520+
cl_context context,
521+
cl_device_id device,
522+
const cl_mem_properties_intel* properties,
523+
size_t size,
524+
cl_uint alignment,
525+
cl_int* errcode_ret);
526+
527+
extern CL_API_ENTRY cl_int CL_API_CALL
528+
clMemFreeINTEL(
529+
cl_context context,
530+
void* ptr);
531+
532+
typedef CL_API_ENTRY cl_int (CL_API_CALL *
533+
clMemFreeINTEL_fn)(
534+
cl_context context,
535+
void* ptr);
536+
537+
extern CL_API_ENTRY cl_int CL_API_CALL
538+
clGetMemAllocInfoINTEL(
539+
cl_context context,
540+
const void* ptr,
541+
cl_mem_info_intel param_name,
542+
size_t param_value_size,
543+
void* param_value,
544+
size_t* param_value_size_ret);
545+
546+
typedef CL_API_ENTRY cl_int (CL_API_CALL *
547+
clGetMemAllocInfoINTEL_fn)(
548+
cl_context context,
549+
const void* ptr,
550+
cl_mem_info_intel param_name,
551+
size_t param_value_size,
552+
void* param_value,
553+
size_t* param_value_size_ret);
554+
555+
extern CL_API_ENTRY cl_int CL_API_CALL
556+
clSetKernelArgMemPointerINTEL(
557+
cl_kernel kernel,
558+
cl_uint arg_index,
559+
const void* arg_value);
560+
561+
typedef CL_API_ENTRY cl_int (CL_API_CALL *
562+
clSetKernelArgMemPointerINTEL_fn)(
563+
cl_kernel kernel,
564+
cl_uint arg_index,
565+
const void* arg_value);
566+
567+
extern CL_API_ENTRY cl_int CL_API_CALL
568+
clEnqueueMemsetINTEL( /* Deprecated */
569+
cl_command_queue command_queue,
570+
void* dst_ptr,
571+
cl_int value,
572+
size_t size,
573+
cl_uint num_events_in_wait_list,
574+
const cl_event* event_wait_list,
575+
cl_event* event);
576+
577+
typedef CL_API_ENTRY cl_int (CL_API_CALL *
578+
clEnqueueMemsetINTEL_fn)( /* Deprecated */
579+
cl_command_queue command_queue,
580+
void* dst_ptr,
581+
cl_int value,
582+
size_t size,
583+
cl_uint num_events_in_wait_list,
584+
const cl_event* event_wait_list,
585+
cl_event* event);
586+
587+
extern CL_API_ENTRY cl_int CL_API_CALL
588+
clEnqueueMemFillINTEL(
589+
cl_command_queue command_queue,
590+
void* dst_ptr,
591+
const void* pattern,
592+
size_t pattern_size,
593+
size_t size,
594+
cl_uint num_events_in_wait_list,
595+
const cl_event* event_wait_list,
596+
cl_event* event);
597+
598+
typedef CL_API_ENTRY cl_int (CL_API_CALL *
599+
clEnqueueMemFillINTEL_fn)(
600+
cl_command_queue command_queue,
601+
void* dst_ptr,
602+
const void* pattern,
603+
size_t pattern_size,
604+
size_t size,
605+
cl_uint num_events_in_wait_list,
606+
const cl_event* event_wait_list,
607+
cl_event* event);
608+
609+
extern CL_API_ENTRY cl_int CL_API_CALL
610+
clEnqueueMemcpyINTEL(
611+
cl_command_queue command_queue,
612+
cl_bool blocking,
613+
void* dst_ptr,
614+
const void* src_ptr,
615+
size_t size,
616+
cl_uint num_events_in_wait_list,
617+
const cl_event* event_wait_list,
618+
cl_event* event);
619+
620+
typedef CL_API_ENTRY cl_int (CL_API_CALL *
621+
clEnqueueMemcpyINTEL_fn)(
622+
cl_command_queue command_queue,
623+
cl_bool blocking,
624+
void* dst_ptr,
625+
const void* src_ptr,
626+
size_t size,
627+
cl_uint num_events_in_wait_list,
628+
const cl_event* event_wait_list,
629+
cl_event* event);
630+
631+
#ifdef CL_VERSION_1_2
632+
633+
/* Because these APIs use cl_mem_migration_flags, they require
634+
OpenCL 1.2: */
635+
636+
extern CL_API_ENTRY cl_int CL_API_CALL
637+
clEnqueueMigrateMemINTEL(
638+
cl_command_queue command_queue,
639+
const void* ptr,
640+
size_t size,
641+
cl_mem_migration_flags flags,
642+
cl_uint num_events_in_wait_list,
643+
const cl_event* event_wait_list,
644+
cl_event* event);
645+
646+
typedef CL_API_ENTRY cl_int (CL_API_CALL *
647+
clEnqueueMigrateMemINTEL_fn)(
648+
cl_command_queue command_queue,
649+
const void* ptr,
650+
size_t size,
651+
cl_mem_migration_flags flags,
652+
cl_uint num_events_in_wait_list,
653+
const cl_event* event_wait_list,
654+
cl_event* event);
655+
656+
#endif
657+
658+
extern CL_API_ENTRY cl_int CL_API_CALL
659+
clEnqueueMemAdviseINTEL(
660+
cl_command_queue command_queue,
661+
const void* ptr,
662+
size_t size,
663+
cl_mem_advice_intel advice,
664+
cl_uint num_events_in_wait_list,
665+
const cl_event* event_wait_list,
666+
cl_event* event);
667+
668+
typedef CL_API_ENTRY cl_int (CL_API_CALL *
669+
clEnqueueMemAdviseINTEL_fn)(
670+
cl_command_queue command_queue,
671+
const void* ptr,
672+
size_t size,
673+
cl_mem_advice_intel advice,
674+
cl_uint num_events_in_wait_list,
675+
const cl_event* event_wait_list,
676+
cl_event* event);
677+
408678
#ifdef __cplusplus
409679
}
410680
#endif

0 commit comments

Comments
 (0)