Skip to content

Commit e767c1b

Browse files
committed
Copy and use compute-runtime experimental headers
1 parent 3dd399b commit e767c1b

22 files changed

+1679
-3
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This subdirectory contains a copy of Level Zero experimental headers.
2+
Repo: https://github.com/intel/compute-runtime
3+
Tag: 25.44.36015.5
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (C) 2025 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include <level_zero/ze_api.h>
11+
12+
typedef ze_result_t(ZE_APICALL *ze_pfnCommandListGetNextCommandIdExpCb_t)(
13+
ze_command_list_handle_t hCommandList,
14+
const ze_mutable_command_id_exp_desc_t *desc, uint64_t *pCommandId);
15+
16+
typedef ze_result_t(ZE_APICALL *ze_pfnCommandListUpdateMutableCommandsExpCb_t)(
17+
ze_command_list_handle_t hCommandList,
18+
const ze_mutable_commands_exp_desc_t *desc);
19+
20+
typedef ze_result_t(
21+
ZE_APICALL *ze_pfnCommandListUpdateMutableCommandSignalEventExpCb_t)(
22+
ze_command_list_handle_t hCommandList, uint64_t commandId,
23+
ze_event_handle_t hSignalEvent);
24+
25+
typedef ze_result_t(
26+
ZE_APICALL *ze_pfnCommandListUpdateMutableCommandWaitEventsExpCb_t)(
27+
ze_command_list_handle_t hCommandList, uint64_t commandId,
28+
uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents);
29+
30+
typedef ze_result_t(
31+
ZE_APICALL *ze_pfnCommandListGetNextCommandIdWithKernelsExpCb_t)(
32+
ze_command_list_handle_t hCommandList,
33+
const ze_mutable_command_id_exp_desc_t *desc, uint32_t numKernels,
34+
ze_kernel_handle_t *phKernels, uint64_t *pCommandId);
35+
36+
typedef ze_result_t(
37+
ZE_APICALL *ze_pfnCommandListUpdateMutableCommandKernelsExpCb_t)(
38+
ze_command_list_handle_t hCommandList, uint32_t numKernels,
39+
uint64_t *pCommandId, ze_kernel_handle_t *phKernels);
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
/*
2+
* Copyright (C) 2025 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "level_zero/ze_stypes.h"
11+
#include <level_zero/ze_api.h>
12+
13+
///////////////////////////////////////////////////////////////////////////////
14+
/// @brief Label handle.
15+
typedef struct _zex_label_handle_t *zex_label_handle_t;
16+
17+
///////////////////////////////////////////////////////////////////////////////
18+
/// @brief Label descriptor.
19+
typedef struct _zex_label_desc_t {
20+
ze_structure_type_ext_t stype =
21+
ZEX_STRUCTURE_TYPE_LABEL_DESCRIPTOR; ///< [in] type of this structure
22+
const void *pNext =
23+
nullptr; ///< [in][optional] pointer to extension-specific structure
24+
25+
const char *name; ///< [in][optional] null-terminated name of the label
26+
uint32_t alignment; ///< [in][optional] minimum alignment of the label
27+
} zex_label_desc_t;
28+
29+
///////////////////////////////////////////////////////////////////////////////
30+
/// @brief Operand flags
31+
typedef uint32_t zex_operand_flags_t;
32+
typedef enum _zex_operand_flag_t {
33+
ZEX_OPERAND_FLAG_USES_VARIABLE =
34+
ZE_BIT(0), // variable is being used - passed via memory
35+
ZEX_OPERAND_FLAG_JUMP_ON_CLEAR =
36+
ZE_BIT(1) // jump on '0', instead of default '1'
37+
} zex_operand_flag_t;
38+
39+
///////////////////////////////////////////////////////////////////////////////
40+
/// @brief Operand descriptor.
41+
typedef struct _zex_operand_desc_t {
42+
ze_structure_type_ext_t stype =
43+
ZEX_STRUCTURE_TYPE_OPERAND_DESCRIPTOR; ///< [in] type of this structure
44+
const void *pNext =
45+
nullptr; ///< [in][optional] pointer to extension-specific structure
46+
47+
void *memory; // if memory is NULL then offset is interpreted as MMIO
48+
// if flag ZEX_OPERAND_FLAG_USES_VARIABLE is set memory is
49+
// interpreted as variable
50+
size_t offset; // offset within memory or register MMIO
51+
uint32_t size; // operand size - dword
52+
zex_operand_flags_t flags; // flags
53+
} zex_operand_desc_t;
54+
55+
#if defined(__cplusplus)
56+
extern "C" {
57+
#endif
58+
///////////////////////////////////////////////////////////////////////////////
59+
/// @brief Creates/returns label based on name provided in
60+
/// label descriptor.
61+
///
62+
/// @details
63+
/// - When label with the name provided in label descriptor does not
64+
/// exist new label is created.
65+
/// - If label with provided name exists it's returned.
66+
/// - Label at creation is undefined (points to nothing).
67+
///
68+
/// @returns
69+
/// - ZE_RESULT_SUCCESS
70+
/// - ZE_RESULT_ERROR_INVALID_ARGUMENT
71+
/// + nullptr == hCommandList
72+
/// + nullptr == pLabelDesc
73+
/// + nullptr == phLabel
74+
/// + pLabelDesc->alignment & (pLabelDesc->alignment - 1) != 0
75+
/// - ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
76+
/// + bad_alloc
77+
ze_result_t ZE_APICALL zexCommandListGetLabel(
78+
ze_command_list_handle_t hCommandList, ///< [in] handle of command list
79+
const zex_label_desc_t *pLabelDesc, ///< [in] pointer to label descriptor
80+
zex_label_handle_t *phLabel ///< [out] pointer to handle of label
81+
);
82+
83+
///////////////////////////////////////////////////////////////////////////////
84+
/// @brief Sets label to point to current location in command list.
85+
///
86+
/// @details
87+
/// - Sets label address to current location.
88+
/// - All previous jumps to this label are patched with label's address.
89+
/// - Future jumps to this label will be patched with label's address.
90+
/// - Label can be set only once.
91+
/// - Label must be located in the same command list, as it was created
92+
///
93+
/// @returns
94+
/// - ZE_RESULT_SUCCESS
95+
/// - ZE_RESULT_ERROR_INVALID_ARGUMENT
96+
/// + nullptr == hCommandList
97+
/// + nullptr == hLabel
98+
/// - ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
99+
/// + variable already set
100+
/// - ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT
101+
/// + label's address is not aligned to it's alignment
102+
ze_result_t ZE_APICALL zexCommandListSetLabel(
103+
ze_command_list_handle_t hCommandList, ///< [in] handle of command list
104+
zex_label_handle_t hLabel ///< [in] handle of label
105+
);
106+
107+
///////////////////////////////////////////////////////////////////////////////
108+
/// @brief Appends jump to label predicated by condition.
109+
///
110+
/// @details
111+
/// If condition is present:
112+
/// If condition->memory is present:
113+
/// If ZEX_OPERAND_FLAG_USES_VARIABLE flag is set:
114+
/// - Append MI_LOAD_REGISTER_MEM
115+
/// reg = PREDICATE_RESULT_2
116+
/// memAddr = gpu address of buffer variable
117+
/// Else:
118+
/// - Append MI_LOAD_REGISTER_MEM
119+
/// reg = PREDICATE_RESULT_2
120+
/// memAddr = pCondition->memory + pCondition->offset
121+
/// Else:
122+
/// - Append MI_LOAD_REGISTER_REG
123+
/// regDst = PREDICATE_RESULT_2
124+
/// regSrc = pCondition->offset (need to pass MMIO)
125+
///
126+
/// If ZEX_OPERAND_FLAG_JUMP_ON_CLEAR flag is set: // jumps when '0'
127+
/// - Append MI_SET_PREDICATE(ENABLE_ON_SET)
128+
/// Else: // jumps when '1'
129+
/// - Append MI_SET_PREDICATE(ENABLE_ON_CLEAR)
130+
///
131+
/// - Append MI_BATCH_BUFFER_START
132+
/// predicationEnabled = condition is present
133+
/// jumpAddress = label's address
134+
/// - Append MI_SET_PREDICATE(DISABLE) - after BB_START
135+
/// - Append MI_SET_PREDICATE(DISABLE) - at label's address
136+
///
137+
/// @returns
138+
/// - ZE_RESULT_SUCCESS
139+
/// - ZE_RESULT_ERROR_INVALID_ARGUMENT
140+
/// + nullptr == hCommandList
141+
/// + nullptr == hLabel
142+
ze_result_t ZE_APICALL zexCommandListAppendJump(
143+
ze_command_list_handle_t hCommandList, ///< [in] handle of command list
144+
zex_label_handle_t hLabel, ///< [in] handle of label
145+
zex_operand_desc_t *pCondition ///< [in][opt] pointer to operand
146+
);
147+
148+
typedef ze_result_t(ZE_APICALL *zex_pfnCommandListGetLabelCb_t)(
149+
ze_command_list_handle_t hCommandList, const zex_label_desc_t *pLabelDesc,
150+
zex_label_handle_t *phLabel);
151+
152+
typedef ze_result_t(ZE_APICALL *zex_pfnCommandListSetLabelCb_t)(
153+
ze_command_list_handle_t hCommandList, zex_label_handle_t hLabel);
154+
155+
typedef ze_result_t(ZE_APICALL *zex_pfnCommandListAppendJumpCb_t)(
156+
ze_command_list_handle_t hCommandList, zex_label_handle_t hLabel,
157+
zex_operand_desc_t *pCondition);
158+
159+
#if defined(__cplusplus)
160+
} // extern "C"
161+
#endif
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (C) 2025 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "level_zero/driver_experimental/mcl_ext/zex_mutable_cmdlist_variable_ext.h"
11+
#include <level_zero/ze_api.h>
12+
13+
#if defined(__cplusplus)
14+
extern "C" {
15+
#endif
16+
///////////////////////////////////////////////////////////////////////////////
17+
/// @brief Sets kernel group size to provided variable.
18+
ze_result_t ZE_APICALL zexKernelSetVariableGroupSize(
19+
ze_kernel_handle_t hKernel, ///< [in] handle of kernel
20+
zex_variable_handle_t hGroupSizeVariable ///< [in] handle of variable
21+
);
22+
23+
///////////////////////////////////////////////////////////////////////////////
24+
/// @brief Appends kernel launch to command list with variable group size.
25+
ze_result_t ZE_APICALL zexCommandListAppendVariableLaunchKernel(
26+
ze_command_list_handle_t
27+
hCommandList, ///< [in] hnadle of mutable command list
28+
ze_kernel_handle_t hKernel, ///< [in] handle of kernel
29+
zex_variable_handle_t hGroupCountVariable, ///< [in] handle of variable
30+
ze_event_handle_t hSignalEvent, ///< [in] handle to signal event
31+
uint32_t numWaitEvents, ///< [in] num events to wait for
32+
ze_event_handle_t *phWaitEvents); ///< [in] array of events to wait for
33+
34+
typedef ze_result_t(ZE_APICALL *zex_pfnKernelSetVariableGroupSizeCb_t)(
35+
ze_kernel_handle_t hKernel, zex_variable_handle_t hGroupSizeVariable);
36+
37+
typedef ze_result_t(
38+
ZE_APICALL *zex_pfnCommandListAppendVariableLaunchKernelCb_t)(
39+
ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel,
40+
zex_variable_handle_t hGroupCountVariable, ze_event_handle_t hSignalEvent,
41+
uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents);
42+
43+
#if defined(__cplusplus)
44+
} // extern "C"
45+
#endif
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (C) 2025 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "level_zero/driver_experimental/mcl_ext/ze_mutable_command_list_exp.h"
11+
#include "level_zero/driver_experimental/mcl_ext/zex_mutable_cmdlist_control_flow_ext.h"
12+
#include "level_zero/driver_experimental/mcl_ext/zex_mutable_cmdlist_dispatch_ext.h"
13+
#include "level_zero/driver_experimental/mcl_ext/zex_mutable_cmdlist_serialization_ext.h"
14+
#include "level_zero/driver_experimental/mcl_ext/zex_mutable_cmdlist_temp_mem_ext.h"
15+
#include "level_zero/driver_experimental/mcl_ext/zex_mutable_cmdlist_variable_ext.h"
16+
#include "level_zero/driver_experimental/mcl_ext/zex_mutable_cmdlist_variable_info_ext.h"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (C) 2025 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include <level_zero/ze_api.h>
11+
12+
#if defined(__cplusplus)
13+
extern "C" {
14+
#endif
15+
///////////////////////////////////////////////////////////////////////////////
16+
/// @brief Retrieve native MCL binary from cmdlist.
17+
ze_result_t ZE_APICALL zexCommandListGetNativeBinary(
18+
ze_command_list_handle_t
19+
hCommandList, ///< [in] handle of mutable command list
20+
void *pBinary, ///< [in,out][optional] byte pointer to native MCL binary
21+
size_t *pBinarySize, ///< [in,out] size of native MCL binary in bytes
22+
const void *pModule, ///< [in] byte pointer to module containing kernels'
23+
///< used in cmdlist
24+
size_t moduleSize ///< [in] size in bytes of module containing kernels's
25+
///< used in cmdlist
26+
);
27+
28+
///////////////////////////////////////////////////////////////////////////////
29+
/// @brief Load command list from native MCL binary.
30+
ze_result_t ZE_APICALL zexCommandListLoadNativeBinary(
31+
ze_command_list_handle_t
32+
hCommandList, ///< [in] handle of mutable command list
33+
const void *pBinary, ///< [in] byte pointer to native MCL binary
34+
size_t binarySize ///< [in] size of native MCL binary in bytes
35+
);
36+
37+
typedef ze_result_t(ZE_APICALL *zex_pfnCommandListGetNativeBinaryCb_t)(
38+
ze_command_list_handle_t hCommandList, void *pBinary, size_t *pBinarySize,
39+
const void *pModule, size_t moduleSize);
40+
41+
typedef ze_result_t(ZE_APICALL *zex_pfnCommandListLoadNativeBinaryCb_t)(
42+
ze_command_list_handle_t hCommandList, const void *pBinary,
43+
size_t binarySize);
44+
45+
#if defined(__cplusplus)
46+
} // extern "C"
47+
#endif
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright (C) 2025 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "level_zero/driver_experimental/mcl_ext/zex_mutable_cmdlist_variable_ext.h"
11+
#include "level_zero/ze_stypes.h"
12+
13+
///////////////////////////////////////////////////////////////////////////////
14+
/// @brief Temporary variable flags
15+
typedef uint32_t zex_temp_variable_flags_t;
16+
typedef enum _zex_temp_variable_flag_t {
17+
ZEX_TEMP_VARIABLE_FLAGS_IS_CONST_SIZE =
18+
ZE_BIT(0), ///< temp variable has constant size
19+
ZEX_TEMP_VARIABLE_FLAGS_IS_SCALABLE =
20+
ZE_BIT(1) ///< temp variable scales with num elements
21+
} zex_temp_variable_flag_t;
22+
23+
///////////////////////////////////////////////////////////////////////////////
24+
/// @brief Temporary variable type
25+
typedef enum _zex_temp_variable_type_t {
26+
ZEX_TEMP_VARIABLE_TYPE_CONST_SIZE = 0, ///< temp variable has constant size
27+
ZEX_TEMP_VARIABLE_TYPE_SCALABLE =
28+
1 ///< temp variable scales with num elements
29+
} zex_temp_variable_type_t;
30+
31+
///////////////////////////////////////////////////////////////////////////////
32+
/// @brief Temporary variable descriptor
33+
typedef struct _zex_temp_variable_desc_t {
34+
ze_structure_type_ext_t stype = ZEX_STRUCTURE_TYPE_TEMP_VARIABLE_DESCRIPTOR;
35+
const void *pNext = nullptr;
36+
37+
zex_temp_variable_flags_t flags;
38+
size_t size;
39+
} zex_temp_variable_desc_t;
40+
41+
#if defined(__cplusplus)
42+
extern "C" {
43+
#endif
44+
45+
///////////////////////////////////////////////////////////////////////////////
46+
/// @brief Sets number of elements used by scalable temporary variables.
47+
ze_result_t ZE_APICALL zexCommandListTempMemSetEleCount(
48+
ze_command_list_handle_t
49+
hCommandList, ///< [in] handle of mutable command list
50+
size_t eleCount); ///< [in] number of elements
51+
52+
///////////////////////////////////////////////////////////////////////////////
53+
/// @brief Returns size of the buffer required for all temporary variables.
54+
ze_result_t ZE_APICALL zexCommandListTempMemGetSize(
55+
ze_command_list_handle_t
56+
hCommandList, ///< [in] handle of mutable command list
57+
size_t *pTempMemSize); ///< [in,out] size of temporary memory buffer
58+
59+
///////////////////////////////////////////////////////////////////////////////
60+
/// @brief Sets buffer used by temporary variables.
61+
ze_result_t ZE_APICALL zexCommandListTempMemSet(
62+
ze_command_list_handle_t
63+
hCommandList, ///< [in] handle of mutable command list
64+
const void *pTempMem); ///< [in] ptr to temporary memory buffer
65+
66+
typedef ze_result_t(ZE_APICALL *zex_pfnCommandListTempMemSetEleCountCb_t)(
67+
ze_command_list_handle_t hCommandList, size_t eleCount);
68+
69+
typedef ze_result_t(ZE_APICALL *zex_pfnCommandListTempMemGetSizeCb_t)(
70+
ze_command_list_handle_t hCommandList, size_t *pTempMemSize);
71+
72+
typedef ze_result_t(ZE_APICALL *zex_pfnCommandListTempMemSetCb_t)(
73+
ze_command_list_handle_t hCommandList, const void *pTempMem);
74+
75+
#if defined(__cplusplus)
76+
} // extern "C"
77+
#endif

0 commit comments

Comments
 (0)