Skip to content

Commit 843479b

Browse files
committed
GPU: Rename OpenCL2 to OpenCL, now that we have only 1 OpenCL implementation
1 parent e5c6672 commit 843479b

File tree

13 files changed

+62
-91
lines changed

13 files changed

+62
-91
lines changed

GPU/GPUTracking/Base/GPUReconstruction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class GPUReconstruction
390390
void* mGPULib;
391391
void* mGPUEntry;
392392
};
393-
static std::shared_ptr<LibraryLoader> sLibCUDA, sLibHIP, sLibOCL2;
393+
static std::shared_ptr<LibraryLoader> sLibCUDA, sLibHIP, sLibOCL;
394394

395395
static GPUReconstruction* GPUReconstruction_Create_CPU(const GPUSettingsDeviceBackend& cfg);
396396
};

GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
#cmakedefine CUDA_ENABLED
1616
#cmakedefine HIP_ENABLED
17-
#cmakedefine OPENCL2_ENABLED
17+
#cmakedefine OPENCL_ENABLED

GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ std::shared_ptr<GPUReconstruction::LibraryLoader>* GPUReconstruction::GetLibrary
102102
#ifdef HIP_ENABLED
103103
return &sLibHIP;
104104
#endif
105-
} else if (type == DeviceType::OCL2) {
106-
#ifdef OPENCL2_ENABLED
107-
return &sLibOCL2;
105+
} else if (type == DeviceType::OCL) {
106+
#ifdef OPENCL_ENABLED
107+
return &sLibOCL;
108108
#endif
109109
} else {
110110
GPUError("Error: Invalid device type %u", (uint32_t)type);
@@ -128,7 +128,7 @@ GPUReconstruction* GPUReconstruction::CreateInstance(const char* type, bool forc
128128

129129
std::shared_ptr<GPUReconstruction::LibraryLoader> GPUReconstruction::sLibCUDA(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingCUDA" LIBRARY_EXTENSION, "GPUReconstruction_Create_CUDA"));
130130
std::shared_ptr<GPUReconstruction::LibraryLoader> GPUReconstruction::sLibHIP(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingHIP" LIBRARY_EXTENSION, "GPUReconstruction_Create_HIP"));
131-
std::shared_ptr<GPUReconstruction::LibraryLoader> GPUReconstruction::sLibOCL2(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingOCL2" LIBRARY_EXTENSION, "GPUReconstruction_Create_OCL2"));
131+
std::shared_ptr<GPUReconstruction::LibraryLoader> GPUReconstruction::sLibOCL(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingOCL" LIBRARY_EXTENSION, "GPUReconstruction_Create_OCL"));
132132

133133
GPUReconstruction::LibraryLoader::LibraryLoader(const char* lib, const char* func) : mLibName(lib), mFuncName(func), mGPULib(nullptr), mGPUEntry(nullptr) {}
134134

GPU/GPUTracking/Base/opencl2/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12-
set(MODULE GPUTrackingOCL2)
12+
set(MODULE GPUTrackingOCL)
1313
enable_language(ASM)
1414

1515
message(STATUS "Building GPUTracking with OpenCL 2 support")
@@ -21,7 +21,7 @@ else()
2121
set(GPUDIR ${CMAKE_SOURCE_DIR}/GPU/GPUTracking)
2222
endif()
2323
set(CL_SRC ${GPUDIR}/Base/opencl-common/GPUReconstructionOCL.cl)
24-
set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCL2Code)
24+
set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode)
2525

2626
set(OCL_FLAGS -Dcl_clang_storage_class_specifiers -cl-std=CLC++2021)
2727
if(NOT DEFINED GPUCA_NO_FAST_MATH OR NOT ${GPUCA_NO_FAST_MATH})
@@ -39,7 +39,7 @@ set(OCL_DEFINECL "-D$<JOIN:$<TARGET_PROPERTY:O2::GPUTracking,COMPILE_DEFINITIONS
3939
set(SRCS GPUReconstructionOCL2.cxx)
4040
set(HDRS GPUReconstructionOCL2.h GPUReconstructionOCL2Internals.h)
4141

42-
if(OPENCL2_ENABLED_SPIRV) # BUILD OpenCL2 intermediate code for SPIR-V target
42+
if(OPENCL_ENABLED_SPIRV) # BUILD OpenCL intermediate code for SPIR-V target
4343
# executes clang to create llvm IL code
4444
# Add -fintegrated-objemitter once we switch to clang >= 17
4545
cmake_path(GET LLVM_SPIRV PARENT_PATH TMP_LLVM_SPIRV_PATH)
@@ -56,13 +56,13 @@ if(OPENCL2_ENABLED_SPIRV) # BUILD OpenCL2 intermediate code for SPIR-V target
5656
MAIN_DEPENDENCY ${CL_SRC}
5757
IMPLICIT_DEPENDS CXX ${CL_SRC}
5858
COMMAND_EXPAND_LISTS
59-
COMMENT "Compiling OpenCL2 CL source file ${CL_SRC} to SPIRV ${CL_BIN}.spirv")
59+
COMMENT "Compiling OpenCL CL source file ${CL_SRC} to SPIRV ${CL_BIN}.spirv")
6060

6161
create_binary_resource(${CL_BIN}.spirv ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.spirv.o)
6262
set(SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.spirv.o)
6363
endif()
6464

65-
if(OPENCL2_ENABLED) # BUILD OpenCL2 source code for runtime compilation target
65+
if(OPENCL_ENABLED) # BUILD OpenCL source code for runtime compilation target
6666
# executes clang to preprocess
6767
add_custom_command(
6868
OUTPUT ${CL_BIN}.src
@@ -76,7 +76,7 @@ if(OPENCL2_ENABLED) # BUILD OpenCL2 source code for runtime compilation target
7676
MAIN_DEPENDENCY ${CL_SRC}
7777
IMPLICIT_DEPENDS CXX ${CL_SRC}
7878
COMMAND_EXPAND_LISTS
79-
COMMENT "Preparing OpenCL2 CL source file for run time compilation ${CL_BIN}.src")
79+
COMMENT "Preparing OpenCL CL source file for run time compilation ${CL_BIN}.src")
8080

8181
create_binary_resource(${CL_BIN}.src ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.src.o)
8282
set(SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.src.o)
@@ -122,7 +122,7 @@ if(ALIGPU_BUILD_TYPE STREQUAL "Standalone")
122122
set(targetName ${MODULE})
123123
endif()
124124

125-
if(OPENCL2_ENABLED_SPIRV)
126-
target_compile_definitions(${targetName} PRIVATE OPENCL2_ENABLED_SPIRV)
125+
if(OPENCL_ENABLED_SPIRV)
126+
target_compile_definitions(${targetName} PRIVATE OPENCL_ENABLED_SPIRV)
127127
endif()
128128
target_compile_definitions(${targetName} PRIVATE OCL_FLAGS=$<JOIN:${OCL_FLAGS},\ >)

GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
/// \file GPUReconstructionOCL2.cxx
12+
/// \file GPUReconstructionOCL.cxx
1313
/// \author David Rohr
1414

1515
#define GPUCA_GPUTYPE_OPENCL
1616
#define __OPENCL_HOST__
1717

1818
#include "GPUReconstructionOCL2.h"
19-
#include "GPUReconstructionOCL2Internals.h"
19+
#include "GPUReconstructionOCLInternals.h"
2020
#include "GPUReconstructionIncludes.h"
2121

2222
using namespace GPUCA_NAMESPACE::gpu;
@@ -27,32 +27,32 @@ using namespace GPUCA_NAMESPACE::gpu;
2727
#include <cstdlib>
2828

2929
#include "utils/qGetLdBinarySymbols.h"
30-
QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCL2Code_src);
31-
#ifdef OPENCL2_ENABLED_SPIRV
32-
QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCL2Code_spirv);
30+
QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCLCode_src);
31+
#ifdef OPENCL_ENABLED_SPIRV
32+
QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCLCode_spirv);
3333
#endif
3434

