Skip to content

Latest commit

 

History

History
73 lines (54 loc) · 3.1 KB

OpenCLBuiltIn.md

File metadata and controls

73 lines (54 loc) · 3.1 KB

OpenCL(TM) Built-In Intrinsics

Overview

This chapter describes OpenCL(TM) built-in intrinsics one may use inside the kernel code to retrieve some additional instruction-level information from Intel(R) Processor Graphics execution unit (EU).

Supported Runtimes:

Supported OS:

  • Linux
  • Windows

Supported HW:

  • Intel(R) Processor Graphics GEN9+

Needed Headers:

Needed Libraries:

How To Use

The following instrinsics are currently available:

/* Returns the value from GPU EU timestamp register */
ulong __attribute__((overloadable)) intel_get_cycle_counter( void );

/* Returns active channel mask for current GPU hardware thread */
uint __attribute__((overloadable)) intel_get_active_channel_mask( void );

/* Returns the value for target control register */
uint __attribute__((overloadable)) intel_get_control_register( uint reg );

/* Returns global GPU hardware thread ID across the device */
uint __attribute__((overloadable)) intel_get_hw_thread_id( void );

/* Returns global GPU slice ID */
uint __attribute__((overloadable)) intel_get_slice_id( void );

/* Returns GPU dual subslice ID for current slice or 0 (depends on HW) */
uint __attribute__((overloadable)) intel_get_dual_subslice_id( void );

/* Returns GPU subslice ID for current slice or dual subslice (depends on HW) */
uint __attribute__((overloadable)) intel_get_subslice_id( void );

/* Returns GPU EU ID for current subslice */
uint __attribute__((overloadable)) intel_get_eu_id( void );

/* Returns GPU hardware thread ID for current EU */
uint __attribute__((overloadable)) intel_get_eu_thread_id( void );

/* Pauses current GPU hardware thread for (32 * value) cycles  */
void __attribute__((overloadable)) intel_eu_thread_pause( uint value );

To use them inside an OpenCL(TM) kernel, one need to declare their prototypes first and then use as normal functions:

ulong __attribute__((overloadable)) intel_get_cycle_counter( void );

__kernel kernel(/*...*/) {
  ulong thread_start = intel_get_cycle_counter();
  /* do some computations */
  ulong thread_end = intel_get_cycle_counter();
}

Usage Details

Samples