Init Driver Properties Extension

Init Driver Properties Extension#

Introduced in Level Zero version 1.20

API#

Declaring Driver-Wide Properties at Initialization#

This extension lets an application declare driver-wide properties for the driver(s) being initialized. The application supplies the properties in a ze_init_driver_properties_ext_desc_t struct, chained from the pNext member of ze_init_driver_type_desc_t when calling zeInitDrivers. It is a general-purpose extension point: additional flags may be added to ze_init_driver_properties_ext_flags_t in the future without requiring a new structure or a new ze_structure_type_t value.

Supported flags:

  • OPTIMIZE_MEMORY requests that the driver(s) being initialized reduce their memory footprint, mirroring ZE_CONTEXT_FLAG_OPTIMIZE_MEMORY but applied at driver initialization instead of per-context.

  • OPTIMIZE_PERFORMANCE explicitly requests that the driver(s) being initialized optimize for performance, mirroring ZE_CONTEXT_FLAG_OPTIMIZE_PERFORMANCE but applied at driver initialization instead of per-context.

The following rules apply:

  • When the OPTIMIZE_MEMORY flag is set, it establishes the default memory-optimization behavior for the driver(s) initialized by this call.

  • When the OPTIMIZE_PERFORMANCE flag is set, it establishes the default performance-optimization behavior for the driver(s) initialized by this call. OPTIMIZE_MEMORY and OPTIMIZE_PERFORMANCE are mutually exclusive; if both are set, zeInitDrivers returns ZE_RESULT_ERROR_INVALID_ARGUMENT.

  • If neither flag is set, the memory/performance trade-off for the driver(s) initialized by this call is driver implementation specific.

  • Contexts subsequently created via zeContextCreate or zeContextCreateEx without an explicit ZE_CONTEXT_FLAG_OPTIMIZE_MEMORY or ZE_CONTEXT_FLAG_OPTIMIZE_PERFORMANCE flag inherit this driver-level default, if one was established; otherwise the trade-off remains driver implementation specific.

  • A context that explicitly sets its own ze_context_flags_t flags overrides the driver-level default for that context.

  • The default context returned by zeDriverGetDefaultContext is created by the driver itself, not via zeContextCreate or zeContextCreateEx, so the application cannot supply ze_context_flags_t for it. The default context follows the driver-level default established by this structure, if one was established; otherwise its memory/performance trade-off is driver implementation specific.

  • If this structure is not provided, the driver must assume no driver-wide properties were requested and fall back to its standard default behavior for each unset flag.

  • This structure has no effect on drivers already initialized by a prior call to zeInitDrivers or zeInit; those drivers keep whatever behavior was in effect when they were first initialized.