Skip to content

Commit d7ea11f

Browse files
committed
Fix return value for multi device
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent 7436827 commit d7ea11f

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

source/adapters/level_zero/program.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
9696
// information to distinguish the cases.
9797

9898
try {
99-
ur_program_handle_t_ *UrProgram = new ur_program_handle_t_(
100-
ur_program_handle_t_::Native, Context, Device, Properties, Binary, Size);
99+
ur_program_handle_t_ *UrProgram =
100+
new ur_program_handle_t_(ur_program_handle_t_::Native, Context, Device,
101+
Properties, Binary, Size);
101102
*Program = reinterpret_cast<ur_program_handle_t>(UrProgram);
102103
} catch (const std::bad_alloc &) {
103104
return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
@@ -658,7 +659,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetInfo(
658659
}
659660
}
660661
}
661-
return ReturnValue(devices);
662+
return ReturnValue(devices.data(), devices.size());
662663
} else {
663664
return ReturnValue(Program->Context->Devices[0]);
664665
}
@@ -678,7 +679,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetInfo(
678679
(ZeModulePair.second, &binarySize, nullptr));
679680
binarySizes.push_back(binarySize);
680681
}
681-
return ReturnValue(binarySizes);
682+
return ReturnValue(binarySizes.data(), binarySizes.size());
682683
} else {
683684
ZE2UR_CALL(zeModuleGetNativeBinary,
684685
(Program->ZeModule, &SzBinary, nullptr));

source/adapters/level_zero/program.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ struct ur_program_handle_t_ : _ur_object {
7575
}
7676

7777
// Construct a program in NATIVE.
78-
ur_program_handle_t_(state St, ur_context_handle_t Context, ur_device_handle_t Device, const ur_program_properties_t *Properties, const void *Input,
79-
size_t Length)
78+
ur_program_handle_t_(state St, ur_context_handle_t Context,
79+
ur_device_handle_t Device,
80+
const ur_program_properties_t *Properties,
81+
const void *Input, size_t Length)
8082
: Context{Context}, NativeDevice(Device), NativeProperties(Properties),
8183
OwnZeModule{true}, State{St}, Code{new uint8_t[Length]},
8284
CodeLength{Length}, ZeModule{nullptr}, ZeBuildLog{nullptr} {
@@ -117,7 +119,6 @@ struct ur_program_handle_t_ : _ur_object {
117119

118120
const ur_context_handle_t Context; // Context of the program.
119121

120-
121122
// Device Handle used for the Native Build
122123
ur_device_handle_t NativeDevice;
123124

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
urProgramCreateWithNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
22
urProgramCreateWithNativeHandleTest.InvalidNullHandleContext/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
33
urProgramCreateWithNativeHandleTest.InvalidNullPointerProgram/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
4-
urProgramGetBuildInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_PROGRAM_BUILD_INFO_STATUS
4+
urProgramGetBuildInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_UR_PROGRAM_BUILD_INFO_STATUS
55
urProgramGetFunctionPointerTest.InvalidKernelName/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
6-
Aborted
6+
urProgramGetNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
7+
{{OPT}}urProgramLinkErrorTest.LinkFailure/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
8+
{{OPT}}urProgramLinkErrorTest.SetOutputOnLinkError/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
9+
Segmentation fault

test/conformance/program/program_adapter_level_zero.match

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ urProgramCreateWithNativeHandleTest.InvalidNullHandleContext/Intel_R__oneAPI_Uni
33
urProgramCreateWithNativeHandleTest.InvalidNullPointerProgram/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
44
urProgramGetBuildInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_UR_PROGRAM_BUILD_INFO_STATUS
55
urProgramGetFunctionPointerTest.InvalidKernelName/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
6-
urProgramGetNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
6+
urProgramGetNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
7+
{{OPT}}urProgramLinkErrorTest.LinkFailure/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
8+
{{OPT}}urProgramLinkErrorTest.SetOutputOnLinkError/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_

0 commit comments

Comments
 (0)