@@ -175,6 +175,64 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuildExp(
175
175
return UR_RESULT_SUCCESS;
176
176
}
177
177
178
+ // /////////////////////////////////////////////////////////////////////////////
179
+ // / @brief Intercept function for urProgramLink
180
+ __urdlllocal ur_result_t UR_APICALL urProgramLink (
181
+ ur_context_handle_t hContext, // /< [in] handle of the context instance.
182
+ uint32_t count, // /< [in] number of program handles in `phPrograms`.
183
+ const ur_program_handle_t *
184
+ phPrograms, // /< [in][range(0, count)] pointer to array of program handles.
185
+ const char *
186
+ pOptions, // /< [in][optional] pointer to linker options null-terminated string.
187
+ ur_program_handle_t
188
+ *phProgram // /< [out] pointer to handle of program object created.
189
+ ) {
190
+ auto pfnProgramLink = context.urDdiTable .Program .pfnLink ;
191
+
192
+ if (nullptr == pfnProgramLink) {
193
+ return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
194
+ }
195
+
196
+ context.logger .debug (" ==== urProgramLink" );
197
+
198
+ UR_CALL (pfnProgramLink (hContext, count, phPrograms, pOptions, phProgram));
199
+
200
+ UR_CALL (context.interceptor ->registerDeviceGlobals (hContext, *phProgram));
201
+
202
+ return UR_RESULT_SUCCESS;
203
+ }
204
+
205
+ // /////////////////////////////////////////////////////////////////////////////
206
+ // / @brief Intercept function for urProgramLinkExp
207
+ ur_result_t UR_APICALL urProgramLinkExp (
208
+ ur_context_handle_t hContext, // /< [in] handle of the context instance.
209
+ uint32_t numDevices, // /< [in] number of devices
210
+ ur_device_handle_t *
211
+ phDevices, // /< [in][range(0, numDevices)] pointer to array of device handles
212
+ uint32_t count, // /< [in] number of program handles in `phPrograms`.
213
+ const ur_program_handle_t *
214
+ phPrograms, // /< [in][range(0, count)] pointer to array of program handles.
215
+ const char *
216
+ pOptions, // /< [in][optional] pointer to linker options null-terminated string.
217
+ ur_program_handle_t
218
+ *phProgram // /< [out] pointer to handle of program object created.
219
+ ) {
220
+ auto pfnProgramLinkExp = context.urDdiTable .ProgramExp .pfnLinkExp ;
221
+
222
+ if (nullptr == pfnProgramLinkExp) {
223
+ return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
224
+ }
225
+
226
+ context.logger .debug (" ==== urProgramLinkExp" );
227
+
228
+ UR_CALL (pfnProgramLinkExp (hContext, numDevices, phDevices, count,
229
+ phPrograms, pOptions, phProgram));
230
+
231
+ UR_CALL (context.interceptor ->registerDeviceGlobals (hContext, *phProgram));
232
+
233
+ return UR_RESULT_SUCCESS;
234
+ }
235
+
178
236
// /////////////////////////////////////////////////////////////////////////////
179
237
// / @brief Intercept function for urEnqueueKernelLaunch
180
238
__urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch (
@@ -375,9 +433,11 @@ __urdlllocal ur_result_t UR_APICALL urGetProgramProcAddrTable(
375
433
}
376
434
377
435
pDdiTable->pfnBuild = ur_sanitizer_layer::urProgramBuild;
436
+ pDdiTable->pfnLink = ur_sanitizer_layer::urProgramLink;
378
437
379
438
return UR_RESULT_SUCCESS;
380
439
}
440
+
381
441
// /////////////////////////////////////////////////////////////////////////////
382
442
// / @brief Exported function for filling application's ProgramExp table
383
443
// / with current process' addresses
@@ -405,9 +465,11 @@ __urdlllocal ur_result_t UR_APICALL urGetProgramExpProcAddrTable(
405
465
ur_result_t result = UR_RESULT_SUCCESS;
406
466
407
467
pDdiTable->pfnBuildExp = ur_sanitizer_layer::urProgramBuildExp;
468
+ pDdiTable->pfnLinkExp = ur_sanitizer_layer::urProgramLinkExp;
408
469
409
470
return result;
410
471
}
472
+
411
473
// /////////////////////////////////////////////////////////////////////////////
412
474
// / @brief Exported function for filling application's Enqueue table
413
475
// / with current process' addresses
0 commit comments