From c279448a8c5e772f9456200999daf302315563a5 Mon Sep 17 00:00:00 2001 From: Pei Mu Date: Thu, 11 May 2023 15:49:03 +0100 Subject: [PATCH] skip when the value is inf or nan Addresses #653. --- ...07046b12ccddfbbba69a90139faba437067b96.txt | 46 +++++++++++++++++++ .../newton-irPass-LLVMIR-emitAssume.cpp | 8 ++++ 2 files changed, 54 insertions(+) create mode 100644 analysis/statistics/f507046b12ccddfbbba69a90139faba437067b96.txt diff --git a/analysis/statistics/f507046b12ccddfbbba69a90139faba437067b96.txt b/analysis/statistics/f507046b12ccddfbbba69a90139faba437067b96.txt new file mode 100644 index 000000000..9bf0c85b6 --- /dev/null +++ b/analysis/statistics/f507046b12ccddfbbba69a90139faba437067b96.txt @@ -0,0 +1,46 @@ + +changeset: 1488:f507046b12ccddfbbba69a90139faba437067b96 +char kNewtonVersion[] = "0.3-alpha-1488 (f507046b12ccddfbbba69a90139faba437067b96) (build 05-09-2023-19:27-pei@pei-G5-5500-Linux-5.19.0-41-generic-x86_64)"; +\n./src/noisy/noisy-linux-EN -O0 applications/noisy/helloWorld.n -s +\n./src/newton/newton-linux-EN -v 0 -eP applications/newton/invariants/ViolinWithTemperatureDependence-pigroups.nt + +Informational Report: +--------------------- +Invariant "ViolinWithTemperatureDependenceForPiGroups" has 2 unique kernels, each with 2 column(s)... + + Kernel 0 is a valid kernel: + + 1 1 + -0.5 -0 + 1 0 + 0.5 0 + 0 -1 + -0 -1 + + + The ordering of parameters is: P1 P0 P3 P2 P4 P5 + + Pi group 0, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^( 0) P5^(-0) + + Pi group 0, Pi 1 is: P0^(-0) P1^( 1) P2^( 0) P3^( 0) P4^(-1) P5^(-1) + + + Kernel 1 is a valid kernel: + + 1 0 + -0.5 1 + 1 -2 + 0.5 -1 + -0 -2 + 0 -2 + + + The ordering of parameters is: P1 P0 P3 P2 P4 P5 + + Pi group 1, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^(-0) P5^( 0) + + Pi group 1, Pi 1 is: P0^( 1) P1^( 0) P2^(-1) P3^(-2) P4^(-2) P5^(-2) + + + + diff --git a/src/newton/newton-irPass-LLVMIR-emitAssume.cpp b/src/newton/newton-irPass-LLVMIR-emitAssume.cpp index 38c9daebb..c31b5a5a9 100644 --- a/src/newton/newton-irPass-LLVMIR-emitAssume.cpp +++ b/src/newton/newton-irPass-LLVMIR-emitAssume.cpp @@ -139,6 +139,14 @@ emitAssume(State * N, BoundInfo * boundInfo, llvm::Function & llvmIrFunction) break; } + if (std::isnan(lowerBound) || std::isnan(upperBound)) { + break; + } + + if (std::isinf(lowerBound) || std::isinf(upperBound)) { + break; + } + if (instType->isFloatTy() || instType->isDoubleTy()) { assumeLowerCond = Builder.CreateFCmpOGE(llvmIrInstruction, ConstantFP::get(instType, lowerBound));