From 0ecf843aef4436e6e5aad85500545dbbf96a274a Mon Sep 17 00:00:00 2001 From: David Rohr Date: Tue, 20 Aug 2024 10:22:09 +0200 Subject: [PATCH] GPU TPC: Compile-time disable V/M-Shape correction during RTC --- GPU/Common/GPUCommonDef.h | 3 +++ GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAGenRTC.cxx | 2 +- GPU/GPUTracking/Base/cuda/GPUReconstructionCUDArtc.cu | 1 + GPU/GPUTracking/Definitions/GPUSettingsList.h | 1 + GPU/GPUTracking/Standalone/Benchmark/standalone.cxx | 4 ++++ GPU/TPCFastTransformation/TPCFastTransform.h | 3 +++ GPU/Workflow/src/GPUWorkflowSpec.cxx | 3 +++ 7 files changed, 16 insertions(+), 1 deletion(-) diff --git a/GPU/Common/GPUCommonDef.h b/GPU/Common/GPUCommonDef.h index dac0a9695cdea..6a699835affa5 100644 --- a/GPU/Common/GPUCommonDef.h +++ b/GPU/Common/GPUCommonDef.h @@ -97,6 +97,9 @@ #define GPUCA_DEBUG_STREAMER_CHECK(...) #endif +#ifndef GPUCA_RTC_SPECIAL_CODE +#define GPUCA_RTC_SPECIAL_CODE(...) +#endif // API Definitions for GPU Compilation #include "GPUCommonDefAPI.h" diff --git a/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAGenRTC.cxx b/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAGenRTC.cxx index 3b42748febe2a..ecc81d71bdbb0 100644 --- a/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAGenRTC.cxx +++ b/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAGenRTC.cxx @@ -39,7 +39,7 @@ QGET_LD_BINARY_SYMBOLS(GPUReconstructionCUDArtc_command_arch); int GPUReconstructionCUDA::genRTC(std::string& filename, unsigned int& nCompile) { #ifndef GPUCA_ALIROOT_LIB - std::string rtcparam = GPUParamRTC::generateRTCCode(param(), mProcessingSettings.rtc.optConstexpr); + std::string rtcparam = std::string(mProcessingSettings.rtc.optSpecialCode ? "#define GPUCA_RTC_SPECIAL_CODE(...) __VA_ARGS__\n" : "#define GPUCA_RTC_SPECIAL_CODE(...)\n") + GPUParamRTC::generateRTCCode(param(), mProcessingSettings.rtc.optConstexpr); if (filename == "") { filename = "/tmp/o2cagpu_rtc_"; } diff --git a/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDArtc.cu b/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDArtc.cu index 95b34aee3682f..31f9c54c5e7f8 100644 --- a/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDArtc.cu +++ b/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDArtc.cu @@ -14,6 +14,7 @@ #define GPUCA_GPUCODE_GENRTC #define GPUCA_GPUCODE_COMPILEKERNELS +#define GPUCA_RTC_SPECIAL_CODE(...) GPUCA_RTC_SPECIAL_CODE(__VA_ARGS__) #include "GPUReconstructionCUDADef.h" #include "GPUReconstructionIncludesDeviceAll.h" diff --git a/GPU/GPUTracking/Definitions/GPUSettingsList.h b/GPU/GPUTracking/Definitions/GPUSettingsList.h index 6bd28272fb0be..508a0123f1c69 100644 --- a/GPU/GPUTracking/Definitions/GPUSettingsList.h +++ b/GPU/GPUTracking/Definitions/GPUSettingsList.h @@ -198,6 +198,7 @@ EndConfig() BeginSubConfig(GPUSettingsProcessingRTC, rtc, configStandalone.proc, "RTC", 0, "Processing settings", proc_rtc) AddOption(cacheOutput, bool, false, "", 0, "Cache RTC compilation results") AddOption(optConstexpr, bool, true, "", 0, "Replace constant variables by static constexpr expressions") +AddOption(optSpecialCode, signed char, -1, "", 0, "Insert GPUCA_RTC_SPECIAL_CODE special code during RTC") AddOption(compilePerKernel, bool, true, "", 0, "Run one RTC compilation per kernel") AddOption(enable, bool, false, "", 0, "Use RTC to optimize GPU code") AddOption(runTest, int, 0, "", 0, "Do not run the actual benchmark, but just test RTC compilation (1 full test, 2 test only compilation)") diff --git a/GPU/GPUTracking/Standalone/Benchmark/standalone.cxx b/GPU/GPUTracking/Standalone/Benchmark/standalone.cxx index be886c3aa4438..7c71962409d0a 100644 --- a/GPU/GPUTracking/Standalone/Benchmark/standalone.cxx +++ b/GPU/GPUTracking/Standalone/Benchmark/standalone.cxx @@ -434,6 +434,9 @@ int SetupReconstruction() procSet.eventDisplay = nullptr; } } + if (configStandalone.proc.rtc.optSpecialCode == -1) { + configStandalone.proc.rtc.optSpecialCode = configStandalone.testSyncAsync || configStandalone.testSync; + } rec->SetSettings(&grp, &recSet, &procSet, &steps); if (configStandalone.proc.doublePipeline) { @@ -453,6 +456,7 @@ int SetupReconstruction() procSet.runQA = false; procSet.eventDisplay = eventDisplay.get(); procSet.runCompressionStatistics = 0; + procSet.rtc.optSpecialCode = 0; if (recSet.tpc.rejectionStrategy >= GPUSettings::RejectionStrategyB) { procSet.tpcInputWithClusterRejection = 1; } diff --git a/GPU/TPCFastTransformation/TPCFastTransform.h b/GPU/TPCFastTransformation/TPCFastTransform.h index fe52bffe14acc..be3e4db7800c3 100644 --- a/GPU/TPCFastTransformation/TPCFastTransform.h +++ b/GPU/TPCFastTransformation/TPCFastTransform.h @@ -446,6 +446,7 @@ GPUdi() void TPCFastTransform::getTOFcorrection(int slice, int /*row*/, float x, GPUdi() void TPCFastTransform::TransformInternal(int slice, int row, float& u, float& v, float& x, const TPCFastTransform* ref, const TPCFastTransform* ref2, float scale, float scale2, int scaleMode) const { + GPUCA_RTC_SPECIAL_CODE(ref2 = nullptr; scale2 = 0.f;); if (mApplyCorrection) { float dx = 0.f, du = 0.f, dv = 0.f; if ((scale >= 0.f) || (scaleMode == 1) || (scaleMode == 2)) { @@ -776,6 +777,7 @@ GPUdi() float TPCFastTransform::getMaxDriftTime(int slice) const GPUdi() void TPCFastTransform::InverseTransformYZtoX(int slice, int row, float y, float z, float& x, const TPCFastTransform* ref, const TPCFastTransform* ref2, float scale, float scale2, int scaleMode) const { + GPUCA_RTC_SPECIAL_CODE(ref2 = nullptr; scale2 = 0.f;); /// Transformation y,z -> x float u = 0, v = 0; getGeometry().convLocalToUV(slice, y, z, u, v); @@ -816,6 +818,7 @@ GPUdi() void TPCFastTransform::InverseTransformYZtoX(int slice, int row, float y GPUdi() void TPCFastTransform::InverseTransformYZtoNominalYZ(int slice, int row, float y, float z, float& ny, float& nz, const TPCFastTransform* ref, const TPCFastTransform* ref2, float scale, float scale2, int scaleMode) const { + GPUCA_RTC_SPECIAL_CODE(ref2 = nullptr; scale2 = 0.f;); /// Transformation y,z -> x float u = 0, v = 0, un = 0, vn = 0; getGeometry().convLocalToUV(slice, y, z, u, v); diff --git a/GPU/Workflow/src/GPUWorkflowSpec.cxx b/GPU/Workflow/src/GPUWorkflowSpec.cxx index d9e558972e95d..b77b12b079547 100644 --- a/GPU/Workflow/src/GPUWorkflowSpec.cxx +++ b/GPU/Workflow/src/GPUWorkflowSpec.cxx @@ -187,6 +187,9 @@ void GPURecoWorkflowSpec::init(InitContext& ic) if (mConfParam->synchronousProcessing) { mConfig->configReconstruction.useMatLUT = false; } + if (mConfig->configProcessing.rtc.optSpecialCode == -1) { + mConfig->configProcessing.rtc.optSpecialCode = mConfParam->synchronousProcessing; + } // Configure the "GPU workflow" i.e. which steps we run on the GPU (or CPU) if (mSpecConfig.outputTracks || mSpecConfig.outputCompClusters || mSpecConfig.outputCompClustersFlat) {