Skip to content

Commit

Permalink
Fix mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
againull committed Oct 1, 2024
1 parent c77c75a commit 550df8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
12 changes: 6 additions & 6 deletions source/adapters/level_zero/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ struct ur_program_handle_t_ : _ur_object {
AssociatedDevices(Context->getDevices()) {}

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

// Construct a program in Exe state (interop).
// TODO: Currently it is not possible to get the device associated with the
// interop module, API must be changed to either get that info from the user
// or new API need to be added to L0 to fetch that info. Consider it
// associated with the first device in the context.
ur_program_handle_t_([[maybe_unused]] state St, ur_context_handle_t Context,
ur_program_handle_t_(state, ur_context_handle_t Context,
ze_module_handle_t InteropZeModule, bool OwnZeModule)
: Context{Context}, NativeProperties{nullptr}, OwnZeModule{OwnZeModule},
AssociatedDevices({Context->getDevices()[0]}), InteropZeModule{
InteropZeModule} {
AssociatedDevices({Context->getDevices()[0]}),
InteropZeModule{InteropZeModule} {
// TODO: Currently it is not possible to understand the device associated
// with provided ZeModule. So we can't set the state on that device to Exe.
}
Expand Down
13 changes: 8 additions & 5 deletions source/adapters/opencl/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
ur_device_handle_t *phDevices, size_t *pLengths, const uint8_t **ppBinaries,
const ur_program_properties_t *pProperties,
ur_program_handle_t *phProgram) {
cl_device_id Devices[numDevices];
std::vector<cl_device_id> Devices(numDevices);
for (uint32_t i = 0; i < numDevices; ++i)
Devices[i] = cl_adapter::cast<cl_device_id>(phDevices[i]);
cl_int BinaryStatus[numDevices];
std::vector<cl_int> BinaryStatus(numDevices);
cl_int CLResult;
*phProgram = cl_adapter::cast<ur_program_handle_t>(clCreateProgramWithBinary(
cl_adapter::cast<cl_context>(hContext), cl_adapter::cast<cl_uint>(1u),
Devices, pLengths, ppBinaries, BinaryStatus, &CLResult));
CL_RETURN_ON_FAILURE(BinaryStatus[0]);
cl_adapter::cast<cl_context>(hContext),
cl_adapter::cast<cl_uint>(numDevices), Devices.data(), pLengths,
ppBinaries, BinaryStatus.data(), &CLResult));
for (uint32_t i = 0; i < numDevices; ++i) {
CL_RETURN_ON_FAILURE(BinaryStatus[i]);
}
CL_RETURN_ON_FAILURE(CLResult);

return UR_RESULT_SUCCESS;
Expand Down

0 comments on commit 550df8a

Please sign in to comment.