From 1cb65b750797c81c69b4d078b0c5f889bb80c381 Mon Sep 17 00:00:00 2001 From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de> Date: Wed, 10 May 2023 15:16:55 +0000 Subject: [PATCH] algo: Add common device image for all GPU code. --- algo/CMakeLists.txt | 5 +++++ algo/base/gpu/DeviceImage.cxx | 6 ++++++ algo/base/gpu/DeviceImage.h | 14 ++++++++++++++ algo/detectors/sts/UnpackStsXpu.cxx | 2 -- algo/detectors/sts/UnpackStsXpu.h | 4 ++-- 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 algo/base/gpu/DeviceImage.cxx create mode 100644 algo/base/gpu/DeviceImage.h diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 34b6976ae8..48571713f0 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(data) add_subdirectory(test) set(DEVICE_SRCS + base/gpu/DeviceImage.cxx detectors/sts/UnpackStsXpu.cxx ) @@ -28,6 +29,7 @@ add_library(Algo SHARED ${SRCS}) target_include_directories(Algo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/base ${CMAKE_CURRENT_SOURCE_DIR}/evbuild ${CMAKE_CURRENT_SOURCE_DIR}/trigger ${CMAKE_CURRENT_SOURCE_DIR}/evselector @@ -43,6 +45,9 @@ target_compile_definitions(Algo PUBLIC NO_ROOT) xpu_attach(Algo ${DEVICE_SRCS}) install(TARGETS Algo DESTINATION lib) +install(DIRECTORY base/gpu TYPE INCLUDE + FILES_MATCHING PATTERN "*.h" +) install(FILES ca/simd/CaSimd.h ca/simd/CaSimdVc.h diff --git a/algo/base/gpu/DeviceImage.cxx b/algo/base/gpu/DeviceImage.cxx new file mode 100644 index 0000000000..c54939a1cb --- /dev/null +++ b/algo/base/gpu/DeviceImage.cxx @@ -0,0 +1,6 @@ +/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main + SPDX-License-Identifier: GPL-3.0-only + Authors: Felix Weiglhofer [committer] */ +#include "DeviceImage.h" + +XPU_IMAGE(cbm::algo::GPUReco); diff --git a/algo/base/gpu/DeviceImage.h b/algo/base/gpu/DeviceImage.h new file mode 100644 index 0000000000..14a84da25e --- /dev/null +++ b/algo/base/gpu/DeviceImage.h @@ -0,0 +1,14 @@ +/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main + SPDX-License-Identifier: GPL-3.0-only + Authors: Felix Weiglhofer [committer] */ +#ifndef CBM_ALGO_BASE_GPU_DEVICEIMAGE_H +#define CBM_ALGO_BASE_GPU_DEVICEIMAGE_H +#include <xpu/device.h> + +namespace cbm::algo +{ + struct GPUReco { + }; +} // namespace cbm::algo + +#endif diff --git a/algo/detectors/sts/UnpackStsXpu.cxx b/algo/detectors/sts/UnpackStsXpu.cxx index b07d6e1881..7c9a555635 100644 --- a/algo/detectors/sts/UnpackStsXpu.cxx +++ b/algo/detectors/sts/UnpackStsXpu.cxx @@ -15,8 +15,6 @@ using std::unique_ptr; using std::vector; -XPU_IMAGE(cbm::algo::UnpackStsXpu::StsXpuUnpack); // Call exactly once per library - XPU_BLOCK_SIZE_1D(cbm::algo::UnpackStsXpu::Unpack, 32); namespace cbm::algo diff --git a/algo/detectors/sts/UnpackStsXpu.h b/algo/detectors/sts/UnpackStsXpu.h index 649aa14761..1e88b7f5ea 100644 --- a/algo/detectors/sts/UnpackStsXpu.h +++ b/algo/detectors/sts/UnpackStsXpu.h @@ -5,7 +5,6 @@ #ifndef CBM_ALGO_UNPACKSTSXPU_H #define CBM_ALGO_UNPACKSTSXPU_H 1 - #include "CbmStsDigi.h" #include "MicrosliceDescriptor.hpp" @@ -22,6 +21,7 @@ #include "StsReadoutConfig.h" #include "StsXyterMessage.h" +#include "gpu/DeviceImage.h" namespace cbm::algo @@ -107,7 +107,7 @@ namespace cbm::algo // Run unpacker for each microslice - XPU_EXPORT_KERNEL(StsXpuUnpack, Unpack, UnpackStsXpuPar* params, UnpackStsXpuElinkPar* elinkParams, + XPU_EXPORT_KERNEL(GPUReco, Unpack, UnpackStsXpuPar* params, UnpackStsXpuElinkPar* elinkParams, stsxyter::Message* content, uint64_t* msMessCount, uint64_t* msMessOffset, uint64_t* msStartTime, uint32_t* msCompIdx, CbmStsDigi* digisOut, const uint64_t currentTsTime, int NElems); -- GitLab