Skip to content

Commit 8dea47b

Browse files
authored
[UR][Offload] Implement urProgramCreateWithIL (#19470)
Offload consumes both IL and binaries through the same entrypoint, so there's no point in drawing a distinction.
1 parent 98cd464 commit 8dea47b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

unified-runtime/source/adapters/offload/device.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
7676
return ReturnValue(uint32_t{1});
7777
case UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS:
7878
return ReturnValue(uint32_t{3});
79+
case UR_DEVICE_INFO_COMPILER_AVAILABLE:
80+
return ReturnValue(true);
7981
// Unimplemented features
8082
case UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS:
8183
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:

unified-runtime/source/adapters/offload/program.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
125125
return UR_RESULT_SUCCESS;
126126
}
127127

128+
UR_APIEXPORT ur_result_t UR_APICALL
129+
urProgramCreateWithIL(ur_context_handle_t hContext, const void *pIL,
130+
size_t length, const ur_program_properties_t *pProperties,
131+
ur_program_handle_t *phProgram) {
132+
// Liboffload consumes both IR and binaries through the same entrypoint
133+
return urProgramCreateWithBinary(hContext, 1, &hContext->Device, &length,
134+
reinterpret_cast<const uint8_t **>(&pIL),
135+
pProperties, phProgram);
136+
}
137+
128138
UR_APIEXPORT ur_result_t UR_APICALL urProgramBuild(ur_context_handle_t,
129139
ur_program_handle_t,
130140
const char *) {
@@ -147,12 +157,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCompile(ur_context_handle_t,
147157
return UR_RESULT_SUCCESS;
148158
}
149159

150-
UR_APIEXPORT ur_result_t UR_APICALL
151-
urProgramCreateWithIL(ur_context_handle_t, const void *, size_t,
152-
const ur_program_properties_t *, ur_program_handle_t *) {
153-
return UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE;
154-
}
155-
156160
UR_APIEXPORT ur_result_t UR_APICALL
157161
urProgramGetInfo(ur_program_handle_t hProgram, ur_program_info_t propName,
158162
size_t propSize, void *pPropValue, size_t *pPropSizeRet) {

0 commit comments

Comments
 (0)