Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/root-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') && !matrix.platform == 'mac15' && !matrix.platform == 'mac26'}}
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
run: |

Check failure on line 159 in .github/workflows/root-ci.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

"github.event.pull_request.head.ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks for more details
[ -d "${VIRTUAL_ENV_DIR}" ] && source ${VIRTUAL_ENV_DIR}/bin/activate
echo "Python is now $(which python3) $(python3 --version)"
src/.github/workflows/root-ci-config/build_root.py \
Expand Down Expand Up @@ -286,7 +286,7 @@
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
shell: cmd
run: "C:\\setenv.bat ${{ matrix.target_arch }} &&

Check failure on line 289 in .github/workflows/root-ci.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

"github.event.pull_request.head.ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks for more details
python .github/workflows/root-ci-config/build_root.py
--buildtype ${{ matrix.config }}
--platform windows10
Expand Down Expand Up @@ -402,7 +402,7 @@
- image: alma9
is_special: true
property: march_native
overrides: ["CMAKE_BUILD_TYPE=RelWithDebInfo", "CMAKE_CXX_FLAGS=-march=native", "CMAKE_C_FLAGS=-march=native", "builtin_zlib=ON", "builtin_zstd=ON", "CMAKE_CXX_STANDARD=20"]
overrides: ["CMAKE_BUILD_TYPE=RelWithDebInfo", "CMAKE_CXX_FLAGS=-march=native", "CMAKE_C_FLAGS=-march=native", "builtin_zlib=ON", "builtin_zstd=ON", "CMAKE_CXX_STANDARD=20", "builtin_vc=ON", "builtin_veccore=ON", "vc=ON", "veccore=ON"]
- image: alma10
is_special: true
property: arm64
Expand Down Expand Up @@ -434,7 +434,7 @@
- self-hosted
- linux
- ${{ matrix.architecture == null && 'x64' || matrix.architecture }}
- ${{ matrix.extra-runs-on == null && 'cpu' || matrix.extra-runs-on }}

Check failure on line 437 in .github/workflows/root-ci.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "extra-runs-on" is not defined in object type {architecture: string; cmake_generator: string; image: string; is_special: bool; minimal: bool; overrides: array<string>; property: string}

Check failure on line 437 in .github/workflows/root-ci.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "extra-runs-on" is not defined in object type {architecture: string; cmake_generator: string; image: string; is_special: bool; minimal: bool; overrides: array<string>; property: string}

name: |
${{ matrix.image }} ${{ matrix.property }}
Expand Down
20 changes: 18 additions & 2 deletions hist/hist/src/TFormula.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ std::string doubleToString(double val)
return ss.str();
}

// In the interpreter, we must match the SIMD width used by compiled ROOT.
// ROOT::Double_v aliases the best available native SIMD type, which may differ
// between compiled and interpreted contexts (e.g. with -march=native).
// Therefore, we explicitly select the fixed-size SIMD type corresponding to
// the native SIMD width used in compiled ROOT.
std::string vectorizedArgType()
{
#ifdef VECCORE_ENABLE_VC
auto n = ROOT::Double_v::size();
return "Vc::fixed_size_simd<double, " + std::to_string(n) + ">";
#else
// For other possible VecCore backends, we assume using the same type is fine.
return "ROOT::Double_v";
#endif
}

} // namespace

