Skip to content

Commit 67e524e

Browse files
fix: add checks for l0 calls
Signed-off-by: Jakub Nowacki <[email protected]>
1 parent 44adde9 commit 67e524e

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

source/benchmarks/graph_api_benchmark/implementations/l0/sin_kernel_impl_l0.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ SinKernelGraphL0::DataFloatPtr SinKernelGraphL0::allocDevice(uint32_t count) {
2828
ze_device_mem_alloc_desc_t deviceAllocationDesc = {
2929
ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC};
3030

31-
zeMemAllocDevice(levelzero->context, &deviceAllocationDesc,
32-
count * sizeof(float), 0, levelzero->device,
33-
&deviceptr);
31+
EXPECT_ZE_RESULT_SUCCESS(zeMemAllocDevice(levelzero->context, &deviceAllocationDesc,
32+
count * sizeof(float), 0, levelzero->device,
33+
&deviceptr));
3434

3535
auto copied = levelzero;
3636
return SinKernelGraphL0::DataFloatPtr(static_cast<float *>(deviceptr), [copied](float *ptr) {
37-
zeMemFree(copied->context, ptr);
37+
EXPECT_ZE_RESULT_SUCCESS(zeMemFree(copied->context, ptr));
3838
});
3939
}
4040

@@ -43,12 +43,12 @@ SinKernelGraphL0::DataFloatPtr SinKernelGraphL0::allocHost(uint32_t count) {
4343
ze_host_mem_alloc_desc_t hostAllocationDesc = {
4444
ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC};
4545

46-
zeMemAllocHost(levelzero->context, &hostAllocationDesc,
47-
count * sizeof(float), 0, &hostptr);
46+
EXPECT_ZE_RESULT_SUCCESS(zeMemAllocHost(levelzero->context, &hostAllocationDesc,
47+
count * sizeof(float), 0, &hostptr));
4848

4949
auto copied = levelzero;
5050
return SinKernelGraphL0::DataFloatPtr(static_cast<float *>(hostptr), [copied](float *ptr) {
51-
zeMemFree(copied->context, ptr);
51+
EXPECT_ZE_RESULT_SUCCESS(zeMemFree(copied->context, ptr));
5252
});
5353
}
5454

@@ -207,7 +207,7 @@ TestResult SinKernelGraphL0::runGraph(float *input_h) {
207207
ASSERT_ZE_RESULT_SUCCESS(zeCommandListImmediateAppendCommandListsExp(
208208
immCmdList, 1, &graphCmdList, nullptr, 0, nullptr));
209209
} else {
210-
zeCommandQueueExecuteCommandLists(cmdQueue, 1, &graphCmdList, nullptr);
210+
ASSERT_ZE_RESULT_SUCCESS(zeCommandQueueExecuteCommandLists(cmdQueue, 1, &graphCmdList, nullptr));
211211
}
212212

213213
return TestResult::Success;
@@ -228,7 +228,7 @@ TestResult SinKernelGraphL0::runEager(float *input_h) {
228228
TestResult SinKernelGraphL0::waitCompletion() {
229229
if (!immediateAppendCmdList && withGraphs) {
230230
ASSERT_ZE_RESULT_SUCCESS(zeCommandQueueSynchronize(cmdQueue, std::numeric_limits<uint64_t>::max()));
231-
zeEventHostReset(zeEvent);
231+
ASSERT_ZE_RESULT_SUCCESS(zeEventHostReset(zeEvent));
232232
} else {
233233
ASSERT_ZE_RESULT_SUCCESS(zeCommandListHostSynchronize(
234234
immCmdList, std::numeric_limits<uint64_t>::max()));
@@ -242,13 +242,13 @@ SinKernelGraphL0::~SinKernelGraphL0() {
242242
return;
243243

244244
if (graphCmdList != nullptr)
245-
zeCommandListDestroy(graphCmdList);
246-
zeKernelDestroy(kernelAssign);
247-
zeKernelDestroy(kernelSin);
248-
zeModuleDestroy(moduleAssign);
249-
zeModuleDestroy(moduleSin);
250-
zeEventDestroy(zeEvent);
251-
zeEventPoolDestroy(zePool);
252-
zeCommandListDestroy(immCmdList);
253-
zeCommandQueueDestroy(cmdQueue);
245+
EXPECT_ZE_RESULT_SUCCESS(zeCommandListDestroy(graphCmdList));
246+
EXPECT_ZE_RESULT_SUCCESS(zeKernelDestroy(kernelAssign));
247+
EXPECT_ZE_RESULT_SUCCESS(zeKernelDestroy(kernelSin));
248+
EXPECT_ZE_RESULT_SUCCESS(zeModuleDestroy(moduleAssign));
249+
EXPECT_ZE_RESULT_SUCCESS(zeModuleDestroy(moduleSin));
250+
EXPECT_ZE_RESULT_SUCCESS(zeEventDestroy(zeEvent));
251+
EXPECT_ZE_RESULT_SUCCESS(zeEventPoolDestroy(zePool));
252+
EXPECT_ZE_RESULT_SUCCESS(zeCommandListDestroy(immCmdList));
253+
EXPECT_ZE_RESULT_SUCCESS(zeCommandQueueDestroy(cmdQueue));
254254
}

source/benchmarks/graph_api_benchmark/implementations/l0/sin_kernel_impl_l0.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ class SinKernelGraphL0 : public SinKernelGraphBase {
3939
std::shared_ptr<LevelZero> levelzero;
4040

4141
ze_group_count_t groupCount{64u, 1u, 1u};
42-
ze_kernel_handle_t kernelAssign;
43-
ze_kernel_handle_t kernelSin;
44-
ze_module_handle_t moduleAssign;
45-
ze_module_handle_t moduleSin;
46-
ze_command_list_handle_t graphCmdList = nullptr;
47-
ze_command_list_handle_t immCmdList;
48-
ze_command_queue_handle_t cmdQueue;
49-
ze_event_handle_t zeEvent;
50-
ze_event_pool_handle_t zePool;
42+
ze_kernel_handle_t kernelAssign{};
43+
ze_kernel_handle_t kernelSin{};
44+
ze_module_handle_t moduleAssign{};
45+
ze_module_handle_t moduleSin{};
46+
ze_command_list_handle_t graphCmdList{};
47+
ze_command_list_handle_t immCmdList{};
48+
ze_command_queue_handle_t cmdQueue{};
49+
ze_event_handle_t zeEvent{};
50+
ze_event_pool_handle_t zePool{};
5151
};

0 commit comments

Comments
 (0)