From fcc2038defe0ceaea97f5be61017c1205d804aaa Mon Sep 17 00:00:00 2001 From: "Chodor, Jaroslaw" Date: Wed, 16 Jul 2025 17:35:14 +0000 Subject: [PATCH] refactor: modernizing NEO::Range->std::span Signed-off-by: Chodor, Jaroslaw --- .../xe_hpg_core/cmdlist_xe_hpg_core.cpp | 2 +- .../experimental/source/graph/graph.cpp | 2 +- level_zero/experimental/source/graph/graph.h | 12 +-- opencl/source/command_queue/command_queue.cpp | 4 +- opencl/source/command_queue/command_queue.h | 10 +-- .../source/command_queue/command_queue_hw.h | 2 +- .../command_queue/command_queue_hw_base.inl | 2 +- .../command_queue_hw_xehp_and_later.inl | 8 +- opencl/source/command_queue/enqueue_common.h | 8 +- .../source/command_queue/resource_barrier.cpp | 7 +- opencl/source/event/event.cpp | 6 +- .../api/cl_enqueue_wait_for_events_tests.inl | 4 +- .../command_queue/blit_enqueue_1_tests.cpp | 2 +- .../command_queue_hw_1_tests.cpp | 2 +- .../command_queue/command_queue_tests.cpp | 2 +- .../command_queue/enqueue_handler_tests.cpp | 2 +- .../command_queue/enqueue_kernel_2_tests.cpp | 2 +- .../helpers/timestamp_packet_1_tests.cpp | 4 +- .../unit_test/mocks/mock_command_queue.cpp | 2 +- .../test/unit_test/mocks/mock_command_queue.h | 14 +-- .../unit_test/profiling/profiling_tests.cpp | 2 +- shared/source/helpers/cache_flush.inl | 13 +-- .../helpers/cache_flush_xehp_and_later.inl | 13 +-- shared/source/utilities/CMakeLists.txt | 1 - shared/source/utilities/range.h | 90 ------------------- .../command_encoder_xe_hpg_core.cpp | 2 +- .../elf/elf_encoder_tests.cpp | 9 +- .../unit_test/utilities/containers_tests.cpp | 44 +-------- 28 files changed, 71 insertions(+), 200 deletions(-) delete mode 100644 shared/source/utilities/range.h diff --git a/level_zero/core/source/xe_hpg_core/cmdlist_xe_hpg_core.cpp b/level_zero/core/source/xe_hpg_core/cmdlist_xe_hpg_core.cpp index 8a6db3bddc..8216fcda5e 100644 --- a/level_zero/core/source/xe_hpg_core/cmdlist_xe_hpg_core.cpp +++ b/level_zero/core/source/xe_hpg_core/cmdlist_xe_hpg_core.cpp @@ -59,7 +59,7 @@ void CommandListCoreFamily::applyMemoryRangesBarrier(uint32_t } for (size_t subrangeNumber = 0; subrangeNumber < subranges.size(); subrangeNumber += NEO::maxFlushSubrangeCount) { size_t rangeCount = subranges.size() <= subrangeNumber + NEO::maxFlushSubrangeCount ? subranges.size() - subrangeNumber : NEO::maxFlushSubrangeCount; - NEO::Range range = createRange(subranges.begin() + subrangeNumber, rangeCount); + std::span range = {subranges.begin() + subrangeNumber, rangeCount}; NEO::flushGpuCache(commandStream, range, postSyncAddressToFlush, device->getHwInfo()); } diff --git a/level_zero/experimental/source/graph/graph.cpp b/level_zero/experimental/source/graph/graph.cpp index 6a02164166..b624dc0e3c 100644 --- a/level_zero/experimental/source/graph/graph.cpp +++ b/level_zero/experimental/source/graph/graph.cpp @@ -248,7 +248,7 @@ ze_result_t ExecutableGraph::execute(L0::CommandList *executionTarget, void *pNe return ZE_RESULT_SUCCESS; } -void recordHandleWaitEventsFromNextCommand(L0::CommandList &srcCmdList, Graph *&captureTarget, NEO::Range events) { +void recordHandleWaitEventsFromNextCommand(L0::CommandList &srcCmdList, Graph *&captureTarget, std::span events) { if (captureTarget) { // already recording, look for joins for (auto evh : events) { diff --git a/level_zero/experimental/source/graph/graph.h b/level_zero/experimental/source/graph/graph.h index f8f0d98dd2..71849b83fb 100644 --- a/level_zero/experimental/source/graph/graph.h +++ b/level_zero/experimental/source/graph/graph.h @@ -7,13 +7,13 @@ #pragma once -#include "shared/source/utilities/range.h" #include "shared/source/utilities/stackvec.h" #include "level_zero/ze_api.h" #include #include +#include #include #include #include @@ -99,9 +99,9 @@ struct Closure { }; template -inline NEO::Range getCommandsWaitEventsList(TArgs... args) { +inline std::span getCommandsWaitEventsList(TArgs... args) { typename Closure::ApiArgs structuredApiArgs{args...}; - return NEO::Range{structuredApiArgs.phWaitEvents, structuredApiArgs.numWaitEvents}; + return std::span{structuredApiArgs.phWaitEvents, structuredApiArgs.numWaitEvents}; } template @@ -173,8 +173,8 @@ struct Closure { }; template <> -inline NEO::Range getCommandsWaitEventsList(ze_command_list_handle_t, uint32_t numEvents, ze_event_handle_t *phEvents) { - return NEO::Range{phEvents, numEvents}; +inline std::span getCommandsWaitEventsList(ze_command_list_handle_t, uint32_t numEvents, ze_event_handle_t *phEvents) { + return std::span{phEvents, numEvents}; } template <> @@ -314,7 +314,7 @@ struct Graph : _ze_graph_handle_t { std::unordered_map joinedForks; }; -void recordHandleWaitEventsFromNextCommand(L0::CommandList &srcCmdList, Graph *&captureTarget, NEO::Range events); +void recordHandleWaitEventsFromNextCommand(L0::CommandList &srcCmdList, Graph *&captureTarget, std::span events); void recordHandleSignalEventFromPreviousCommand(L0::CommandList &srcCmdList, Graph &captureTarget, ze_event_handle_t event); template diff --git a/opencl/source/command_queue/command_queue.cpp b/opencl/source/command_queue/command_queue.cpp index d2296dd7dc..bd3d474425 100644 --- a/opencl/source/command_queue/command_queue.cpp +++ b/opencl/source/command_queue/command_queue.cpp @@ -462,7 +462,7 @@ volatile TagAddressType *CommandQueue::getHwTagAddress() const { return getGpgpuCommandStreamReceiver().getTagAddress(); } -bool CommandQueue::isCompleted(TaskCountType gpgpuTaskCount, const Range &bcsStates) { +bool CommandQueue::isCompleted(TaskCountType gpgpuTaskCount, const std::span &bcsStates) { DEBUG_BREAK_IF(getHwTag() == CompletionStamp::notReady); if (getGpgpuCommandStreamReceiver().testTaskCountReady(getHwTagAddress(), gpgpuTaskCount)) { @@ -481,7 +481,7 @@ bool CommandQueue::isCompleted(TaskCountType gpgpuTaskCount, const Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) { +WaitStatus CommandQueue::waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) { WAIT_ENTER() WaitStatus waitStatus{WaitStatus::ready}; diff --git a/opencl/source/command_queue/command_queue.h b/opencl/source/command_queue/command_queue.h index d6842c34ca..b827c3f780 100644 --- a/opencl/source/command_queue/command_queue.h +++ b/opencl/source/command_queue/command_queue.h @@ -15,7 +15,6 @@ #include "shared/source/memory_manager/graphics_allocation.h" #include "shared/source/sku_info/sku_info_base.h" #include "shared/source/unified_memory/unified_memory.h" -#include "shared/source/utilities/range.h" #include "opencl/source/api/cl_types.h" #include "opencl/source/command_queue/copy_engine_state.h" @@ -25,6 +24,7 @@ #include #include +#include namespace NEO { class BarrierCommand; @@ -226,15 +226,15 @@ class CommandQueue : public BaseObject<_cl_command_queue> { volatile TagAddressType *getHwTagAddress() const; - MOCKABLE_VIRTUAL bool isCompleted(TaskCountType gpgpuTaskCount, const Range &bcsStates); + MOCKABLE_VIRTUAL bool isCompleted(TaskCountType gpgpuTaskCount, const std::span &bcsStates); bool isWaitForTimestampsEnabled() const; - virtual bool waitForTimestamps(Range copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) = 0; + virtual bool waitForTimestamps(std::span copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) = 0; MOCKABLE_VIRTUAL bool isQueueBlocked(); - MOCKABLE_VIRTUAL WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait); - MOCKABLE_VIRTUAL WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) { + MOCKABLE_VIRTUAL WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait); + MOCKABLE_VIRTUAL WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) { return this->waitUntilComplete(gpgpuTaskCountToWait, copyEnginesToWait, flushStampToWait, useQuickKmdSleep, true, false); } MOCKABLE_VIRTUAL WaitStatus waitForAllEngines(bool blockedQueue, PrintfHandler *printfHandler, bool cleanTemporaryAllocationsList, bool waitForTaskCountRequired); diff --git a/opencl/source/command_queue/command_queue_hw.h b/opencl/source/command_queue/command_queue_hw.h index cba3be9a46..4e8a2f6eeb 100644 --- a/opencl/source/command_queue/command_queue_hw.h +++ b/opencl/source/command_queue/command_queue_hw.h @@ -480,7 +480,7 @@ class CommandQueueHw : public CommandQueue { bool isCacheFlushCommand(uint32_t commandType) const override; - bool waitForTimestamps(Range copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) override; + bool waitForTimestamps(std::span copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) override; MOCKABLE_VIRTUAL bool isCacheFlushForBcsRequired() const; MOCKABLE_VIRTUAL void processSignalMultiRootDeviceNode(LinearStream *commandStream, diff --git a/opencl/source/command_queue/command_queue_hw_base.inl b/opencl/source/command_queue/command_queue_hw_base.inl index 7ecf31f1aa..66e0a730d5 100644 --- a/opencl/source/command_queue/command_queue_hw_base.inl +++ b/opencl/source/command_queue/command_queue_hw_base.inl @@ -183,7 +183,7 @@ inline bool waitForTimestampsWithinContainer(TimestampPacketContainer *container } template -bool CommandQueueHw::waitForTimestamps(Range copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) { +bool CommandQueueHw::waitForTimestamps(std::span copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) { using TSPacketType = typename Family::TimestampPacketType; bool waited = false; diff --git a/opencl/source/command_queue/command_queue_hw_xehp_and_later.inl b/opencl/source/command_queue/command_queue_hw_xehp_and_later.inl index 644bce2430..cad4031216 100644 --- a/opencl/source/command_queue/command_queue_hw_xehp_and_later.inl +++ b/opencl/source/command_queue/command_queue_hw_xehp_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,7 +21,7 @@ void CommandQueueHw::submitCacheFlush(Surface **surfaces, uint64_t postSyncAddress) { if constexpr (Family::isUsingL3Control) { StackVec subranges; - for (auto surface : createRange(surfaces, numSurfaces)) { + for (auto surface : std::span(surfaces, numSurfaces)) { auto resource = reinterpret_cast(surface); auto alloc = resource->getGraphicsAllocation(); coverRangeExact(alloc->getGpuAddress(), alloc->getUnderlyingBufferSize(), subranges, resource->resourceType); @@ -29,7 +29,7 @@ void CommandQueueHw::submitCacheFlush(Surface **surfaces, for (size_t subrangeNumber = 0; subrangeNumber < subranges.size(); subrangeNumber += maxFlushSubrangeCount) { size_t rangeCount = subranges.size() <= subrangeNumber + maxFlushSubrangeCount ? subranges.size() - subrangeNumber : maxFlushSubrangeCount; - Range range = createRange(subranges.begin() + subrangeNumber, rangeCount); + std::span range = {subranges.begin() + subrangeNumber, rangeCount}; uint64_t postSyncAddressToFlush = 0; if (rangeCount < maxFlushSubrangeCount || subranges.size() - subrangeNumber - maxFlushSubrangeCount == 0) { postSyncAddressToFlush = postSyncAddress; @@ -56,7 +56,7 @@ LinearStream &getCommandStream(CommandQueue if constexpr (Family::isUsingL3Control) { StackVec subranges; - for (auto surface : createRange(surfaces, numSurfaces)) { + for (auto surface : std::span(surfaces, numSurfaces)) { ResourceSurface *resource = reinterpret_cast(surface); auto alloc = resource->getGraphicsAllocation(); coverRangeExact(alloc->getGpuAddress(), alloc->getUnderlyingBufferSize(), subranges, resource->resourceType); diff --git a/opencl/source/command_queue/enqueue_common.h b/opencl/source/command_queue/enqueue_common.h index 10bdad6a4e..6f86a2cb94 100644 --- a/opencl/source/command_queue/enqueue_common.h +++ b/opencl/source/command_queue/enqueue_common.h @@ -21,7 +21,6 @@ #include "shared/source/memory_manager/unified_memory_manager.h" #include "shared/source/os_interface/os_context.h" #include "shared/source/program/sync_buffer_handler.h" -#include "shared/source/utilities/range.h" #include "shared/source/utilities/tag_allocator.h" #include "opencl/source/built_ins/builtins_dispatch_builder.h" @@ -43,6 +42,7 @@ #include "opencl/source/utilities/cl_logger.h" #include +#include namespace NEO { struct RootDeviceEnvironment; @@ -821,7 +821,7 @@ CompletionStamp CommandQueueHw::enqueueNonBlocked( } bool anyUncacheableArgs = false; - for (auto surface : createRange(surfaces, surfaceCount)) { + for (auto surface : std::span(surfaces, surfaceCount)) { surface->makeResident(csr); if (!surface->allowsL3Caching()) { anyUncacheableArgs = true; @@ -1059,7 +1059,7 @@ void CommandQueueHw::enqueueBlocked( } allSurfaces.reserve(allSurfaces.size() + surfaceCount); - for (auto &surface : createRange(surfaces, surfaceCount)) { + for (auto &surface : std::span(surfaces, surfaceCount)) { allSurfaces.push_back(surface->duplicate()); } @@ -1137,7 +1137,7 @@ CompletionStamp CommandQueueHw::enqueueCommandWithoutKernel( timestampPacketDependencies.cacheFlushNodes.makeResident(getGpgpuCommandStreamReceiver()); } - for (auto surface : createRange(surfaces, surfaceCount)) { + for (auto surface : std::span(surfaces, surfaceCount)) { surface->makeResident(getGpgpuCommandStreamReceiver()); } bool stateCacheInvalidationNeeded = false; diff --git a/opencl/source/command_queue/resource_barrier.cpp b/opencl/source/command_queue/resource_barrier.cpp index 8c85f161db..20c3519f70 100644 --- a/opencl/source/command_queue/resource_barrier.cpp +++ b/opencl/source/command_queue/resource_barrier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,16 +9,17 @@ #include "shared/source/device/device.h" #include "shared/source/memory_manager/unified_memory_manager.h" -#include "shared/source/utilities/range.h" #include "opencl/source/command_queue/command_queue.h" #include "opencl/source/context/context.h" #include "opencl/source/helpers/cl_validators.h" #include "opencl/source/mem_obj/mem_obj.h" +#include + namespace NEO { BarrierCommand::BarrierCommand(CommandQueue *commandQueue, const cl_resource_barrier_descriptor_intel *descriptors, uint32_t numDescriptors) : numSurfaces(numDescriptors) { - for (auto &description : createRange(descriptors, numDescriptors)) { + for (auto &description : std::span(descriptors, numDescriptors)) { GraphicsAllocation *allocation; if (description.memObject) { MemObj *memObj = nullptr; diff --git a/opencl/source/event/event.cpp b/opencl/source/event/event.cpp index c512fd0582..be441b7b96 100644 --- a/opencl/source/event/event.cpp +++ b/opencl/source/event/event.cpp @@ -20,7 +20,6 @@ #include "shared/source/helpers/timestamp_packet.h" #include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/utilities/perf_counter.h" -#include "shared/source/utilities/range.h" #include "shared/source/utilities/staging_buffer_manager.h" #include "shared/source/utilities/tag_allocator.h" @@ -35,6 +34,7 @@ #include #include +#include namespace NEO { Event::Event( @@ -483,7 +483,7 @@ inline WaitStatus Event::wait(bool blocking, bool useQuickKmdSleep) { } } - Range states{&bcsState, bcsState.isValid() ? 1u : 0u}; + std::span states{&bcsState, bcsState.isValid() ? 1u : 0u}; auto waitStatus = WaitStatus::notReady; auto waitedOnTimestamps = cmdQueue->waitForTimestamps(states, waitStatus, this->timestampPacketContainer.get(), nullptr); waitStatus = cmdQueue->waitUntilComplete(taskCount.load(), states, flushStamp->peekStamp(), useQuickKmdSleep, true, waitedOnTimestamps); @@ -773,7 +773,7 @@ bool Event::isCompleted() { return true; } - Range states{&bcsState, bcsState.isValid() ? 1u : 0u}; + std::span states{&bcsState, bcsState.isValid() ? 1u : 0u}; if (cmdQueue->isCompleted(getCompletionStamp(), states)) { gpuStateWaited = true; diff --git a/opencl/test/unit_test/api/cl_enqueue_wait_for_events_tests.inl b/opencl/test/unit_test/api/cl_enqueue_wait_for_events_tests.inl index 6a17ac65f4..d4090a40e4 100644 --- a/opencl/test/unit_test/api/cl_enqueue_wait_for_events_tests.inl +++ b/opencl/test/unit_test/api/cl_enqueue_wait_for_events_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -265,7 +265,7 @@ HWTEST_F(ClEnqueueWaitForEventsTests, givenAlreadyCompletedEventWhenWaitForCompl struct GTPinMockCommandQueue : MockCommandQueue { GTPinMockCommandQueue(Context *context, MockClDevice *device) : MockCommandQueue(context, device, nullptr, false) {} - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) override { return MockCommandQueue::waitUntilComplete(gpgpuTaskCountToWait, copyEnginesToWait, flushStampToWait, useQuickKmdSleep, true, true); } diff --git a/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp b/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp index 91ef598709..7c9dba2498 100644 --- a/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp @@ -1237,7 +1237,7 @@ HWTEST_TEMPLATED_F(BlitEnqueueTaskCountTests, whenWaitUntilCompletionCalledThenW uint32_t bcsTaskCount = 123; CopyEngineState bcsState{bcsCsr->getOsContext().getEngineType(), bcsTaskCount}; - commandQueue->waitUntilComplete(gpgpuTaskCount, Range{&bcsState}, 0, false); + commandQueue->waitUntilComplete(gpgpuTaskCount, std::span{&bcsState, 1}, 0, false); EXPECT_EQ(gpgpuTaskCount, static_cast *>(gpgpuCsr)->latestWaitForCompletionWithTimeoutTaskCount.load()); EXPECT_EQ(bcsTaskCount, static_cast *>(bcsCsr)->latestWaitForCompletionWithTimeoutTaskCount.load()); diff --git a/opencl/test/unit_test/command_queue/command_queue_hw_1_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_hw_1_tests.cpp index 300c9783bf..0b0728d95b 100644 --- a/opencl/test/unit_test/command_queue/command_queue_hw_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_hw_1_tests.cpp @@ -67,7 +67,7 @@ HWTEST_F(CommandQueueHwTest, whenCallingIsCompletedThenTestTaskCountValue) { cmdQ.bcsEngines[0] = &control; cmdQ.bcsStates[0] = state; - Range states{&state}; + std::span states{&state, 1}; EXPECT_EQ(0u, ultCsr.downloadAllocationsCalledCount); EXPECT_EQ(0u, bcsCsr->downloadAllocationsCalledCount); diff --git a/opencl/test/unit_test/command_queue/command_queue_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_tests.cpp index 8035cc7667..bdda181f40 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -1042,7 +1042,7 @@ struct WaitForQueueCompletionTests : public ::testing::Test { template struct MyCmdQueue : public CommandQueueHw { MyCmdQueue(Context *context, ClDevice *device) : CommandQueueHw(context, device, nullptr, false){}; - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { requestedUseQuickKmdSleep = useQuickKmdSleep; waitUntilCompleteCounter++; diff --git a/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp index c7fe7b1196..8ce3aaad4f 100644 --- a/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp @@ -112,7 +112,7 @@ struct EnqueueHandlerWithAubSubCaptureTests : public EnqueueHandlerTest { public: MockCmdQWithAubSubCapture(Context *context, ClDevice *device) : CommandQueueHw(context, device, nullptr, false) {} - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { waitUntilCompleteCalled = true; return CommandQueueHw::waitUntilComplete(gpgpuTaskCountToWait, copyEnginesToWait, flushStampToWait, useQuickKmdSleep, cleanTemporaryAllocationList, skipWait); diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp index b563156e36..d1cc5315e8 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp @@ -912,7 +912,7 @@ class MyCmdQ : public MockCommandQueueHw { auxTranslationDirection); } - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { waitCalled++; return MockCommandQueueHw::waitUntilComplete(gpgpuTaskCountToWait, copyEnginesToWait, flushStampToWait, useQuickKmdSleep, cleanTemporaryAllocationList, skipWait); } diff --git a/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp b/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp index 9af5780534..4f5fcb36f1 100644 --- a/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp +++ b/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp @@ -1004,7 +1004,7 @@ HWTEST_F(TimestampPacketTests, givenNewSubmissionWhileWaitingThenDontReleaseDefe public: using MockCommandQueueHw::MockCommandQueueHw; - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { this->taskCount++; return this->MockCommandQueueHw::waitUntilComplete(gpgpuTaskCountToWait, copyEnginesToWait, flushStampToWait, useQuickKmdSleep, cleanTemporaryAllocationList, skipWait); @@ -1050,7 +1050,7 @@ HWTEST_F(TimestampPacketTests, givenNewBcsSubmissionWhileWaitingThenDontReleaseD public: using MockCommandQueueHw::MockCommandQueueHw; - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { this->bcsStates[0].taskCount++; return this->MockCommandQueueHw::waitUntilComplete(gpgpuTaskCountToWait, copyEnginesToWait, flushStampToWait, useQuickKmdSleep, cleanTemporaryAllocationList, skipWait); diff --git a/opencl/test/unit_test/mocks/mock_command_queue.cpp b/opencl/test/unit_test/mocks/mock_command_queue.cpp index bc4be04671..e67e6d74ce 100644 --- a/opencl/test/unit_test/mocks/mock_command_queue.cpp +++ b/opencl/test/unit_test/mocks/mock_command_queue.cpp @@ -42,7 +42,7 @@ cl_int MockCommandQueue::enqueueMarkerWithWaitList(cl_uint numEventsInWaitList, return CL_SUCCESS; } -bool MockCommandQueue::isCompleted(TaskCountType gpgpuTaskCount, const Range &bcsStates) { +bool MockCommandQueue::isCompleted(TaskCountType gpgpuTaskCount, const std::span &bcsStates) { isCompletedCalled++; if (!device || !getGpgpuCommandStreamReceiver().getTagAddress()) { diff --git a/opencl/test/unit_test/mocks/mock_command_queue.h b/opencl/test/unit_test/mocks/mock_command_queue.h index 79389ae15f..63b4aa9e91 100644 --- a/opencl/test/unit_test/mocks/mock_command_queue.h +++ b/opencl/test/unit_test/mocks/mock_command_queue.h @@ -97,7 +97,7 @@ class MockCommandQueue : public CommandQueue { return CL_SUCCESS; } - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { latestTaskCountWaited = gpgpuTaskCountToWait; waitUntilCompleteCalledCount++; @@ -108,7 +108,7 @@ class MockCommandQueue : public CommandQueue { return CommandQueue::waitUntilComplete(gpgpuTaskCountToWait, copyEnginesToWait, flushStampToWait, useQuickKmdSleep, cleanTemporaryAllocationList, skipWait); } - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) override { latestTaskCountWaited = gpgpuTaskCountToWait; return CommandQueue::waitUntilComplete(gpgpuTaskCountToWait, copyEnginesToWait, flushStampToWait, useQuickKmdSleep); } @@ -233,12 +233,12 @@ class MockCommandQueue : public CommandQueue { cl_int flush() override { return CL_SUCCESS; } - bool waitForTimestamps(Range copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) override { + bool waitForTimestamps(std::span copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) override { waitForTimestampsCalled = true; return false; }; - bool isCompleted(TaskCountType gpgpuTaskCount, const Range &bcsStates) override; + bool isCompleted(TaskCountType gpgpuTaskCount, const std::span &bcsStates) override; bool enqueueMarkerWithWaitListCalled = false; bool releaseIndirectHeapCalled = false; @@ -452,7 +452,7 @@ class MockCommandQueueHw : public CommandQueueHw { useBcsCsrOnNotifyEnabled = notifyBcsCsr; } - WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, Range copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { + WaitStatus waitUntilComplete(TaskCountType gpgpuTaskCountToWait, std::span copyEnginesToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool cleanTemporaryAllocationList, bool skipWait) override { this->recordedSkipWait = skipWait; latestTaskCountWaited = gpgpuTaskCountToWait; if (waitUntilCompleteReturnValue.has_value()) { @@ -496,7 +496,7 @@ class MockCommandQueueHw : public CommandQueueHw { return BaseClass::isGpgpuSubmissionForBcsRequired(queueBlocked, timestampPacketDependencies, containsCrossEngineDependency, textureCacheFlushRequired); } - bool waitForTimestamps(Range copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) override { + bool waitForTimestamps(std::span copyEnginesToWait, WaitStatus &status, TimestampPacketContainer *mainContainer, TimestampPacketContainer *deferredContainer) override { waitForTimestampsCalled = true; latestWaitForTimestampsStatus = BaseClass::waitForTimestamps(copyEnginesToWait, status, mainContainer, deferredContainer); @@ -504,7 +504,7 @@ class MockCommandQueueHw : public CommandQueueHw { return latestWaitForTimestampsStatus; } - bool isCompleted(TaskCountType gpgpuTaskCount, const Range &bcsStates) override { + bool isCompleted(TaskCountType gpgpuTaskCount, const std::span &bcsStates) override { isCompletedCalled++; return CommandQueue::isCompleted(gpgpuTaskCount, bcsStates); diff --git a/opencl/test/unit_test/profiling/profiling_tests.cpp b/opencl/test/unit_test/profiling/profiling_tests.cpp index c5d1cb3738..33767a1e44 100644 --- a/opencl/test/unit_test/profiling/profiling_tests.cpp +++ b/opencl/test/unit_test/profiling/profiling_tests.cpp @@ -628,7 +628,7 @@ HWTEST_F(ProfilingTests, givenDebugFlagSetWhenWaitingForTimestampThenPrint) { StreamCapture capture; capture.captureStdout(); - Range copyEngineStates; + std::span copyEngineStates; WaitStatus status; container->add(node.get()); diff --git a/shared/source/helpers/cache_flush.inl b/shared/source/helpers/cache_flush.inl index 30c1e06ff9..b5d1a82f49 100644 --- a/shared/source/helpers/cache_flush.inl +++ b/shared/source/helpers/cache_flush.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,12 +10,13 @@ #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/l3_range.h" -#include "shared/source/utilities/range.h" + +#include namespace NEO { template -inline void flushGpuCache(LinearStream *commandStream, const Range &ranges, uint64_t postSyncAddress, const RootDeviceEnvironment &rootDeviceEnvironment) { +inline void flushGpuCache(LinearStream *commandStream, const std::span &ranges, uint64_t postSyncAddress, const RootDeviceEnvironment &rootDeviceEnvironment) { using L3_FLUSH_EVICTION_POLICY = typename GfxFamily::L3_FLUSH_ADDRESS_RANGE::L3_FLUSH_EVICTION_POLICY; auto templ = GfxFamily::cmdInitL3ControlWithPostSync; templ.getBase().setHdcPipelineFlush(true); @@ -24,8 +25,8 @@ inline void flushGpuCache(LinearStream *commandStream, const Range &ran auto &productHelper = rootDeviceEnvironment.getHelper(); auto isA0Stepping = GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo, productHelper); - for (const L3Range *it = &*ranges.begin(), *last = &*ranges.rbegin(), *end = &*ranges.end(); it != end; ++it) { - if ((it == last) && (postSyncAddress != 0)) { + for (auto it = ranges.begin(), end = ranges.end(); it != end; ++it) { + if ((it + 1 == end) && (postSyncAddress != 0)) { auto l3Control = commandStream->getSpaceForCmd(); auto cmd = GfxFamily::cmdInitL3ControlWithPostSync; @@ -49,7 +50,7 @@ inline void flushGpuCache(LinearStream *commandStream, const Range &ran } template -inline size_t getSizeNeededToFlushGpuCache(const Range &ranges, bool usePostSync) { +inline size_t getSizeNeededToFlushGpuCache(const std::span &ranges, bool usePostSync) { size_t size = ranges.size() * sizeof(typename GfxFamily::L3_CONTROL); if (usePostSync) { UNRECOVERABLE_IF(ranges.size() == 0); diff --git a/shared/source/helpers/cache_flush_xehp_and_later.inl b/shared/source/helpers/cache_flush_xehp_and_later.inl index ded3a3c986..12c22521e1 100644 --- a/shared/source/helpers/cache_flush_xehp_and_later.inl +++ b/shared/source/helpers/cache_flush_xehp_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,20 +7,21 @@ #include "shared/source/command_stream/linear_stream.h" #include "shared/source/helpers/l3_range.h" -#include "shared/source/utilities/range.h" + +#include namespace NEO { struct HardwareInfo; template -inline size_t getSizeNeededToFlushGpuCache(const Range &ranges, bool usePostSync) { +inline size_t getSizeNeededToFlushGpuCache(const std::span &ranges, bool usePostSync) { size_t size = sizeof(typename GfxFamily::L3_CONTROL) * (ranges.size() / maxFlushSubrangeCount + 1); size += ranges.size() * sizeof(typename GfxFamily::L3_FLUSH_ADDRESS_RANGE); return size; } template -inline size_t getSizeNeededForL3Control(const Range &ranges) { +inline size_t getSizeNeededForL3Control(const std::span &ranges) { size_t size = sizeof(typename GfxFamily::L3_CONTROL); size += ranges.size() * sizeof(typename GfxFamily::L3_FLUSH_ADDRESS_RANGE); return size; @@ -30,7 +31,7 @@ template void adjustL3ControlField(void *l3ControlBuffer); template -inline void flushGpuCache(LinearStream *commandStream, const Range &ranges, uint64_t postSyncAddress, const HardwareInfo &hwInfo) { +inline void flushGpuCache(LinearStream *commandStream, const std::span &ranges, uint64_t postSyncAddress, const HardwareInfo &hwInfo) { using L3_FLUSH_ADDRESS_RANGE = typename GfxFamily::L3_FLUSH_ADDRESS_RANGE; using L3_CONTROL = typename GfxFamily::L3_CONTROL; using L3_FLUSH_EVICTION_POLICY = typename GfxFamily::L3_FLUSH_ADDRESS_RANGE::L3_FLUSH_EVICTION_POLICY; @@ -54,7 +55,7 @@ inline void flushGpuCache(LinearStream *commandStream, const Range &ran l3Control++; L3_FLUSH_ADDRESS_RANGE *l3Ranges = reinterpret_cast(l3Control); L3_FLUSH_ADDRESS_RANGE cmdFlushRange = {}; - for (const L3Range *it = &*ranges.begin(), *end = &*ranges.end(); it != end; ++it, l3Ranges++) { + for (auto it = ranges.begin(), end = ranges.end(); it != end; ++it, l3Ranges++) { cmdFlushRange = GfxFamily::cmdInitL3FlushAddressRange; cmdFlushRange.setAddress(it->getMaskedAddress()); diff --git a/shared/source/utilities/CMakeLists.txt b/shared/source/utilities/CMakeLists.txt index 06f96e1179..b332745076 100644 --- a/shared/source/utilities/CMakeLists.txt +++ b/shared/source/utilities/CMakeLists.txt @@ -33,7 +33,6 @@ set(NEO_CORE_UTILITIES ${CMAKE_CURRENT_SOURCE_DIR}/perf_counter.h ${CMAKE_CURRENT_SOURCE_DIR}/perf_profiler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/perf_profiler.h - ${CMAKE_CURRENT_SOURCE_DIR}/range.h ${CMAKE_CURRENT_SOURCE_DIR}/reference_tracked_object.h ${CMAKE_CURRENT_SOURCE_DIR}/shared_pool_allocation.h ${CMAKE_CURRENT_SOURCE_DIR}/software_tags.cpp diff --git a/shared/source/utilities/range.h b/shared/source/utilities/range.h deleted file mode 100644 index 9977636478..0000000000 --- a/shared/source/utilities/range.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2018-2025 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#pragma once -#include "shared/source/helpers/non_copyable_or_moveable.h" - -#include - -namespace NEO { - -template -struct Range : NEO::NonCopyableAndNonMovableClass { - using iterator = DataType *; - using const_iterator = const DataType *; - using reverse_iterator = std::reverse_iterator; - using const_reverse_iterator = std::reverse_iterator; - - Range() - : begIt(nullptr), endIt(nullptr) { - } - - explicit Range(DataType *base, size_t count = 1) - : begIt(base), endIt(base + count) { - } - - template size())> - Range(SequentialContainerT &container) - : Range(&*container.begin(), container.size()) { - } - - template - Range(T (&base)[size]) - : Range(&base[0], size) { - } - - iterator begin() { - return begIt; - } - - iterator end() { - return endIt; - } - - const_iterator begin() const { - return begIt; - } - - const_iterator end() const { - return endIt; - } - - reverse_iterator rbegin() { - return reverse_iterator(end()); - } - - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - - reverse_iterator rend() { - return reverse_iterator(end()) + (endIt - begIt); - } - - const_reverse_iterator rend() const { - return const_reverse_iterator(end()) + (endIt - begIt); - } - - bool empty() const { - return begIt == endIt; - } - - size_t size() const { - return endIt - begIt; - } - - iterator begIt; - iterator endIt; -}; - -static_assert(NEO::NonCopyableAndNonMovable>); - -template -inline Range createRange(T *base, size_t count) { - return Range(base, count); -} -} // namespace NEO diff --git a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp index 8f4d280c16..23b825427a 100644 --- a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp @@ -189,7 +189,7 @@ void EncodeMiFlushDW::adjust(MI_FLUSH_DW *miFlushDwCmd, const ProductHel namespace NEO { template void InOrderPatchCommandHelpers::PatchCmd::patchComputeWalker(uint64_t appendCounterValue); template void InOrderPatchCommandHelpers::PatchCmd::patchBlitterCommand(uint64_t appendCounterValue, InOrderPatchCommandHelpers::PatchCmdType patchCmdType); -template void flushGpuCache(LinearStream *commandStream, const Range &ranges, uint64_t postSyncAddress, const HardwareInfo &hwInfo); +template void flushGpuCache(LinearStream *commandStream, const std::span &ranges, uint64_t postSyncAddress, const HardwareInfo &hwInfo); template struct EncodeDispatchKernelWithHeap; template void NEO::EncodeDispatchKernelWithHeap::adjustBindingTablePrefetch(Family::DefaultWalkerType::InterfaceDescriptorType &, unsigned int, unsigned int); diff --git a/shared/test/unit_test/device_binary_format/elf/elf_encoder_tests.cpp b/shared/test/unit_test/device_binary_format/elf/elf_encoder_tests.cpp index 79a2684a94..e4431b2a17 100644 --- a/shared/test/unit_test/device_binary_format/elf/elf_encoder_tests.cpp +++ b/shared/test/unit_test/device_binary_format/elf/elf_encoder_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,9 +7,10 @@ #include "shared/source/device_binary_format/elf/elf_encoder.h" #include "shared/source/helpers/aligned_memory.h" -#include "shared/source/utilities/range.h" #include "shared/test/common/test_macros/test.h" +#include + using namespace NEO::Elf; TEST(ElfEncoder, WhenEmptyDataThenEncodedElfContainsOnlyHeader) { @@ -401,10 +402,10 @@ TEST(ElfEncoder, WhenDefaultAlignmentIsRaisedThenSegmentDataAbideByIt) { auto &header64 = *reinterpret_cast *>(elfData64.data()); auto sectionHeaders = reinterpret_cast *>(elfData64.data() + static_cast(header64.shOff)); auto programHeaders = reinterpret_cast *>(elfData64.data() + static_cast(header64.phOff)); - for (const auto §ion : NEO::createRange(sectionHeaders, header64.shNum)) { + for (const auto §ion : std::span(sectionHeaders, header64.shNum)) { EXPECT_EQ(0U, section.offset % 8U); } - for (const auto &segment : NEO::createRange(programHeaders, header64.phNum)) { + for (const auto &segment : std::span(programHeaders, header64.phNum)) { EXPECT_EQ(0U, segment.offset % alignment); EXPECT_LE(alignment, segment.align); } diff --git a/shared/test/unit_test/utilities/containers_tests.cpp b/shared/test/unit_test/utilities/containers_tests.cpp index 5db54433cc..b8195f0b78 100644 --- a/shared/test/unit_test/utilities/containers_tests.cpp +++ b/shared/test/unit_test/utilities/containers_tests.cpp @@ -10,7 +10,6 @@ #include "shared/source/utilities/idlist.h" #include "shared/source/utilities/iflist.h" #include "shared/source/utilities/lookup_array.h" -#include "shared/source/utilities/range.h" #include "shared/source/utilities/stackvec.h" #include "shared/test/unit_test/utilities/containers_tests_helpers.h" @@ -21,6 +20,7 @@ #include #include #include +#include #include #include @@ -1894,48 +1894,6 @@ TEST(ArrayRef, GivenArraysContainingSameDataWhenComparingThenEqualReturnsTrue) { EXPECT_TRUE(arrayA == arrayB); } -TEST(Range, GivenRangeThenValidStandardIteratorsAreAvailable) { - int tab[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; - Range range = tab; - const Range &constantRange = range; - Range emptyRange{nullptr, 0}; - EXPECT_EQ(0U, emptyRange.size()); - EXPECT_TRUE(emptyRange.empty()); - EXPECT_EQ(10U, constantRange.size()); - EXPECT_FALSE(constantRange.empty()); - - auto rangeFwdIt = range.begin(); - auto rangeFwdEnd = range.end(); - auto rangeBackIt = range.rbegin(); - auto rangeBackEnd = range.rend(); - - auto constantRangeFwdIt = constantRange.begin(); - auto constantRangeFwdEnd = constantRange.end(); - auto constantRangeBackIt = constantRange.rbegin(); - auto constantRangeBackEnd = constantRange.rend(); - for (int i = 0; i < 10; ++i, ++rangeFwdIt, ++rangeBackIt, ++constantRangeFwdIt, ++constantRangeBackIt) { - EXPECT_EQ(tab[i], *rangeFwdIt) << " it : " << i; - EXPECT_EQ(tab[i], *constantRangeFwdIt) << " it : " << i; - EXPECT_NE(rangeFwdEnd, rangeFwdIt) << " it : " << i; - EXPECT_NE(constantRangeFwdEnd, constantRangeFwdIt) << " it : " << i; - - EXPECT_EQ(tab[10 - 1 - i], *rangeBackIt) << " it : " << i; - EXPECT_EQ(tab[10 - 1 - i], *constantRangeBackIt) << " it : " << i; - EXPECT_NE(rangeBackEnd, rangeBackIt) << " it : " << i; - EXPECT_NE(constantRangeBackEnd, constantRangeBackIt) << " it : " << i; - } - - EXPECT_EQ(rangeFwdEnd, rangeFwdIt); - EXPECT_EQ(constantRangeFwdEnd, constantRangeFwdIt); - EXPECT_EQ(rangeBackEnd, rangeBackIt); - EXPECT_EQ(constantRangeBackEnd, constantRangeBackIt); - - std::vector vec(&tab[0], &tab[10]); - Range rangeFromVec = vec; - EXPECT_EQ(&*vec.begin(), &*rangeFromVec.begin()); - EXPECT_EQ(&*vec.rbegin(), &*rangeFromVec.rbegin()); -} - TEST(ArrayRef, WhenFromAnyIsCalledThenPointerIsReinterpretedAndSizeIsAdjusted) { uint32_t x[2] = {}; auto arrayRefU8 = ArrayRef::fromAny(x, 2);