Skip to content

Commit fcc0cef

Browse files
committed
Fix mistakes
1 parent b3dd8ac commit fcc0cef

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

source/adapters/level_zero/program.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,22 @@ struct ur_program_handle_t_ : _ur_object {
103103
AssociatedDevices(Context->getDevices()) {}
104104

105105
// Construct a program in Exe or Invalid state.
106-
ur_program_handle_t_([[maybe_unused]] state St, ur_context_handle_t Context,
106+
ur_program_handle_t_(state, ur_context_handle_t Context,
107107
ze_module_handle_t InteropZeModule)
108108
: Context{Context}, NativeProperties{nullptr}, OwnZeModule{true},
109-
AssociatedDevices({Context->getDevices()[0]}), InteropZeModule{
110-
InteropZeModule} {}
109+
AssociatedDevices({Context->getDevices()[0]}),
110+
InteropZeModule{InteropZeModule} {}
111111

112112
// Construct a program in Exe state (interop).
113113
// TODO: Currently it is not possible to get the device associated with the
114114
// interop module, API must be changed to either get that info from the user
115115
// or new API need to be added to L0 to fetch that info. Consider it
116116
// associated with the first device in the context.
117-
ur_program_handle_t_([[maybe_unused]] state St, ur_context_handle_t Context,
117+
ur_program_handle_t_(state, ur_context_handle_t Context,
118118
ze_module_handle_t InteropZeModule, bool OwnZeModule)
119119
: Context{Context}, NativeProperties{nullptr}, OwnZeModule{OwnZeModule},
120-
AssociatedDevices({Context->getDevices()[0]}), InteropZeModule{
121-
InteropZeModule} {
120+
AssociatedDevices({Context->getDevices()[0]}),
121+
InteropZeModule{InteropZeModule} {
122122
// TODO: Currently it is not possible to understand the device associated
123123
// with provided ZeModule. So we can't set the state on that device to Exe.
124124
}

source/adapters/opencl/program.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,19 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithIL(
118118
UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
119119
ur_context_handle_t hContext, uint32_t numDevices,
120120
ur_device_handle_t *phDevices, size_t *pLengths, const uint8_t **ppBinaries,
121-
const ur_program_properties_t *pProperties,
122-
ur_program_handle_t *phProgram) {
123-
cl_device_id Devices[numDevices];
121+
const ur_program_properties_t *, ur_program_handle_t *phProgram) {
122+
std::vector<cl_device_id> Devices(numDevices);
124123
for (uint32_t i = 0; i < numDevices; ++i)
125124
Devices[i] = cl_adapter::cast<cl_device_id>(phDevices[i]);
126-
cl_int BinaryStatus[numDevices];
125+
std::vector<cl_int> BinaryStatus(numDevices);
127126
cl_int CLResult;
128127
*phProgram = cl_adapter::cast<ur_program_handle_t>(clCreateProgramWithBinary(
129-
cl_adapter::cast<cl_context>(hContext), cl_adapter::cast<cl_uint>(1u),
130-
Devices, pLengths, ppBinaries, BinaryStatus, &CLResult));
131-
CL_RETURN_ON_FAILURE(BinaryStatus[0]);
128+
cl_adapter::cast<cl_context>(hContext),
129+
cl_adapter::cast<cl_uint>(numDevices), Devices.data(), pLengths,
130+
ppBinaries, BinaryStatus.data(), &CLResult));
131+
for (uint32_t i = 0; i < numDevices; ++i) {
132+
CL_RETURN_ON_FAILURE(BinaryStatus[i]);
133+
}
132134
CL_RETURN_ON_FAILURE(CLResult);
133135

134136
return UR_RESULT_SUCCESS;

0 commit comments

Comments
 (0)