/** \class TFormula TFormula.h "inc/TFormula.h"
Expand Down Expand Up @@ -815,7 +831,7 @@ prepareMethod(bool HasParameters, bool HasVariables, const char* FuncName,
TString prototypeArguments = "";
if (HasVariables || HasParameters) {
if (IsVectorized)
prototypeArguments.Append("ROOT::Double_v const*");
prototypeArguments.Append(vectorizedArgType() + " const*");
else
prototypeArguments.Append("Double_t const*");
}
Expand Down Expand Up @@ -2387,7 +2403,7 @@ void TFormula::ProcessFormula(TString &formula)
if (fVectorized)
inputFormulaVecFlag += " (vectorized)";

TString argType = fVectorized ? "ROOT::Double_v" : "Double_t";
TString argType = fVectorized ? vectorizedArgType() : "Double_t";

// valid input formula - try to put into Cling (in case of no variables but only parameter we need to add the standard signature)
TString argumentsPrototype = TString::Format("%s%s%s", ( (hasVariables || hasParameters) ? (argType + " const *x").Data() : ""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class DisplacementVector3D {
DisplacementVector3D Unit() const
{
SCALAR tot = R();
tot(tot == SCALAR(0)) = SCALAR(1);
where(tot == SCALAR(0), tot) = SCALAR(1);
return DisplacementVector3D(*this) / tot;
}

Expand Down Expand Up @@ -681,7 +681,7 @@ operator<<(std::basic_ostream<char_t, traits_t> &os, DisplacementVector3D<T, U>
{
if (os) {
os << "{ ";
for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::Size; ++i) {
for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::size(); ++i) {
os << "(" << v.x()[i] << "," << v.y()[i] << "," << v.z()[i] << ") ";
}
os << "}";
Expand Down
4 changes: 2 additions & 2 deletions math/experimental/genvectorx/inc/MathX/GenVectorX/Plane3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ class Plane3D {
// what to do if s = 0 ?
const auto m = (s == SCALAR(0));
// set zero entries to 1 in the vector to avoid /0 later on
s(m) = SCALAR(1);
fD(m) = SCALAR(0);
where(m, s) = SCALAR(1);
where(m, fD) = SCALAR(0);
const SCALAR w = SCALAR(1) / s;
fA *= w;
fB *= w;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ operator<<(std::basic_ostream<char_t, traits_t> &os, PositionVector3D<T, U> cons
{
if (os) {
os << "{ ";
for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::Size; ++i) {
for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::size(); ++i) {
os << "(" << v.x()[i] << "," << v.y()[i] << "," << v.z()[i] << ") ";
}
os << "}";
Expand Down
20 changes: 10 additions & 10 deletions math/experimental/genvectorx/inc/MathX/GenVectorX/Transform3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ class Transform3D {
const auto detZmask = (det == T(0));
if (any_of(detZmask)) {
std::cerr << "Transform3D::inverse error: zero determinant" << std::endl;
det(detZmask) = T(1);
where(detZmask, det) = T(1);
}
det = T(1) / det;
detxx *= det;
Expand All @@ -873,15 +873,15 @@ class Transform3D {
T detzz = (fM[kXX] * fM[kYY] - fM[kXY] * fM[kYX]) * det;
// Set det=0 cases to 0
if (any_of(detZmask)) {
detxx(detZmask) = T(0);
detxy(detZmask) = T(0);
detxz(detZmask) = T(0);
detyx(detZmask) = T(0);
detyy(detZmask) = T(0);
detyz(detZmask) = T(0);
detzx(detZmask) = T(0);
detzy(detZmask) = T(0);
detzz(detZmask) = T(0);
where(detZmask, detxx) = T(0);
where(detZmask, detxy) = T(0);
where(detZmask, detxz) = T(0);
where(detZmask, detyx) = T(0);
where(detZmask, detyy) = T(0);
where(detZmask, detyz) = T(0);
where(detZmask, detzx) = T(0);
where(detZmask, detzy) = T(0);
where(detZmask, detzz) = T(0);
}
// set final components
SetComponents(detxx, -detyx, detzx, -detxx * fM[kDX] + detyx * fM[kDY] - detzx * fM[kDZ], -detxy, detyy, -detzy,
Expand Down
4 changes: 2 additions & 2 deletions math/genvector/inc/Math/GenVector/DisplacementVector3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ namespace ROOT {
DisplacementVector3D Unit() const
{
SCALAR tot = R();
tot(tot == SCALAR(0)) = SCALAR(1);
where(tot == SCALAR(0), tot) = SCALAR(1);
return DisplacementVector3D(*this) / tot;
}

Expand Down Expand Up @@ -660,7 +660,7 @@ namespace ROOT {
{
if (os) {
os << "{ ";
for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::Size; ++i) {
for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::size(); ++i) {
os << "(" << v.x()[i] << "," << v.y()[i] << "," << v.z()[i] << ") ";
}
os << "}";
Expand Down
4 changes: 2 additions & 2 deletions math/genvector/inc/Math/GenVector/Plane3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ class Plane3D {
// what to do if s = 0 ?
const auto m = (s == SCALAR(0));
// set zero entries to 1 in the vector to avoid /0 later on
s(m) = SCALAR(1);
fD(m) = SCALAR(0);
where(m, s) = SCALAR(1);
where(m, fD) = SCALAR(0);
const SCALAR w = SCALAR(1) / s;
fA *= w;
fB *= w;
Expand Down
2 changes: 1 addition & 1 deletion math/genvector/inc/Math/GenVector/PositionVector3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ namespace ROOT {
{
if (os) {
os << "{ ";
for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::Size; ++i) {
for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::size(); ++i) {
os << "(" << v.x()[i] << "," << v.y()[i] << "," << v.z()[i] << ") ";
}
os << "}";
Expand Down
44 changes: 22 additions & 22 deletions math/genvector/inc/Math/GenVector/Transform3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ class Transform3D {
const auto detZmask = (det == T(0));
if (any_of(detZmask)) {
std::cerr << "Transform3D::inverse error: zero determinant" << std::endl;
det(detZmask) = T(1);
where(detZmask, det) = T(1);
}
det = T(1) / det;
detxx *= det;
Expand All @@ -852,15 +852,15 @@ class Transform3D {
T detzz = (fM[kXX] * fM[kYY] - fM[kXY] * fM[kYX]) * det;
// Set det=0 cases to 0
if (any_of(detZmask)) {
detxx(detZmask) = T(0);
detxy(detZmask) = T(0);
detxz(detZmask) = T(0);
detyx(detZmask) = T(0);
detyy(detZmask) = T(0);
detyz(detZmask) = T(0);
detzx(detZmask) = T(0);
detzy(detZmask) = T(0);
detzz(detZmask) = T(0);
where(detZmask, detxx) = T(0);
where(detZmask, detxy) = T(0);
where(detZmask, detxz) = T(0);
where(detZmask, detyx) = T(0);
where(detZmask, detyy) = T(0);
where(detZmask, detyz) = T(0);
where(detZmask, detzx) = T(0);
where(detZmask, detzy) = T(0);
where(detZmask, detzz) = T(0);
}
// set final components
SetComponents(detxx, -detyx, detzx, -detxx * fM[kDX] + detyx * fM[kDY] - detzx * fM[kDZ], -detxy, detyy, -detzy,
Expand Down Expand Up @@ -984,18 +984,18 @@ class Transform3D {
void SetIdentity(const typename SCALAR::mask_type m)
{
// set identity ( identity rotation and zero translation)
fM[kXX](m) = T(1);
fM[kXY](m) = T(0);
fM[kXZ](m) = T(0);
fM[kDX](m) = T(0);
fM[kYX](m) = T(0);
fM[kYY](m) = T(1);
fM[kYZ](m) = T(0);
fM[kDY](m) = T(0);
fM[kZX](m) = T(0);
fM[kZY](m) = T(0);
fM[kZZ](m) = T(1);
fM[kDZ](m) = T(0);
where(m, fM[kXX]) = T(1);
where(m, fM[kXY]) = T(0);
where(m, fM[kXZ]) = T(0);
where(m, fM[kDX]) = T(0);
where(m, fM[kYX]) = T(0);
where(m, fM[kYY]) = T(1);
where(m, fM[kYZ]) = T(0);
where(m, fM[kDY]) = T(0);
where(m, fM[kZX]) = T(0);
where(m, fM[kZY]) = T(0);
where(m, fM[kZZ]) = T(1);
where(m, fM[kDZ]) = T(0);
}

private:
Expand Down
21 changes: 18 additions & 3 deletions test/TFormulaVecTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,40 @@ bool testVecFormula() {

bool ok = true;

// Note that we have to disable several tests when using the Vc backend
// because of linker errors. This is because Vc is always built as a static
// library, and linked in MathCore, but the interpreter cannot lookup
// missing symbols for Vc math functions if the formula requires them and
// they are not already linked into MathCore by chance.
// See also:
// https://its.cern.ch/jira/browse/ROOT-10614
// https://github.com/root-project/root/pull/20769

ok &= testVec1D("3+[0]",constant_function, 3.333);
ok &= testVec1D("3",constant_function, 3.333);
#ifndef R__HAS_VC
ok &= testVec1D("sin(x)",std::sin,1);
ok &= testVec1D("cos(x)",std::cos,1);
#endif
ok &= testVec1D("exp(x)",std::exp,1);
ok &= testVec1D("log(x)",std::log,2);
ok &= testVec1D("log10(x)",TMath::Log10,2);
#ifndef R__HAS_VC
ok &= testVec1D("tan(x)",std::tan,1);
//ok &= testVec1D("sinh(x)",std::sinh,1);
//ok &= testVec1D("cosh(x)",std::cosh,1);
//ok &= testVec1D("tanh(x)",std::tanh,1);
ok &= testVec1D("sinh(x)",std::sinh,1);
ok &= testVec1D("cosh(x)",std::cosh,1);
ok &= testVec1D("tanh(x)",std::tanh,1);
ok &= testVec1D("asin(x)",std::asin,.1);
ok &= testVec1D("acos(x)",std::acos,.1);
#endif
ok &= testVec1D("atan(x)",std::atan,.1);
ok &= testVec1D("sqrt(x)",std::sqrt,2);
ok &= testVec1D("abs(x)",std::abs,-1);
ok &= testVec2D("pow(x,y)",std::pow,2,3);
#ifndef R__HAS_VC
ok &= testVec2D("min(x,y)",TMath::Min,2,3);
ok &= testVec2D("max(x,y)",TMath::Max,2,3);
#endif
ok &= testVec2D("atan2(x,y)",TMath::ATan2,2,3);

return ok;
Expand Down
Loading