root/root-fixes-for-32bit-builds.patch
Mattias Ellert a08fcbc5ad Update to 6.28.00
ROOT now uses llvm/clang version 13 (updated from version 9)
Clean up specfile by removing EPEL 7 conditionals
Drop dataframe, roofit and tmva-sofieparser on EPEL 8 ppc64le due to
  "pure virtual method called" errors
Split the root-geom sub-package into three separate sub-packages:
  root-geom, root-geom-builder and root-geom-painter
Enable uring support in EPEL 9 (liburing now available)
New sub-packages: root-geom-webviewer, root-roofit-jsoninterface,
  root-testsupport, root-tree-ntuple-utils, root-tree-webviewer,
  root-xroofit
Dropped patches: 31
New patches: 17
Updated patches: 4
2023-03-19 07:53:00 +01:00

185 lines
8.3 KiB
Diff

From 6f69a59010a60c949b1955e52275137e39a85b82 Mon Sep 17 00:00:00 2001
From: Jakob Blomer <jblomer@cern.ch>
Date: Thu, 9 Mar 2023 15:14:22 +0100
Subject: [PATCH] [ntuple] fixes for 32bit / non-x86_64 builds
---
tree/dataframe/src/RNTupleDS.cxx | 1 +
tree/ntuple/v7/inc/ROOT/RField.hxx | 21 +++++++++++++++++++--
tree/ntuple/v7/test/ntuple_extended.cxx | 8 ++++----
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/tree/dataframe/src/RNTupleDS.cxx b/tree/dataframe/src/RNTupleDS.cxx
index f7eb0ab5f284..aaea6df81622 100644
--- a/tree/dataframe/src/RNTupleDS.cxx
+++ b/tree/dataframe/src/RNTupleDS.cxx
@@ -94,6 +94,7 @@ class RRDFCardinalityField : public ROOT::Experimental::Detail::RFieldBase {
return ROOT::Experimental::Detail::RFieldValue(true /* captureFlag */, this, where);
}
size_t GetValueSize() const final { return sizeof(std::size_t); }
+ size_t GetAlignment() const final { return alignof(std::size_t); }
/// Get the number of elements of the collection identified by globalIndex
void
diff --git a/tree/ntuple/v7/inc/ROOT/RField.hxx b/tree/ntuple/v7/inc/ROOT/RField.hxx
index b05267d16030..9a85368a94e3 100644
--- a/tree/ntuple/v7/inc/ROOT/RField.hxx
+++ b/tree/ntuple/v7/inc/ROOT/RField.hxx
@@ -270,8 +270,9 @@ public:
virtual std::vector<RFieldValue> SplitValue(const RFieldValue &value) const;
/// The number of bytes taken by a value of the appropriate type
virtual size_t GetValueSize() const = 0;
- /// For many types, the alignment requirement is equal to the size; otherwise override.
- virtual size_t GetAlignment() const { return GetValueSize(); }
+ /// As a rule of thumb, the alignment is equal to the size of the type. There are, however, various exceptions
+ /// to this rule depending on OS and CPU architecture. So enforce the alignment to be explicitly spelled out.
+ virtual size_t GetAlignment() const = 0;
int GetTraits() const { return fTraits; }
bool HasReadCallbacks() const { return !fReadCallbacks.empty(); }
@@ -383,6 +384,7 @@ public:
Detail::RFieldValue GenerateValue(void*) override { return Detail::RFieldValue(); }
Detail::RFieldValue CaptureValue(void*) final { return Detail::RFieldValue(); }
size_t GetValueSize() const final { return 0; }
+ size_t GetAlignment() const final { return 0; }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -889,6 +891,7 @@ public:
Detail::RColumnElement<ClusterSize_t>(static_cast<ClusterSize_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(ClusterSize_t); }
+ size_t GetAlignment() const final { return alignof(ClusterSize_t); }
void CommitCluster() final;
};
@@ -990,6 +993,7 @@ public:
Detail::RColumnElement<ClusterSize_t>(static_cast<ClusterSize_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(ClusterSize_t); }
+ size_t GetAlignment() const final { return alignof(ClusterSize_t); }
/// Special help for offset fields
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) {
@@ -1110,6 +1115,7 @@ public:
Detail::RColumnElement<bool>(static_cast<bool*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(bool); }
+ size_t GetAlignment() const final { return alignof(bool); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1162,6 +1168,7 @@ public:
Detail::RColumnElement<float>(static_cast<float*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(float); }
+ size_t GetAlignment() const final { return alignof(float); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1215,6 +1222,7 @@ public:
Detail::RColumnElement<double>(static_cast<double*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(double); }
+ size_t GetAlignment() const final { return alignof(double); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1267,6 +1275,7 @@ public:
Detail::RColumnElement<char>(static_cast<char*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(char); }
+ size_t GetAlignment() const final { return alignof(char); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1319,6 +1328,7 @@ public:
Detail::RColumnElement<std::int8_t>(static_cast<std::int8_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(std::int8_t); }
+ size_t GetAlignment() const final { return alignof(std::int8_t); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1371,6 +1381,7 @@ public:
Detail::RColumnElement<std::uint8_t>(static_cast<std::uint8_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(std::uint8_t); }
+ size_t GetAlignment() const final { return alignof(std::uint8_t); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1423,6 +1434,7 @@ public:
Detail::RColumnElement<std::int16_t>(static_cast<std::int16_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(std::int16_t); }
+ size_t GetAlignment() const final { return alignof(std::int16_t); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1475,6 +1487,7 @@ public:
Detail::RColumnElement<std::uint16_t>(static_cast<std::uint16_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(std::uint16_t); }
+ size_t GetAlignment() const final { return alignof(std::uint16_t); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1527,6 +1540,7 @@ public:
Detail::RColumnElement<std::int32_t>(static_cast<std::int32_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(std::int32_t); }
+ size_t GetAlignment() const final { return alignof(std::int32_t); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1579,6 +1593,7 @@ public:
Detail::RColumnElement<std::uint32_t>(static_cast<std::uint32_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(std::uint32_t); }
+ size_t GetAlignment() const final { return alignof(std::uint32_t); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1631,6 +1646,7 @@ public:
Detail::RColumnElement<std::uint64_t>(static_cast<std::uint64_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(std::uint64_t); }
+ size_t GetAlignment() const final { return alignof(std::uint64_t); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
@@ -1683,6 +1699,7 @@ public:
Detail::RColumnElement<std::int64_t>(static_cast<std::int64_t*>(where)), this, where);
}
size_t GetValueSize() const final { return sizeof(std::int64_t); }
+ size_t GetAlignment() const final { return alignof(std::int64_t); }
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
};
diff --git a/tree/ntuple/v7/test/ntuple_extended.cxx b/tree/ntuple/v7/test/ntuple_extended.cxx
index 91871e288e98..d3b6ee466359 100644
--- a/tree/ntuple/v7/test/ntuple_extended.cxx
+++ b/tree/ntuple/v7/test/ntuple_extended.cxx
@@ -123,8 +123,8 @@ TEST(RNTuple, LargeFile1)
RNTupleWriteOptions options;
options.SetCompression(0);
auto ntuple = RNTupleWriter::Recreate(std::move(modelWrite), "myNTuple", fileGuard.GetPath(), options);
- constexpr unsigned long nEvents = 1024 * 1024 * 256; // Exceed 2GB file size
- for (unsigned int i = 0; i < nEvents; ++i) {
+ constexpr std::uint64_t nEvents = 1024 * 1024 * 256; // Exceed 2GB file size
+ for (std::uint64_t i = 0; i < nEvents; ++i) {
wrEnergy = rnd.Rndm();
chksumWrite += wrEnergy;
ntuple->Fill();
@@ -195,8 +195,8 @@ TEST(RNTuple, LargeFile2)
TRandom3 rnd(42);
double chksumWrite = 0.0;
- constexpr unsigned long nEvents = 1024 * 1024 * 256; // Exceed 2GB file size
- for (unsigned int i = 0; i < nEvents; ++i) {
+ constexpr std::uint64_t nEvents = 1024 * 1024 * 256; // Exceed 2GB file size
+ for (std::uint64_t i = 0; i < nEvents; ++i) {
*E = rnd.Rndm();
chksumWrite += *E;
writer->Fill();