@@ -112,6 +112,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramBuild(
112
112
ur_program_handle_t Program, // /< [in] Handle of the program to build.
113
113
const char *Options // /< [in][optional] pointer to build options
114
114
// /< null-terminated string.
115
+ ) {
116
+ return urProgramBuildExp (Context, Program, 1 , Context->Devices .data (),
117
+ Options);
118
+ }
119
+
120
+ UR_APIEXPORT ur_result_t UR_APICALL urProgramBuildExp (
121
+ ur_context_handle_t Context, // /< [in] handle of the context instance.
122
+ ur_program_handle_t Program, // /< [in] Handle of the program to build.
123
+ uint32_t numDevices, ur_device_handle_t *phDevices,
124
+ const char *Options // /< [in][optional] pointer to build options
125
+ // /< null-terminated string.
115
126
) {
116
127
// TODO
117
128
// Check if device belongs to associated context.
@@ -142,8 +153,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramBuild(
142
153
ZeModuleDesc.pBuildFlags = Options;
143
154
ZeModuleDesc.pConstants = Shim.ze ();
144
155
145
- ze_device_handle_t ZeDevice = Context-> Devices [0 ]->ZeDevice ;
156
+ ze_device_handle_t ZeDevice = phDevices [0 ]->ZeDevice ;
146
157
ze_context_handle_t ZeContext = Program->Context ->ZeContext ;
158
+ std::ignore = Context;
159
+ std::ignore = numDevices;
147
160
ze_module_handle_t ZeModule = nullptr ;
148
161
149
162
ur_result_t Result = UR_RESULT_SUCCESS;
@@ -185,6 +198,19 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramBuild(
185
198
return Result;
186
199
}
187
200
201
+ UR_APIEXPORT ur_result_t UR_APICALL urProgramCompileExp (
202
+ ur_context_handle_t Context, // /< [in] handle of the context instance.
203
+ ur_program_handle_t
204
+ Program, // /< [in][out] handle of the program to compile.
205
+ uint32_t numDevices, ur_device_handle_t *phDevices,
206
+ const char *Options // /< [in][optional] pointer to build options
207
+ // /< null-terminated string.
208
+ ) {
209
+ std::ignore = numDevices;
210
+ std::ignore = phDevices;
211
+ return urProgramCompile (Context, Program, Options);
212
+ }
213
+
188
214
UR_APIEXPORT ur_result_t UR_APICALL urProgramCompile (
189
215
ur_context_handle_t Context, // /< [in] handle of the context instance.
190
216
ur_program_handle_t
@@ -225,7 +251,24 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramLink(
225
251
ur_program_handle_t
226
252
*Program // /< [out] pointer to handle of program object created.
227
253
) {
228
- UR_ASSERT (Context->isValidDevice (Context->Devices [0 ]),
254
+ return urProgramLinkExp (Context, Count, Programs, 1 , Context->Devices .data (),
255
+ Options, Program);
256
+ }
257
+
258
+ UR_APIEXPORT ur_result_t UR_APICALL urProgramLinkExp (
259
+ ur_context_handle_t Context, // /< [in] handle of the context instance.
260
+ uint32_t Count, // /< [in] number of program handles in `phPrograms`.
261
+ const ur_program_handle_t *Programs, // /< [in][range(0, count)] pointer to
262
+ // /< array of program handles.
263
+ uint32_t numDevices, ur_device_handle_t *phDevices,
264
+ const char *Options, // /< [in][optional] pointer to linker options
265
+ // /< null-terminated string.
266
+ ur_program_handle_t
267
+ *Program // /< [out] pointer to handle of program object created.
268
+ ) {
269
+ std::ignore = numDevices;
270
+
271
+ UR_ASSERT (Context->isValidDevice (phDevices[0 ]),
229
272
UR_RESULT_ERROR_INVALID_DEVICE);
230
273
231
274
// We do not support any link flags at this time because the Level Zero API
@@ -320,7 +363,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramLink(
320
363
// input module.
321
364
//
322
365
// TODO: Remove this workaround when the driver is fixed.
323
- if (!Context-> Devices [0 ]->Platform ->ZeDriverModuleProgramExtensionFound ||
366
+ if (!phDevices [0 ]->Platform ->ZeDriverModuleProgramExtensionFound ||
324
367
(Count == 1 )) {
325
368
if (Count == 1 ) {
326
369
ZeModuleDesc.pNext = nullptr ;
@@ -336,7 +379,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramLink(
336
379
}
337
380
338
381
// Call the Level Zero API to compile, link, and create the module.
339
- ze_device_handle_t ZeDevice = Context-> Devices [0 ]->ZeDevice ;
382
+ ze_device_handle_t ZeDevice = phDevices [0 ]->ZeDevice ;
340
383
ze_context_handle_t ZeContext = Context->ZeContext ;
341
384
ze_module_handle_t ZeModule = nullptr ;
342
385
ze_module_build_log_handle_t ZeBuildLog = nullptr ;
0 commit comments