Skip to content

Commit 83c6a8a

Browse files
committed
ML: Fix compiler warnings
1 parent 72eed35 commit 83c6a8a

File tree

6 files changed

+22
-19
lines changed

6 files changed

+22
-19
lines changed

Common/ML/include/ML/3rdparty/GPUORTFloat16.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,22 +535,22 @@ GPUdi() uint16_t BFloat16Impl<Derived>::ToUint16Impl(float v) noexcept
535535
result = kPositiveQNaNBits;
536536
} else {
537537
auto get_msb_half = [](float fl) {
538-
uint16_t result;
538+
uint16_t res;
539539
#ifdef GPUCA_GPUCODE
540-
o2::gpu::CAMath::memcpy(&result, reinterpret_cast<char*>(&fl) + sizeof(uint16_t), sizeof(uint16_t));
540+
o2::gpu::CAMath::memcpy(&res, reinterpret_cast<char*>(&fl) + sizeof(uint16_t), sizeof(uint16_t));
541541
#else
542542
#ifdef __cpp_if_constexpr
543543
if constexpr (detail::endian::native == detail::endian::little)
544544
#else
545545
if (detail::endian::native == detail::endian::little)
546546
#endif
547547
{
548-
std::memcpy(&result, reinterpret_cast<char*>(&fl) + sizeof(uint16_t), sizeof(uint16_t));
548+
std::memcpy(&res, reinterpret_cast<char*>(&fl) + sizeof(uint16_t), sizeof(uint16_t));
549549
} else {
550-
std::memcpy(&result, &fl, sizeof(uint16_t));
550+
std::memcpy(&res, &fl, sizeof(uint16_t));
551551
}
552552
#endif
553-
return result;
553+
return res;
554554
};
555555

556556
uint16_t upper_bits = get_msb_half(v);

Common/ML/include/ML/OrtInterface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <memory>
2323
#include <map>
2424
#include <thread>
25+
#include <unordered_map>
2526

2627
// O2 includes
2728
#include "Framework/Logger.h"

Common/ML/src/OrtInterface.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
// ONNX includes
2020
#include <onnxruntime_cxx_api.h>
2121

22+
#include <sstream>
23+
2224
namespace o2
2325
{
2426

@@ -139,7 +141,6 @@ void OrtModel::initSession()
139141

140142
void OrtModel::memoryOnDevice(int32_t deviceIndex)
141143
{
142-
#if (defined(ORT_ROCM_BUILD) || defined(ORT_MIGRAPHX_BUILD) || defined(ORT_CUDA_BUILD) || defined(ORT_TENSORRT_BUILD))
143144
if (deviceIndex >= 0) {
144145
(pImplOrt->runOptions).AddConfigEntry("disable_synchronize_execution_providers", "1");
145146
(pImplOrt->sessionOptions).AddConfigEntry("session.use_device_allocator_for_initializers", "1"); // See kOrtSessionOptionsUseDeviceAllocatorForInitializers, https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h
@@ -161,7 +162,6 @@ void OrtModel::memoryOnDevice(int32_t deviceIndex)
161162
LOG(info) << "(ORT) Memory info set to on-device memory for device type " << deviceType << " with ID " << deviceIndex << " and pImplOrt pointer " << pImplOrt;
162163
}
163164
}
164-
#endif
165165
}
166166

167167
void OrtModel::resetSession()

GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,12 +980,12 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
980980
DoDebugAndDump(RecoStep::TPCClusterFinding, 262144 << 4, clusterer, &GPUTPCClusterFinder::DumpChargeMap, *mDebugFile, "Split Charges");
981981
}
982982

