mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Revert "Traverse pNext chain for all memory allocations extensions"
This reverts commit bd8b85c354.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
15f08a92c0
commit
29cbdc2430
@@ -271,19 +271,18 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
|
|||||||
bool relaxedSizeAllowed = NEO::DebugManager.flags.AllowUnrestrictedSize.get();
|
bool relaxedSizeAllowed = NEO::DebugManager.flags.AllowUnrestrictedSize.get();
|
||||||
bool rayTracingAllocation = false;
|
bool rayTracingAllocation = false;
|
||||||
|
|
||||||
const ze_base_desc_t *pNext = static_cast<const ze_base_desc_t *>(deviceDesc->pNext);
|
if (deviceDesc->pNext) {
|
||||||
while (pNext) {
|
const ze_base_desc_t *extendedDesc = reinterpret_cast<const ze_base_desc_t *>(deviceDesc->pNext);
|
||||||
if (pNext->stype == ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC) {
|
if (extendedDesc->stype == ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC) {
|
||||||
const ze_relaxed_allocation_limits_exp_desc_t *relaxedLimitsDesc =
|
const ze_relaxed_allocation_limits_exp_desc_t *relaxedLimitsDesc =
|
||||||
reinterpret_cast<const ze_relaxed_allocation_limits_exp_desc_t *>(pNext);
|
reinterpret_cast<const ze_relaxed_allocation_limits_exp_desc_t *>(extendedDesc);
|
||||||
if (!(relaxedLimitsDesc->flags & ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE)) {
|
if (!(relaxedLimitsDesc->flags & ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE)) {
|
||||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
relaxedSizeAllowed = true;
|
relaxedSizeAllowed = true;
|
||||||
} else if (pNext->stype == ZE_STRUCTURE_TYPE_RAYTRACING_MEM_ALLOC_EXT_DESC) {
|
} else if (extendedDesc->stype == ZE_STRUCTURE_TYPE_RAYTRACING_MEM_ALLOC_EXT_DESC) {
|
||||||
rayTracingAllocation = true;
|
rayTracingAllocation = true;
|
||||||
}
|
}
|
||||||
pNext = static_cast<const ze_base_desc_t *>(pNext->pNext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (relaxedSizeAllowed == false &&
|
if (relaxedSizeAllowed == false &&
|
||||||
|
|||||||
@@ -1829,36 +1829,6 @@ TEST_F(MemoryRelaxedSizeTests,
|
|||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MemoryRelaxedSizeTests,
|
|
||||||
givenCallToDeviceAllocAsRayTracingAllocationWithLargerThanAllowedSizeAndRelaxedFlagThenAllocationIsMade) {
|
|
||||||
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
|
|
||||||
GTEST_SKIP();
|
|
||||||
}
|
|
||||||
size_t size = device->getNEODevice()->getDeviceInfo().maxMemAllocSize + 1;
|
|
||||||
size_t alignment = 1u;
|
|
||||||
void *ptr = nullptr;
|
|
||||||
|
|
||||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
|
||||||
deviceDesc.stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC;
|
|
||||||
|
|
||||||
ze_raytracing_mem_alloc_ext_desc_t rtDesc = {};
|
|
||||||
rtDesc.stype = ZE_STRUCTURE_TYPE_RAYTRACING_MEM_ALLOC_EXT_DESC;
|
|
||||||
deviceDesc.pNext = &rtDesc;
|
|
||||||
|
|
||||||
ze_relaxed_allocation_limits_exp_desc_t relaxedSizeDesc = {};
|
|
||||||
relaxedSizeDesc.stype = ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC;
|
|
||||||
relaxedSizeDesc.flags = ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE;
|
|
||||||
rtDesc.pNext = &relaxedSizeDesc;
|
|
||||||
ze_result_t result = context->allocDeviceMem(device->toHandle(),
|
|
||||||
&deviceDesc,
|
|
||||||
size, alignment, &ptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
EXPECT_NE(nullptr, ptr);
|
|
||||||
|
|
||||||
result = context->freeMem(ptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MemoryRelaxedSizeTests,
|
TEST_F(MemoryRelaxedSizeTests,
|
||||||
givenCallToDeviceAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
|
givenCallToDeviceAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
|
||||||
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
|
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
|
||||||
@@ -2001,38 +1971,6 @@ TEST_F(MemoryRelaxedSizeTests,
|
|||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MemoryRelaxedSizeTests,
|
|
||||||
givenCallToSharedAllocAsRayTracingAllocationWithLargerThanAllowedSizeAndRelaxedFlagThenAllocationIsMade) {
|
|
||||||
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
|
|
||||||
GTEST_SKIP();
|
|
||||||
}
|
|
||||||
size_t size = device->getNEODevice()->getDeviceInfo().maxMemAllocSize + 1;
|
|
||||||
size_t alignment = 1u;
|
|
||||||
void *ptr = nullptr;
|
|
||||||
|
|
||||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
|
||||||
deviceDesc.stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC;
|
|
||||||
|
|
||||||
ze_raytracing_mem_alloc_ext_desc_t rtDesc = {};
|
|
||||||
rtDesc.stype = ZE_STRUCTURE_TYPE_RAYTRACING_MEM_ALLOC_EXT_DESC;
|
|
||||||
deviceDesc.pNext = &rtDesc;
|
|
||||||
|
|
||||||
ze_relaxed_allocation_limits_exp_desc_t relaxedSizeDesc = {};
|
|
||||||
relaxedSizeDesc.stype = ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC;
|
|
||||||
relaxedSizeDesc.flags = ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE;
|
|
||||||
rtDesc.pNext = &relaxedSizeDesc;
|
|
||||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
|
||||||
ze_result_t result = context->allocSharedMem(device->toHandle(),
|
|
||||||
&deviceDesc,
|
|
||||||
&hostDesc,
|
|
||||||
size, alignment, &ptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
EXPECT_NE(nullptr, ptr);
|
|
||||||
|
|
||||||
result = context->freeMem(ptr);
|
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MemoryRelaxedSizeTests,
|
TEST_F(MemoryRelaxedSizeTests,
|
||||||
givenCallToSharedAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
|
givenCallToSharedAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
|
||||||
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
|
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user