diff --git a/runtime/mem_obj/buffer.cpp b/runtime/mem_obj/buffer.cpp index fa24558927..15f66a30ce 100644 --- a/runtime/mem_obj/buffer.cpp +++ b/runtime/mem_obj/buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2018 Intel Corporation + * Copyright (C) 2017-2019 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -147,10 +147,7 @@ Buffer *Buffer::create(Context *context, } if (allocationType == GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY) { - if (properties.flags & CL_MEM_ALLOC_HOST_PTR) { - zeroCopyAllowed = true; - allocateMemory = true; - } else if (properties.flags & CL_MEM_USE_HOST_PTR) { + if (properties.flags & CL_MEM_USE_HOST_PTR) { allocateMemory = false; if (!alignementSatisfied || DebugManager.flags.DisableZeroCopyForUseHostPtr.get()) { zeroCopyAllowed = false; @@ -326,8 +323,6 @@ GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(cl_mem_flag type = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY; } else if (renderCompressedBuffers) { type = GraphicsAllocation::AllocationType::BUFFER_COMPRESSED; - } else if (flags & CL_MEM_ALLOC_HOST_PTR) { - type = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY; } if (sharedContext) { diff --git a/unit_tests/mem_obj/buffer_tests.cpp b/unit_tests/mem_obj/buffer_tests.cpp index bc43e2dd76..61c2351d8f 100644 --- a/unit_tests/mem_obj/buffer_tests.cpp +++ b/unit_tests/mem_obj/buffer_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2018 Intel Corporation + * Copyright (C) 2017-2019 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -311,10 +311,14 @@ TEST(Buffer, givenUseHostPtrFlagWhenAllocationTypeIsQueriedThenBufferHostMemoryT EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type); } -TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) { +TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) { cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR; auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, false); - EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type); + if (is64bit) { + EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type); + } else { + EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type); + } } TEST(Buffer, givenUseHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {