2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/accelerators/intel_accelerator.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/get_info.h"
|
|
|
|
#include "shared/source/helpers/string.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/context/context.h"
|
|
|
|
#include "opencl/source/helpers/get_info_status_mapper.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
cl_int IntelAccelerator::getInfo(cl_accelerator_info_intel paramName,
|
|
|
|
size_t paramValueSize,
|
|
|
|
void *paramValue,
|
|
|
|
size_t *paramValueSizeRet) const {
|
|
|
|
cl_int result = CL_SUCCESS;
|
2020-05-18 22:13:59 +08:00
|
|
|
size_t ret = GetInfo::invalidSourceSize;
|
|
|
|
auto getInfoStatus = GetInfoStatus::INVALID_VALUE;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
switch (paramName) {
|
|
|
|
case CL_ACCELERATOR_DESCRIPTOR_INTEL: {
|
|
|
|
ret = getDescriptorSize();
|
2020-05-18 22:13:59 +08:00
|
|
|
getInfoStatus = GetInfo::getInfo(paramValue, paramValueSize, getDescriptor(), ret);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CL_ACCELERATOR_REFERENCE_COUNT_INTEL: {
|
|
|
|
auto v = getReference();
|
|
|
|
|
|
|
|
ret = sizeof(cl_uint);
|
2020-05-18 22:13:59 +08:00
|
|
|
getInfoStatus = GetInfo::getInfo(paramValue, paramValueSize, &v, ret);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CL_ACCELERATOR_CONTEXT_INTEL: {
|
|
|
|
ret = sizeof(cl_context);
|
|
|
|
cl_context ctx = static_cast<cl_context>(pContext);
|
2020-05-18 22:13:59 +08:00
|
|
|
getInfoStatus = GetInfo::getInfo(paramValue, paramValueSize, &ctx, ret);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CL_ACCELERATOR_TYPE_INTEL: {
|
|
|
|
auto v = getTypeId();
|
|
|
|
ret = sizeof(cl_accelerator_type_intel);
|
2020-05-18 22:13:59 +08:00
|
|
|
getInfoStatus = GetInfo::getInfo(paramValue, paramValueSize, &v, ret);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2020-05-18 22:13:59 +08:00
|
|
|
getInfoStatus = GetInfoStatus::INVALID_VALUE;
|
2017-12-21 07:45:38 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-05-18 22:13:59 +08:00
|
|
|
result = changeGetInfoStatusToCLResultType(getInfoStatus);
|
|
|
|
GetInfo::setParamValueReturnSize(paramValueSizeRet, ret, getInfoStatus);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|