Program Listing for File SyclCopyFromOperation.cpp

Return to documentation for file (umpire/op/SyclCopyFromOperation.cpp)

//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016-20, Lawrence Livermore National Security, LLC and Umpire
// project contributors. See the COPYRIGHT file for details.
//
// SPDX-License-Identifier: (MIT)
//////////////////////////////////////////////////////////////////////////////
#include "umpire/op/SyclCopyFromOperation.hpp"

#include <CL/sycl.hpp>

#include "umpire/strategy/AllocationStrategy.hpp"
#include "umpire/util/Macros.hpp"

namespace umpire {
namespace op {

void SyclCopyFromOperation::transform(
    void* src_ptr, void** dst_ptr, util::AllocationRecord* src_allocation,
    util::AllocationRecord* UMPIRE_UNUSED_ARG(dst_allocation),
    std::size_t length)
{
  cl::sycl::queue sycl_queue(src_allocation->strategy->getTraits().queue);
  sycl_queue.memcpy(*dst_ptr, src_ptr, length);
  sycl_queue.wait();

  UMPIRE_RECORD_STATISTIC("SyclCopyFromOperation", "src_ptr",
                          reinterpret_cast<uintptr_t>(src_ptr), "dst_ptr",
                          reinterpret_cast<uintptr_t>(*dst_ptr), "size", length,
                          "event", "copy");
}

} // end of namespace op
} // end of namespace umpire