Skip to content

Commit 19e8398

Browse files
committed
Add device validation checks for host timer APIs
These are supposed to return CL_INVALID_DEVICE, even if the operation is not supported.
1 parent 339f5e9 commit 19e8398

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/runtime/runtime.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5997,6 +5997,12 @@ clGetDeviceAndHostTimer(cl_device_id device, cl_ulong* device_timestamp,
59975997
{
59985998
REGISTER_API;
59995999

6000+
// Check device is valid
6001+
if (device != m_device)
6002+
{
6003+
ReturnErrorArg(NULL, CL_INVALID_DEVICE, device);
6004+
}
6005+
60006006
ReturnErrorInfo(nullptr, CL_INVALID_OPERATION,
60016007
"Unimplemented OpenCL 2.1 API");
60026008
}
@@ -6006,6 +6012,12 @@ CL_API_ENTRY cl_int CL_API_CALL clGetHostTimer(
60066012
{
60076013
REGISTER_API;
60086014

6015+
// Check device is valid
6016+
if (device != m_device)
6017+
{
6018+
ReturnErrorArg(NULL, CL_INVALID_DEVICE, device);
6019+
}
6020+
60096021
ReturnErrorInfo(nullptr, CL_INVALID_OPERATION,
60106022
"Unimplemented OpenCL 2.1 API");
60116023
}

0 commit comments

Comments
 (0)