SWDEV-347592 - validate hipMemAllocationType & hipMemLocationType
Change-Id: Ia8c4d3edc7ad96efa429b3530a118199d4f92902
[ROCm/clr commit: 0fed29f77c]
This commit is contained in:
committed by
Jaydeepkumar Patel
parent
ab694c23fb
commit
f4642fc0d4
@@ -171,6 +171,20 @@ hipError_t hipMemPoolCreate(hipMemPool_t* mem_pool, const hipMemPoolProps* pool_
|
||||
if (mem_pool == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
// validate hipMemAllocationType value
|
||||
if (pool_props->allocType != hipMemAllocationTypeInvalid &&
|
||||
pool_props->allocType != hipMemAllocationTypePinned &&
|
||||
pool_props->allocType != hipMemAllocationTypeMax) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
// validate hipMemLocationType value
|
||||
if (pool_props->location.type != hipMemLocationTypeInvalid &&
|
||||
pool_props->location.type != hipMemLocationTypeDevice) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
// Make sure the pool creation occurs on a valid device
|
||||
if ((pool_props->location.type != hipMemLocationTypeDevice) ||
|
||||
(pool_props->location.id >= g_devices.size())) {
|
||||
|
||||
Reference in New Issue
Block a user