35-
GPUReconstruction* GPUReconstruction_Create_OCL2(const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionOCL2(cfg); }
35+
GPUReconstruction* GPUReconstruction_Create_OCL(const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionOCL2(cfg); }
3636

37-
GPUReconstructionOCL2Backend::GPUReconstructionOCL2Backend(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionOCL(cfg)
37+
GPUReconstructionOCLBackend::GPUReconstructionOCLBackend(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionOCL(cfg)
3838
{
3939
}
4040

4141
template <class T, int32_t I, typename... Args>
42-
int32_t GPUReconstructionOCL2Backend::runKernelBackend(const krnlSetupArgs<T, I, Args...>& args)
42+
int32_t GPUReconstructionOCLBackend::runKernelBackend(const krnlSetupArgs<T, I, Args...>& args)
4343
{
4444
cl_kernel k = args.s.y.num > 1 ? getKernelObject<cl_kernel, T, I, true>() : getKernelObject<cl_kernel, T, I, false>();
4545
return std::apply([this, &args, &k](auto&... vals) { return runKernelBackendInternal(args.s, k, vals...); }, args.v);
4646
}
4747

4848
template <class S, class T, int32_t I, bool MULTI>
49-
S& GPUReconstructionOCL2Backend::getKernelObject()
49+
S& GPUReconstructionOCLBackend::getKernelObject()
5050
{
5151
static uint32_t krnl = FindKernel<T, I>(MULTI ? 2 : 1);
5252
return mInternals->kernels[krnl].first;
5353
}
5454

55-
int32_t GPUReconstructionOCL2Backend::GetOCLPrograms()
55+
int32_t GPUReconstructionOCLBackend::GetOCLPrograms()
5656
{
5757
char platform_version[256] = {};
5858
GPUFailedMsg(clGetPlatformInfo(mInternals->platform, CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr));
@@ -63,17 +63,17 @@ int32_t GPUReconstructionOCL2Backend::GetOCLPrograms()
6363

6464
const char* ocl_flags = GPUCA_M_STR(OCL_FLAGS);
6565

66-
#ifdef OPENCL2_ENABLED_SPIRV // clang-format off
66+
#ifdef OPENCL_ENABLED_SPIRV // clang-format off
6767
if (ver >= 2.2f && !GetProcessingSettings().oclCompileFromSources) {
6868
GPUInfo("Reading OpenCL program from SPIR-V IL (Platform version %4.2f)", ver);
69-
mInternals->program = clCreateProgramWithIL(mInternals->context, _binary_GPUReconstructionOCL2Code_spirv_start, _binary_GPUReconstructionOCL2Code_spirv_len, &ocl_error);
69+
mInternals->program = clCreateProgramWithIL(mInternals->context, _binary_GPUReconstructionOCLCode_spirv_start, _binary_GPUReconstructionOCLCode_spirv_len, &ocl_error);
7070
ocl_flags = "";
7171
} else
7272
#endif // clang-format on
7373
{
7474
GPUInfo("Compiling OpenCL program from sources (Platform version %4.2f)", ver);
75-
size_t program_sizes[1] = {_binary_GPUReconstructionOCL2Code_src_len};
76-
char* programs_sources[1] = {_binary_GPUReconstructionOCL2Code_src_start};
75+
size_t program_sizes[1] = {_binary_GPUReconstructionOCLCode_src_len};
76+
char* programs_sources[1] = {_binary_GPUReconstructionOCLCode_src_start};
7777
mInternals->program = clCreateProgramWithSource(mInternals->context, (cl_uint)1, (const char**)&programs_sources, program_sizes, &ocl_error);
7878
}
7979

@@ -113,7 +113,7 @@ int32_t GPUReconstructionOCL2Backend::GetOCLPrograms()
113113
return 0;
114114
}
115115

116-
bool GPUReconstructionOCL2Backend::CheckPlatform(uint32_t i)
116+
bool GPUReconstructionOCLBackend::CheckPlatform(uint32_t i)
117117
{
118118
char platform_version[64] = {}, platform_vendor[64] = {};
119119
clGetPlatformInfo(mInternals->platforms[i], CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr);

GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
/// \file GPUReconstructionOCL2.h
12+
/// \file GPUReconstructionOCL.h
1313
/// \author David Rohr
1414

1515
#ifndef GPURECONSTRUCTIONOCL2_H
@@ -18,22 +18,22 @@
1818
#include "GPUReconstructionOCL.h"
1919

2020
#ifdef _WIN32
21-
extern "C" __declspec(dllexport) GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL2(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg);
21+
extern "C" __declspec(dllexport) GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg);
2222
#else
23-
extern "C" GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL2(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg);
23+
extern "C" GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg);
2424
#endif
2525

2626
namespace GPUCA_NAMESPACE::gpu
2727
{
28-
struct GPUReconstructionOCL2Internals;
28+
struct GPUReconstructionOCLInternals;
2929

30-
class GPUReconstructionOCL2Backend : public GPUReconstructionOCL
30+
class GPUReconstructionOCLBackend : public GPUReconstructionOCL
3131
{
3232
public:
33-
~GPUReconstructionOCL2Backend() override = default;
33+
~GPUReconstructionOCLBackend() override = default;
3434

3535
protected:
36-
GPUReconstructionOCL2Backend(const GPUSettingsDeviceBackend& cfg);
36+
GPUReconstructionOCLBackend(const GPUSettingsDeviceBackend& cfg);
3737

3838
template <class T, int32_t I = 0, typename... Args>
3939
int32_t runKernelBackend(const krnlSetupArgs<T, I, Args...>& args);
@@ -44,7 +44,7 @@ class GPUReconstructionOCL2Backend : public GPUReconstructionOCL
4444
bool CheckPlatform(uint32_t i) override;
4545
};
4646

47-
using GPUReconstructionOCL2 = GPUReconstructionKernels<GPUReconstructionOCL2Backend>;
47+
using GPUReconstructionOCL2 = GPUReconstructionKernels<GPUReconstructionOCLBackend>;
4848
} // namespace GPUCA_NAMESPACE::gpu
4949

5050
#endif

GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2Internals.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

GPU/GPUTracking/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ endif()
2222
include(cmake/helpers.cmake)
2323

2424
if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT")
25-
if(ENABLE_CUDA OR ENABLE_OPENCL2 OR ENABLE_HIP)
25+
if(ENABLE_CUDA OR ENABLE_OPENCL OR ENABLE_HIP)
2626
include(FeatureSummary)
2727
find_package(O2GPU)
2828
else()
@@ -521,14 +521,14 @@ endif()
521521
target_compile_options(${targetName} PRIVATE -Wno-instantiation-after-specialization)
522522

523523
# Add CMake recipes for GPU Tracking librararies
524-
if(CUDA_ENABLED OR OPENCL2_ENABLED OR HIP_ENABLED)
524+
if(CUDA_ENABLED OR OPENCL_ENABLED OR HIP_ENABLED)
525525
if(CMAKE_SYSTEM_NAME MATCHES Darwin)
526526
message(WARNING "GPU Tracking disabled on MacOS")
527527
else()
528528
if(CUDA_ENABLED)
529529
add_subdirectory(Base/cuda)
530530
endif()
531-
if(OPENCL2_ENABLED)
531+
if(OPENCL_ENABLED)
532532
add_subdirectory(Base/opencl-common)
533533
add_subdirectory(Base/opencl2)
534534
endif()

GPU/GPUTracking/DataTypes/GPUDataTypes.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ class GPUDataTypes
147147
CPU = 1,
148148
CUDA = 2,
149149
HIP = 3,
150-
OCL = 4,
151-
OCL2 = 5 };
150+
OCL = 4 };
152151
enum ENUM_CLASS GeneralStep { Prepare = 1,
153152
QA = 2 };
154153

