Skip to content

Commit

Permalink
PARTIAL fix parameter validation APIS with ARRAYS of descriptors
Browse files Browse the repository at this point in the history
Related-To: VLCLJ-1272

Signed-off-by: davidoli <[email protected]>
  • Loading branch information
dmichaelo1 authored and bmyates committed Apr 7, 2023
1 parent f10ca5e commit 79f1c52
Showing 1 changed file with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inline ze_result_t validateStructureTypes(void *descriptorPtr,

const B *pBase = reinterpret_cast<const B*> (descriptorPtr);

if (pBase == nullptr) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}

bool validBaseTypeFound = false;
for (auto t : (baseTypesVector)) {
if (pBase->stype == t) {
Expand Down Expand Up @@ -74,6 +78,10 @@ inline ze_result_t ParameterValidation::validateExtensions(ze_pci_ext_properties
template <>
inline ze_result_t ParameterValidation::validateExtensions(ze_device_memory_properties_t *descriptor) {

if (descriptor == nullptr) {
return ZE_RESULT_SUCCESS;
}

std::vector<ze_structure_type_t> baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES};
std::vector<ze_structure_type_t> types = {ZE_STRUCTURE_TYPE_DEVICE_MEMORY_EXT_PROPERTIES};

Expand Down Expand Up @@ -116,6 +124,10 @@ inline ze_result_t ParameterValidation::validateExtensions(ze_device_properties_
template <>
inline ze_result_t ParameterValidation::validateExtensions(ze_device_cache_properties_t *descriptor) {

if (descriptor == nullptr) {
return ZE_RESULT_SUCCESS;
}

std::vector<ze_structure_type_t> baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES};
std::vector<ze_structure_type_t> types = {ZE_STRUCTURE_TYPE_CACHE_RESERVATION_EXT_DESC};

Expand Down Expand Up @@ -151,7 +163,11 @@ inline ze_result_t ParameterValidation::validateExtensions(ze_device_module_prop

template <>
inline ze_result_t ParameterValidation::validateExtensions(ze_command_queue_group_properties_t *descriptor) {


if (descriptor == nullptr) {
return ZE_RESULT_SUCCESS;
}

std::vector<ze_structure_type_t> baseTypes = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES};
std::vector<ze_structure_type_t> types = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES,
ZE_STRUCTURE_TYPE_COPY_BANDWIDTH_EXP_PROPERTIES};
Expand Down Expand Up @@ -504,6 +520,10 @@ inline ze_result_t ParameterValidation::validateExtensions(zet_debug_memory_spac
template <>
inline ze_result_t ParameterValidation::validateExtensions(zet_debug_regset_properties_t *descriptor) {

if (descriptor == nullptr) {
return ZE_RESULT_SUCCESS;
}

std::vector<zet_structure_type_t> baseTypes = {ZET_STRUCTURE_TYPE_DEBUG_REGSET_PROPERTIES};
std::vector<zet_structure_type_t> types = {};

Expand Down Expand Up @@ -542,6 +562,10 @@ inline ze_result_t ParameterValidation::validateExtensions(zes_pci_properties_t
template <>
inline ze_result_t ParameterValidation::validateExtensions(zes_pci_bar_properties_t *descriptor) {

if (descriptor == nullptr) {
return ZE_RESULT_SUCCESS;
}

std::vector<zes_structure_type_t> baseTypes = {ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES};
std::vector<zes_structure_type_t> types = {ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES_1_2};

Expand Down Expand Up @@ -714,6 +738,10 @@ inline ze_result_t ParameterValidation::validateExtensions(zes_device_state_t *d
template <>
inline ze_result_t ParameterValidation::validateExtensions(zes_process_state_t *descriptor) {

if (descriptor == nullptr) {
return ZE_RESULT_SUCCESS;
}

std::vector<zes_structure_type_t> baseTypes = {ZES_STRUCTURE_TYPE_PROCESS_STATE};
std::vector<zes_structure_type_t> types = {};

Expand Down Expand Up @@ -859,6 +887,10 @@ inline ze_result_t ParameterValidation::validateExtensions(zes_device_ecc_proper
template <>
inline ze_result_t ParameterValidation::validateExtensions(zes_power_limit_ext_desc_t *descriptor) {

if (descriptor == nullptr) {
return ZE_RESULT_SUCCESS;
}

std::vector<zes_structure_type_t> baseTypes = {ZES_STRUCTURE_TYPE_POWER_LIMIT_EXT_DESC};
std::vector<zes_structure_type_t> types = {};

Expand Down

0 comments on commit 79f1c52

Please sign in to comment.