983-
float time_clusterizer = 0, time_fill = 0, time_networks = 0;
983+
// float time_clusterizer = 0, time_fill = 0, time_networks = 0;
984984
for (int batch = 0; batch < std::ceil((float)clusterer.mPmemory->counters.nClusters / clustererNNShadow.nnClusterizerBatchedMode); batch++) {
985985
uint batchStart = batch * clustererNNShadow.nnClusterizerBatchedMode;
986986
size_t iSize = CAMath::Min((uint)clustererNNShadow.nnClusterizerBatchedMode, (uint)(clusterer.mPmemory->counters.nClusters - batchStart));
987987

988-
auto start0 = std::chrono::high_resolution_clock::now();
988+
// auto start0 = std::chrono::high_resolution_clock::now();
989989
runKernel<GPUTPCNNClusterizerKernels, GPUTPCNNClusterizerKernels::fillInputNNSingleElement>({GetGrid(iSize * clustererNNShadow.nnClusterizerElementSize, lane), krnlRunRangeNone}, iSector, clustererNNShadow.nnInferenceInputDType, withMC, batchStart); // Filling the data
990990

991991
// auto stop0 = std::chrono::high_resolution_clock::now();

GPU/GPUTracking/TPCClusterFinder/GPUTPCNNClusterizerHost.cxx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using namespace o2::gpu;
2929
void GPUTPCNNClusterizerHost::init(const GPUSettingsProcessingNNclusterizer& settings)
3030
{
3131
std::string class_model_path = settings.nnClassificationPath, reg_model_path = settings.nnRegressionPath;
32-
std::vector<std::string> reg_model_paths;
32+
std::vector<std::string> reg_model_paths_local;
3333
std::vector<std::string> evalMode = o2::utils::Str::tokenize(settings.nnEvalMode, ':');
3434

3535
if (settings.nnLoadFromCCDB) {
@@ -60,20 +60,20 @@ void GPUTPCNNClusterizerHost::init(const GPUSettingsProcessingNNclusterizer& set
6060
model_class.initOptions(OrtOptions);
6161
modelsUsed[0] = true;
6262

63-
reg_model_paths = o2::utils::Str::tokenize(reg_model_path, ':');
63+
reg_model_paths_local = o2::utils::Str::tokenize(reg_model_path, ':');
6464

6565
if (!settings.nnClusterizerUseCfRegression) {
66-
if (reg_model_paths.size() == 1) {
67-
OrtOptions["model-path"] = reg_model_paths[0];
66+
if (reg_model_paths_local.size() == 1) {
67+
OrtOptions["model-path"] = reg_model_paths_local[0];
6868
OrtOptions["onnx-environment-name"] = "r1";
6969
model_reg_1.initOptions(OrtOptions);
7070
modelsUsed[1] = true;
7171
} else {
72-
OrtOptions["model-path"] = reg_model_paths[0];
72+
OrtOptions["model-path"] = reg_model_paths_local[0];
7373
OrtOptions["onnx-environment-name"] = "r1";
7474
model_reg_1.initOptions(OrtOptions);
7575
modelsUsed[1] = true;
76-
OrtOptions["model-path"] = reg_model_paths[1];
76+
OrtOptions["model-path"] = reg_model_paths_local[1];
7777
OrtOptions["onnx-environment-name"] = "r2";
7878
model_reg_2.initOptions(OrtOptions);
7979
modelsUsed[2] = true;
@@ -154,6 +154,7 @@ MockedOrtAllocator::MockedOrtAllocator(GPUReconstruction* r, OrtMemoryInfo* info
154154
MockedOrtAllocator::~MockedOrtAllocator()
155155
{
156156
// Ort::GetApi().ReleaseMemoryInfo(memory_info);
157+
(void)0; // Suppress warning for empty destructor
157158
}
158159

159160
void* MockedOrtAllocator::Alloc(size_t size)
@@ -191,8 +192,9 @@ size_t MockedOrtAllocator::NumReserveAllocations() const
191192

192193
void MockedOrtAllocator::LeakCheck()
193194
{
194-
if (memory_inuse.load())
195+
if (memory_inuse.load()) {
195196
LOG(warning) << "memory leak!!!";
197+
}
196198
}
197199

198200
void GPUTPCNNClusterizerHost::volatileOrtAllocator(Ort::Env* env, Ort::MemoryInfo* memInfo, GPUReconstruction* rec, bool recreate)

GPU/GPUTracking/TPCClusterFinder/GPUTPCNNClusterizerKernels.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ GPUdii() void GPUTPCNNClusterizerKernels::Thread<GPUTPCNNClusterizerKernels::fil
124124
CfChargePos peak = clusterer.mPfilteredPeakPositions[base_idx + batchStart];
125125
int row = static_cast<int>(peak.row()), pad = static_cast<int>(peak.pad());
126126

127-
if (clustererNN.nnClusterizerAddIndexData && transient_index == (clustererNN.nnClusterizerElementSize - 1)) {
127+
if (clustererNN.nnClusterizerAddIndexData && (int32_t)transient_index == (clustererNN.nnClusterizerElementSize - 1)) {
128128
uint top_idx = (base_idx + 1) * clustererNN.nnClusterizerElementSize;
129129
for (uint16_t i = 0; i < 8; i++) {
130130
Delta2 d = cfconsts::InnerNeighbors[i];
@@ -141,7 +141,7 @@ GPUdii() void GPUTPCNNClusterizerKernels::Thread<GPUTPCNNClusterizerKernels::fil
141141
clustererNN.inputData_32[top_idx - 2] = row / 152.f;
142142
clustererNN.inputData_32[top_idx - 1] = static_cast<float>(pad) / GPUTPCGeometry::NPads(row);
143143
}
144-
} else if (transient_index < (clustererNN.nnClusterizerElementSize - 3)) {
144+
} else if ((int32_t)transient_index < (clustererNN.nnClusterizerElementSize - 3)) {
145145
int time = static_cast<int>(peak.time());
146146
int r = CAMath::Floor(transient_index / ((2 * clustererNN.nnClusterizerSizeInputPad + 1) * (2 * clustererNN.nnClusterizerSizeInputTime + 1))) - clustererNN.nnClusterizerSizeInputRow;
147147
bool is_row_boundary = ((row + r) > (o2::tpc::constants::MAXGLOBALPADROW - 1)) || ((row + r) < 0);
@@ -197,7 +197,7 @@ GPUdii() void GPUTPCNNClusterizerKernels::Thread<GPUTPCNNClusterizerKernels::det
197197
uint elem_iterator = glo_idx * clustererNN.nnClusterizerModelClassNumOutputNodes;
198198
float current_max_prob = 0.f; // If the neural network doesn't contain the softmax as a last layer, the outputs can range in [-infty, infty]
199199
uint class_label = 0;
200-
for (int pIdx = elem_iterator; pIdx < elem_iterator + clustererNN.nnClusterizerModelClassNumOutputNodes; pIdx++) {
200+
for (uint pIdx = elem_iterator; pIdx < elem_iterator + clustererNN.nnClusterizerModelClassNumOutputNodes; pIdx++) {
201201
if (pIdx == elem_iterator) {
202202
if (dtype == 0) {
203203
current_max_prob = static_cast<float>(clustererNN.modelProbabilities_16[pIdx]);

0 commit comments

Comments
 (0)