Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 3.27 KB

OpenCLBuiltIn.md

File metadata and controls

72 lines (53 loc) · 3.27 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 subslice ID for current slice */
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();
}

Note, that described instrinsics will work correctly only with Debug or ReleaseInternal builds of Intel(R) Graphics Compute Runtime for oneAPI Level Zero and OpenCL(TM) Driver and Intel(R) Processor Graphics Compiler.

Usage Details

Samples