@@ -175,7 +174,7 @@ class GPUDataTypes
175174
ITSTracks = 256 };
176175

177176
#ifdef GPUCA_NOCOMPAT_ALLOPENCL
178-
static constexpr const char* const DEVICE_TYPE_NAMES[] = {"INVALID", "CPU", "CUDA", "HIP", "OCL", "OCL2"};
177+
static constexpr const char* const DEVICE_TYPE_NAMES[] = {"INVALID", "CPU", "CUDA", "HIP", "OCL"};
179178
static constexpr const char* const RECO_STEP_NAMES[] = {"TPC Transformation", "TPC Sector Tracking", "TPC Track Merging and Fit", "TPC Compression", "TRD Tracking", "ITS Tracking", "TPC dEdx Computation", "TPC Cluster Finding", "TPC Decompression", "Global Refit"};
180179
static constexpr const char* const GENERAL_STEP_NAMES[] = {"Prepare", "QA"};
181180
typedef bitfield<RecoStep, uint32_t> RecoStepField;

GPU/GPUTracking/Definitions/GPUSettingsList.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ EndConfig()
473473
BeginConfig(GPUSettingsStandalone, configStandalone)
474474
AddOption(runGPU, uint8_t, 1, "", 'g', "Use GPU for processing", message("GPU processing enabled"), set(2))
475475
AddOptionSet(runGPU, uint8_t, 0, "", 'c', "Use CPU for processing", message("CPU enabled"))
476-
AddOption(gpuType, std::string, "AUTO", "", 0, "GPU type (CUDA / HIP / OCL / OCL2) or CPU or AUTO")
476+
AddOption(gpuType, std::string, "AUTO", "", 0, "GPU type (CUDA / HIP / OCL / OCL) or CPU or AUTO")
477477
AddOption(runGPUforce, bool, true, "", 0, "Force usage of the specified GPU device type, no CPU fallback")
478478
AddOption(noprompt, bool, true, "", 0, "Do prompt for keypress before exiting")
479479
AddOption(continueOnError, bool, false, "", 0, "Continue processing after an error")
@@ -537,7 +537,7 @@ AddOption(constBz, bool, false, "", 0, "force constant Bz for tests")
537537
AddOption(setMaxTimeBin, int32_t, -2, "", 0, "maximum time bin of continuous data, 0 for triggered events, -1 for automatic continuous mode, -2 for automatic continuous / triggered")
538538
AddOption(overrideNHbfPerTF, int32_t, 0, "", 0, "Overrides the number of HBF per TF if != 0")
539539
AddOption(overrideTPCTimeBinCur, int32_t, 0, "", 0, "Overrides TPC time bin cut if > 0")
540-
AddOption(deviceType, std::string, "CPU", "", 0, "Device type, CPU | CUDA | HIP | OCL2")
540+
AddOption(deviceType, std::string, "CPU", "", 0, "Device type, CPU | CUDA | HIP | OCL")
541541
AddOption(forceDeviceType, bool, true, "", 0, "force device type, otherwise allows fall-back to CPU")
542542
AddOption(synchronousProcessing, bool, false, "", 0, "Apply performance shortcuts for synchronous processing, disable unneeded steps")
543543
AddOption(dump, int32_t, 0, "", 0, "Dump events for standalone benchmark: 1 = dump events, 2 = dump events and skip processing in workflow")

0 commit comments

Comments
 (0)