From 469329aa3931cc1c81c876f18ed8281a0a7fa326 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 12 Apr 2022 12:50:37 +0200 Subject: [PATCH] rusticl/device: fix api consistency_device_and_host_timer test Signed-off-by: Karol Herbst Acked-by: Alyssa Rosenzweig Part-of: --- src/gallium/frontends/rusticl/api/device.rs | 14 ++++++++++++++ src/gallium/frontends/rusticl/api/icd.rs | 19 +++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs index db33be00ee6..b1d50498c23 100644 --- a/src/gallium/frontends/rusticl/api/device.rs +++ b/src/gallium/frontends/rusticl/api/device.rs @@ -248,3 +248,17 @@ pub fn get_device_ids( Ok(()) } + +pub fn get_device_and_host_timer( + _device: cl_device_id, + _device_timestamp: *mut cl_ulong, + _host_timestamp: *mut cl_ulong, +) -> CLResult<()> { + // TODO: we could support it + Err(CL_INVALID_OPERATION) +} + +pub fn get_host_timer(_device: cl_device_id, _host_timestamp: *mut cl_ulong) -> CLResult<()> { + // TODO: we could support it + Err(CL_INVALID_OPERATION) +} diff --git a/src/gallium/frontends/rusticl/api/icd.rs b/src/gallium/frontends/rusticl/api/icd.rs index 028fac283f4..c3fb7cde71c 100644 --- a/src/gallium/frontends/rusticl/api/icd.rs +++ b/src/gallium/frontends/rusticl/api/icd.rs @@ -163,7 +163,7 @@ pub static DISPATCH: cl_icd_dispatch = cl_icd_dispatch { clCreateProgramWithIL: Some(cl_create_program_with_il), clEnqueueSVMMigrateMem: Some(cl_enqueue_svm_migrate_mem), clGetDeviceAndHostTimer: Some(cl_get_device_and_host_timer), - clGetHostTimer: None, + clGetHostTimer: Some(cl_get_host_timer), clGetKernelSubGroupInfo: Some(cl_get_kernel_sub_group_info), clSetDefaultDeviceCommandQueue: None, clSetProgramReleaseCallback: Some(cl_set_program_release_callback), @@ -1756,12 +1756,19 @@ extern "C" fn cl_enqueue_svm_migrate_mem( } extern "C" fn cl_get_device_and_host_timer( - _device: cl_device_id, - _device_timestamp: *mut cl_ulong, - _host_timestamp: *mut cl_ulong, + device: cl_device_id, + device_timestamp: *mut cl_ulong, + host_timestamp: *mut cl_ulong, ) -> cl_int { - println!("cl_get_device_and_host_timer not implemented"); - CL_OUT_OF_HOST_MEMORY + match_err!(get_device_and_host_timer( + device, + device_timestamp, + host_timestamp, + )) +} + +extern "C" fn cl_get_host_timer(device: cl_device_id, host_timestamp: *mut cl_ulong) -> cl_int { + match_err!(get_host_timer(device, host_timestamp,)) } extern "C" fn cl_get_kernel_sub_group_info(