Skip to content

Commit

Permalink
implement comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraPerego committed Feb 22, 2024
1 parent 68df8f2 commit 2fb8532
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 40 deletions.
8 changes: 5 additions & 3 deletions include/alpaka/core/Common.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Axel Hübl, Benjamin Worpitz, Matthias Werner, Jan Stephan, René Widera, Andrea Bocci, Aurora Perego
/* Copyright 2024 Axel Hübl, Benjamin Worpitz, Matthias Werner, Jan Stephan, René Widera, Andrea Bocci, Aurora Perego
* SPDX-License-Identifier: MPL-2.0
*/

Expand Down Expand Up @@ -102,7 +102,8 @@
//!
//! Those variables behave like ordinary variables when used in file-scope,
//! but inside kernels the get() method must be used to access the variable.
//! They are declared inline to be accessible from other compilation units.
//! They are declared inline to resolve to a single instance across multiple
//! translation units.
//! Like ordinary variables, only one definition is allowed (ODR)
//! Failure to do so might lead to linker errors.
//!
Expand Down Expand Up @@ -175,7 +176,8 @@ namespace alpaka
//!
//! Those variables behave like ordinary variables when used in file-scope,
//! but inside kernels the get() method must be used to access the variable.
//! They are declared inline to be accessible from other compilation units.
//! They are declared inline to resolve to a single instance across multiple
//! translation units.
//! Like ordinary variables, only one definition is allowed (ODR)
//! Failure to do so might lead to linker errors.
//!
Expand Down
24 changes: 12 additions & 12 deletions include/alpaka/mem/global/DeviceGlobalCpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ namespace alpaka
template<typename TViewSrc, typename TViewDstFwd, typename TQueue>
ALPAKA_FN_HOST auto memcpy(TQueue& queue, alpaka::DevGlobal<TViewDstFwd>& viewDst, TViewSrc const& viewSrc) -> void
{
typedef std::remove_all_extents_t<TViewDstFwd> T;
using Type = std::remove_all_extents_t<TViewDstFwd>;
auto extent = getExtents(viewSrc);
auto view = alpaka::ViewPlainPtr<DevCpu, T, alpaka::Dim<decltype(extent)>, alpaka::Idx<decltype(extent)>>(
reinterpret_cast<T*>(&viewDst),
auto view = alpaka::ViewPlainPtr<DevCpu, Type, alpaka::Dim<decltype(extent)>, alpaka::Idx<decltype(extent)>>(
reinterpret_cast<Type*>(&viewDst),
alpaka::getDev(queue),
extent);
enqueue(queue, createTaskMemcpy(std::forward<decltype(view)>(view), viewSrc, extent));
Expand All @@ -27,10 +27,10 @@ namespace alpaka
template<typename TViewSrc, typename TViewDstFwd, typename TQueue>
ALPAKA_FN_HOST auto memcpy(TQueue& queue, TViewDstFwd&& viewDst, alpaka::DevGlobal<TViewSrc>& viewSrc) -> void
{
typedef std::remove_all_extents_t<TViewSrc> T;
using Type = std::remove_all_extents_t<TViewSrc>;
auto extent = getExtents(viewDst);
auto view = alpaka::ViewPlainPtr<DevCpu, T, alpaka::Dim<decltype(extent)>, alpaka::Idx<decltype(extent)>>(
reinterpret_cast<T*>(&viewSrc),
auto view = alpaka::ViewPlainPtr<DevCpu, Type, alpaka::Dim<decltype(extent)>, alpaka::Idx<decltype(extent)>>(
reinterpret_cast<Type*>(&viewSrc),
alpaka::getDev(queue),
extent);
enqueue(queue, createTaskMemcpy(std::forward<TViewDstFwd>(viewDst), view, extent));
Expand All @@ -43,9 +43,9 @@ namespace alpaka
TViewSrc const& viewSrc,
TExtent const& extent) -> void
{
typedef std::remove_all_extents_t<TViewDstFwd> T;
auto view = alpaka::ViewPlainPtr<DevCpu, T, alpaka::Dim<TExtent>, alpaka::Idx<TExtent>>(
reinterpret_cast<T*>(&viewDst),
using Type = std::remove_all_extents_t<TViewDstFwd>;
auto view = alpaka::ViewPlainPtr<DevCpu, Type, alpaka::Dim<TExtent>, alpaka::Idx<TExtent>>(
reinterpret_cast<Type*>(&viewDst),
alpaka::getDev(queue),
extent);
enqueue(queue, createTaskMemcpy(std::forward<decltype(view)>(view), viewSrc, extent));
Expand All @@ -58,9 +58,9 @@ namespace alpaka
alpaka::DevGlobal<TViewSrc>& viewSrc,
TExtent const& extent) -> void
{
typedef std::remove_all_extents_t<TViewSrc> T;
auto view = alpaka::ViewPlainPtr<DevCpu, T, alpaka::Dim<TExtent>, alpaka::Idx<TExtent>>(
reinterpret_cast<T*>(&viewSrc),
using Type = std::remove_all_extents_t<TViewSrc>;
auto view = alpaka::ViewPlainPtr<DevCpu, Type, alpaka::Dim<TExtent>, alpaka::Idx<TExtent>>(
reinterpret_cast<Type*>(&viewSrc),
alpaka::getDev(queue),
extent);
enqueue(queue, createTaskMemcpy(std::forward<TViewDstFwd>(viewDst), view, extent));
Expand Down
40 changes: 20 additions & 20 deletions include/alpaka/mem/global/DeviceGlobalUniformCudaHipBuiltIn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ namespace alpaka
TViewDst& viewDst,
alpaka::DevGlobal<TViewSrc>& viewSrc)
{
typedef std::remove_all_extents_t<TViewSrc> T;
using Type = std::remove_all_extents_t<TViewSrc>;
auto extent = getExtents(viewDst);
T* pMemAcc(nullptr);
Type* pMemAcc(nullptr);
ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK(
TApi::getSymbolAddress(reinterpret_cast<void**>(&pMemAcc), *(&viewSrc.value)));

auto view = alpaka::
ViewPlainPtr<DevUniformCudaHipRt<TApi>, T, alpaka::Dim<decltype(extent)>, alpaka::Idx<decltype(extent)>>(
pMemAcc,
alpaka::getDev(queue),
extent);
auto view = alpaka::ViewPlainPtr<
DevUniformCudaHipRt<TApi>,
Type,
alpaka::Dim<decltype(extent)>,
alpaka::Idx<decltype(extent)>>(pMemAcc, alpaka::getDev(queue), extent);
enqueue(queue, createTaskMemcpy(std::forward<TViewDst>(viewDst), view, extent));
}

Expand All @@ -39,17 +39,17 @@ namespace alpaka
alpaka::DevGlobal<TViewDst>& viewDst,
TViewSrc const& viewSrc)
{
typedef std::remove_all_extents_t<TViewDst> T;
using Type = std::remove_all_extents_t<TViewDst>;
auto extent = getExtents(viewSrc);
T* pMemAcc(nullptr);
Type* pMemAcc(nullptr);
ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK(
TApi::getSymbolAddress(reinterpret_cast<void**>(&pMemAcc), *(&viewDst.value)));

auto view = alpaka::
ViewPlainPtr<DevUniformCudaHipRt<TApi>, T, alpaka::Dim<decltype(extent)>, alpaka::Idx<decltype(extent)>>(
pMemAcc,
alpaka::getDev(queue),
extent);
auto view = alpaka::ViewPlainPtr<
DevUniformCudaHipRt<TApi>,
Type,
alpaka::Dim<decltype(extent)>,
alpaka::Idx<decltype(extent)>>(pMemAcc, alpaka::getDev(queue), extent);
enqueue(queue, createTaskMemcpy(std::forward<decltype(view)>(view), viewSrc, extent));
}

Expand All @@ -61,12 +61,12 @@ namespace alpaka
alpaka::DevGlobal<TViewSrc>& viewSrc,
TExtent extent)
{
typedef std::remove_all_extents_t<TViewSrc> T;
T* pMemAcc(nullptr);
using Type = std::remove_all_extents_t<TViewSrc>;
Type* pMemAcc(nullptr);
ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK(
TApi::getSymbolAddress(reinterpret_cast<void**>(&pMemAcc), *(&viewSrc.value)));

auto view = alpaka::ViewPlainPtr<DevUniformCudaHipRt<TApi>, T, alpaka::Dim<TExtent>, alpaka::Idx<TExtent>>(
auto view = alpaka::ViewPlainPtr<DevUniformCudaHipRt<TApi>, Type, alpaka::Dim<TExtent>, alpaka::Idx<TExtent>>(
pMemAcc,
alpaka::getDev(queue),
extent);
Expand All @@ -81,12 +81,12 @@ namespace alpaka
TViewSrc const& viewSrc,
TExtent extent)
{
typedef std::remove_all_extents_t<TViewDst> T;
T* pMemAcc(nullptr);
using Type = std::remove_all_extents_t<TViewDst>;
Type* pMemAcc(nullptr);
ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK(
TApi::getSymbolAddress(reinterpret_cast<void**>(&pMemAcc), *(&viewDst.value)));

auto view = alpaka::ViewPlainPtr<DevUniformCudaHipRt<TApi>, T, alpaka::Dim<TExtent>, alpaka::Idx<TExtent>>(
auto view = alpaka::ViewPlainPtr<DevUniformCudaHipRt<TApi>, Type, alpaka::Dim<TExtent>, alpaka::Idx<TExtent>>(
pMemAcc,
alpaka::getDev(queue),
extent);
Expand Down
8 changes: 4 additions & 4 deletions include/alpaka/test/KernelExecutionFixture.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Benjamin Worpitz, Andrea Bocci, Bernhard Manfred Gruber, Jan Stephan, Aurora Perego
/* Copyright 2024 Benjamin Worpitz, Andrea Bocci, Bernhard Manfred Gruber, Jan Stephan, Aurora Perego
* SPDX-License-Identifier: MPL-2.0
*/

Expand Down Expand Up @@ -50,13 +50,13 @@ namespace alpaka::test
{
}

KernelExecutionFixture(Queue& queue, WorkDiv workDiv) : m_queue{queue}, m_workDiv{std::move(workDiv)}
KernelExecutionFixture(Queue queue, WorkDiv workDiv) : m_queue{std::move(queue)}, m_workDiv{std::move(workDiv)}
{
}

template<typename TExtent>
KernelExecutionFixture(Queue& queue, TExtent const& extent)
: m_queue{queue}
KernelExecutionFixture(Queue queue, TExtent const& extent)
: m_queue{std::move(queue)}
, m_workDiv{getValidWorkDiv<Acc>(
m_device,
extent,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mem/view/src/ViewStaticAccMem.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Axel Huebl, Benjamin Worpitz, Matthias Werner, Bernhard Manfred Gruber, Jan Stephan, Andrea Bocci,
/* Copyright 2024 Axel Huebl, Benjamin Worpitz, Matthias Werner, Bernhard Manfred Gruber, Jan Stephan, Andrea Bocci,
* Aurora Perego SPDX-License-Identifier: MPL-2.0
*/

Expand Down

0 comments on commit 2fb8532

Please sign in to comment.