diff --git a/analysis/statistics/04e87cd90e209b0854a02ee5a0db6a52acf9598f.txt b/analysis/statistics/04e87cd90e209b0854a02ee5a0db6a52acf9598f.txt new file mode 100644 index 000000000..9f35b33b2 --- /dev/null +++ b/analysis/statistics/04e87cd90e209b0854a02ee5a0db6a52acf9598f.txt @@ -0,0 +1,46 @@ + +changeset: 1426:04e87cd90e209b0854a02ee5a0db6a52acf9598f +char kNewtonVersion[] = "0.3-alpha-1426 (04e87cd90e209b0854a02ee5a0db6a52acf9598f) (build 02-22-2023-12:53-pei@pei-G5-5500-Linux-5.19.0-32-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/analysis/statistics/14e672a0fc29372e363f57d30b3668484a10b184.txt b/analysis/statistics/14e672a0fc29372e363f57d30b3668484a10b184.txt new file mode 100644 index 000000000..3257c7468 --- /dev/null +++ b/analysis/statistics/14e672a0fc29372e363f57d30b3668484a10b184.txt @@ -0,0 +1,46 @@ + +changeset: 1425:14e672a0fc29372e363f57d30b3668484a10b184 +char kNewtonVersion[] = "0.3-alpha-1425 (14e672a0fc29372e363f57d30b3668484a10b184) (build 02-21-2023-19:16-pei@pei-G5-5500-Linux-5.19.0-32-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/analysis/statistics/3a22d91b7a572b5cf058e86905d84858238f6162.txt b/analysis/statistics/3a22d91b7a572b5cf058e86905d84858238f6162.txt new file mode 100644 index 000000000..44ee627d2 --- /dev/null +++ b/analysis/statistics/3a22d91b7a572b5cf058e86905d84858238f6162.txt @@ -0,0 +1,46 @@ + +changeset: 1429:3a22d91b7a572b5cf058e86905d84858238f6162 +char kNewtonVersion[] = "0.3-alpha-1429 (3a22d91b7a572b5cf058e86905d84858238f6162) (build 02-24-2023-15:58-pei@pei-G5-5500-Linux-5.19.0-32-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/analysis/statistics/4936cbce481e0710ee93c7e43a9ed4e56642d789.txt b/analysis/statistics/4936cbce481e0710ee93c7e43a9ed4e56642d789.txt new file mode 100644 index 000000000..baf28337c --- /dev/null +++ b/analysis/statistics/4936cbce481e0710ee93c7e43a9ed4e56642d789.txt @@ -0,0 +1,46 @@ + +changeset: 1423:4936cbce481e0710ee93c7e43a9ed4e56642d789 +char kNewtonVersion[] = "0.3-alpha-1423 (4936cbce481e0710ee93c7e43a9ed4e56642d789) (build 02-16-2023-18:14-pei@pei-G5-5500-Linux-5.15.0-60-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/analysis/statistics/53024717dfb9095b05f35147fa0359ec292d348d.txt b/analysis/statistics/53024717dfb9095b05f35147fa0359ec292d348d.txt new file mode 100644 index 000000000..67a756f3b --- /dev/null +++ b/analysis/statistics/53024717dfb9095b05f35147fa0359ec292d348d.txt @@ -0,0 +1,46 @@ + +changeset: 1430:53024717dfb9095b05f35147fa0359ec292d348d +char kNewtonVersion[] = "0.3-alpha-1430 (53024717dfb9095b05f35147fa0359ec292d348d) (build 02-25-2023-12:54-pei@pei-G5-5500-Linux-5.19.0-32-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/analysis/statistics/646e82975915b2408b0987a6f62eeefcc365cda0.txt b/analysis/statistics/646e82975915b2408b0987a6f62eeefcc365cda0.txt new file mode 100644 index 000000000..9bacb6aa6 --- /dev/null +++ b/analysis/statistics/646e82975915b2408b0987a6f62eeefcc365cda0.txt @@ -0,0 +1,46 @@ + +changeset: 1432:646e82975915b2408b0987a6f62eeefcc365cda0 +char kNewtonVersion[] = "0.3-alpha-1432 (646e82975915b2408b0987a6f62eeefcc365cda0) (build 02-25-2023-16:54-pei@pei-G5-5500-Linux-5.19.0-32-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/analysis/statistics/658fcc1fa3686f0d5fee443c41ef15f6cc736acf.txt b/analysis/statistics/658fcc1fa3686f0d5fee443c41ef15f6cc736acf.txt new file mode 100644 index 000000000..f689dae67 --- /dev/null +++ b/analysis/statistics/658fcc1fa3686f0d5fee443c41ef15f6cc736acf.txt @@ -0,0 +1,46 @@ + +changeset: 1431:658fcc1fa3686f0d5fee443c41ef15f6cc736acf +char kNewtonVersion[] = "0.3-alpha-1431 (658fcc1fa3686f0d5fee443c41ef15f6cc736acf) (build 02-25-2023-15:38-pei@pei-G5-5500-Linux-5.19.0-32-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/analysis/statistics/81f9462ff95e4b303471ddc2502e19f1f6868db5.txt b/analysis/statistics/81f9462ff95e4b303471ddc2502e19f1f6868db5.txt new file mode 100644 index 000000000..e93f7c207 --- /dev/null +++ b/analysis/statistics/81f9462ff95e4b303471ddc2502e19f1f6868db5.txt @@ -0,0 +1,46 @@ + +changeset: 1424:81f9462ff95e4b303471ddc2502e19f1f6868db5 +char kNewtonVersion[] = "0.3-alpha-1424 (81f9462ff95e4b303471ddc2502e19f1f6868db5) (build 02-17-2023-16:02-pei@pei-G5-5500-Linux-5.15.0-60-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/analysis/statistics/9ca25f4d67143a61a85121b62f95bc87ec99e385.txt b/analysis/statistics/9ca25f4d67143a61a85121b62f95bc87ec99e385.txt new file mode 100644 index 000000000..f8b3fb344 --- /dev/null +++ b/analysis/statistics/9ca25f4d67143a61a85121b62f95bc87ec99e385.txt @@ -0,0 +1,46 @@ + +changeset: 1428:9ca25f4d67143a61a85121b62f95bc87ec99e385 +char kNewtonVersion[] = "0.3-alpha-1428 (9ca25f4d67143a61a85121b62f95bc87ec99e385) (build 02-23-2023-20:27-pei@pei-G5-5500-Linux-5.19.0-32-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/analysis/statistics/bf69474eb3106f20c20836c3200a14c0309087fd.txt b/analysis/statistics/bf69474eb3106f20c20836c3200a14c0309087fd.txt new file mode 100644 index 000000000..5b46f5e87 --- /dev/null +++ b/analysis/statistics/bf69474eb3106f20c20836c3200a14c0309087fd.txt @@ -0,0 +1,46 @@ + +changeset: 1419:bf69474eb3106f20c20836c3200a14c0309087fd +char kNewtonVersion[] = "0.3-alpha-1419 (bf69474eb3106f20c20836c3200a14c0309087fd) (build 02-15-2023-15:52-pei@pei-G5-5500-Linux-5.15.0-60-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/analysis/statistics/bf8512d6a1a6fa55b61748bf00fbda41c3648b38.txt b/analysis/statistics/bf8512d6a1a6fa55b61748bf00fbda41c3648b38.txt new file mode 100644 index 000000000..35d060f0a --- /dev/null +++ b/analysis/statistics/bf8512d6a1a6fa55b61748bf00fbda41c3648b38.txt @@ -0,0 +1,46 @@ + +changeset: 1434:bf8512d6a1a6fa55b61748bf00fbda41c3648b38 +char kNewtonVersion[] = "0.3-alpha-1434 (bf8512d6a1a6fa55b61748bf00fbda41c3648b38) (build 03-02-2023-15:11-pei@pei-G5-5500-Linux-5.19.0-32-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/analysis/statistics/c96fd9b0f8db00a6ec78574f16f6f70f4f848484.txt b/analysis/statistics/c96fd9b0f8db00a6ec78574f16f6f70f4f848484.txt new file mode 100644 index 000000000..22c1b578e --- /dev/null +++ b/analysis/statistics/c96fd9b0f8db00a6ec78574f16f6f70f4f848484.txt @@ -0,0 +1,46 @@ + +changeset: 1420:c96fd9b0f8db00a6ec78574f16f6f70f4f848484 +char kNewtonVersion[] = "0.3-alpha-1420 (c96fd9b0f8db00a6ec78574f16f6f70f4f848484) (build 02-15-2023-20:51-pei@pei-G5-5500-Linux-5.15.0-60-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/analysis/statistics/d2fa8be0272cb67fb4ab20a81c80256ceb71f260.txt b/analysis/statistics/d2fa8be0272cb67fb4ab20a81c80256ceb71f260.txt new file mode 100644 index 000000000..078efc6aa --- /dev/null +++ b/analysis/statistics/d2fa8be0272cb67fb4ab20a81c80256ceb71f260.txt @@ -0,0 +1,46 @@ + +changeset: 1421:d2fa8be0272cb67fb4ab20a81c80256ceb71f260 +char kNewtonVersion[] = "0.3-alpha-1421 (d2fa8be0272cb67fb4ab20a81c80256ceb71f260) (build 02-15-2023-21:10-pei@pei-G5-5500-Linux-5.15.0-60-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/analysis/statistics/dc80804bccd819d32d1bc4da2c28d8efad013182.txt b/analysis/statistics/dc80804bccd819d32d1bc4da2c28d8efad013182.txt new file mode 100644 index 000000000..543bd73d0 --- /dev/null +++ b/analysis/statistics/dc80804bccd819d32d1bc4da2c28d8efad013182.txt @@ -0,0 +1,46 @@ + +changeset: 1403:dc80804bccd819d32d1bc4da2c28d8efad013182 +char kNewtonVersion[] = "0.3-alpha-1403 (dc80804bccd819d32d1bc4da2c28d8efad013182) (build 02-17-2023-15:33-pei@pei-G5-5500-Linux-5.15.0-60-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/analysis/statistics/e9c0fc3dccf2840185f9901459961c3a938e32b3.txt b/analysis/statistics/e9c0fc3dccf2840185f9901459961c3a938e32b3.txt new file mode 100644 index 000000000..a4457bb13 --- /dev/null +++ b/analysis/statistics/e9c0fc3dccf2840185f9901459961c3a938e32b3.txt @@ -0,0 +1,46 @@ + +changeset: 1422:e9c0fc3dccf2840185f9901459961c3a938e32b3 +char kNewtonVersion[] = "0.3-alpha-1422 (e9c0fc3dccf2840185f9901459961c3a938e32b3) (build 02-16-2023-17:30-pei@pei-G5-5500-Linux-5.15.0-60-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/analysis/statistics/fbf4365a5034211698fbc204238e2ab9623256e4.txt b/analysis/statistics/fbf4365a5034211698fbc204238e2ab9623256e4.txt new file mode 100644 index 000000000..027f1fb9c --- /dev/null +++ b/analysis/statistics/fbf4365a5034211698fbc204238e2ab9623256e4.txt @@ -0,0 +1,46 @@ + +changeset: 1433:fbf4365a5034211698fbc204238e2ab9623256e4 +char kNewtonVersion[] = "0.3-alpha-1433 (fbf4365a5034211698fbc204238e2ab9623256e4) (build 02-28-2023-15:20-pei@pei-G5-5500-Linux-5.19.0-32-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/applications/newton/llvm-ir/Makefile b/applications/newton/llvm-ir/Makefile index d4be0cfeb..b18e7581e 100644 --- a/applications/newton/llvm-ir/Makefile +++ b/applications/newton/llvm-ir/Makefile @@ -18,7 +18,7 @@ endif all: default -default: application.ll simple_control_flow.ll inferBound.ll inferBoundControlFlow.ll e_exp.ll sincosf.ll e_log.ll e_acosh.ll e_j0.ll e_y0.ll e_rem_pio2.ll benchmark_suite.ll phi_two_global_arrays.ll func_call.ll +default: application.ll simple_control_flow.ll inferBound.ll inferBoundControlFlow.ll e_exp.ll sincosf.ll e_log.ll e_acosh.ll e_j0.ll e_y0.ll e_rem_pio2.ll benchmark_suite.ll phi_two_global_arrays.ll func_call.ll test_shift.ll %.ll : %.c @echo Compiling $*.c diff --git a/applications/newton/llvm-ir/c-files/test_shift.c b/applications/newton/llvm-ir/c-files/test_shift.c new file mode 100644 index 000000000..ae28eb292 --- /dev/null +++ b/applications/newton/llvm-ir/c-files/test_shift.c @@ -0,0 +1,27 @@ +// +// Created by pei on 23/02/23. +// + +#include +#include + +typedef double bmx055xAcceleration; +typedef double bmx055yAcceleration; + +int32_t testFunc(bmx055xAcceleration a, bmx055yAcceleration b) { + printf("%f, %f\n", a, b); + int64_t res1 = (int64_t)b >> 3; + printf("res1 = %ld\n", res1); + int32_t res2 = (int32_t)a << 4; + printf("res2 = %d\n", res2); + int16_t res3 = (int16_t)a >> (int8_t)(b+40); + printf("res3 = %d\n", res3); + int32_t res4 = (uint64_t)a >> 52; + printf("res4 = %d\n", res4); + return res1 + res2 + res3 + res4; +} + +int main() { + int32_t res = testFunc(-532.4, -37.9); + printf("res = %d\n", res); +} \ No newline at end of file diff --git a/applications/newton/llvm-ir/performance_test/auto_test.cpp b/applications/newton/llvm-ir/performance_test/auto_test.cpp index b5e06c4c3..1327752c8 100644 --- a/applications/newton/llvm-ir/performance_test/auto_test.cpp +++ b/applications/newton/llvm-ir/performance_test/auto_test.cpp @@ -255,7 +255,7 @@ struct timerData recordTimerData(const std::string& test_cases, const std::strin if (!timer_data.function_results.empty()) { if (!std::equal(timer_data.function_results.begin(), timer_data.function_results.end(), data_timer_res.second.begin())) - std::cerr << "result error: " << test_cases << " with parameters: " << param_str << std::endl; + std::cerr << "result error within iteration: " << test_cases << " with parameters: " << param_str << std::endl; return false; } else return true; @@ -307,7 +307,7 @@ int main(int argc, char** argv) { {-0.9, -0.4}, {0.2, 0.8}, {9.7, 10.5}, - {35.75, 36.03}, + {35.75, 36.33}, {476.84, 477.21}, {999.8, 1000.9} }; @@ -368,7 +368,9 @@ int main(int argc, char** argv) { // check function results if (!std::equal(ori_perf_data.function_results.begin(), ori_perf_data.function_results.end(), opt_perf_data.function_results.begin())) { - std::cerr << "result error: " << test_cases[case_id] << " with parameters: " << param_str << std::endl; + std::cerr << "result error: " << test_cases[case_id] << " with parameters: " << param_str << + "ori: " << ori_perf_data.function_results[0] << ", opt: " << opt_perf_data.function_results[0] << + std::endl; } // remove element if ori < opt @@ -385,15 +387,24 @@ int main(int argc, char** argv) { } } - ori_perf_data.time_consumption_avg = std::accumulate(ori_perf_data.ms_time_consumption.begin(), - ori_perf_data.ms_time_consumption.end(), - 0.0) / ori_perf_data.ms_time_consumption.size(); - opt_perf_data.time_consumption_avg = std::accumulate(opt_perf_data.ms_time_consumption.begin(), - opt_perf_data.ms_time_consumption.end(), - 0.0) / opt_perf_data.ms_time_consumption.size(); - - int inst_speedup = round((ori_perf_data.inst_count_avg - opt_perf_data.inst_count_avg) * 100 / opt_perf_data.inst_count_avg); - int time_speedup = round((ori_perf_data.time_consumption_avg - opt_perf_data.time_consumption_avg) * 100 / opt_perf_data.time_consumption_avg); + int inst_speedup, time_speedup; + if (ori_perf_data.ms_time_consumption.empty()) { + assert(opt_perf_data.ms_time_consumption.empty() && "erase mis-match!"); + inst_speedup = 0; + time_speedup = 0; + } else { + ori_perf_data.time_consumption_avg = std::accumulate(ori_perf_data.ms_time_consumption.begin(), + ori_perf_data.ms_time_consumption.end(), + 0.0) / ori_perf_data.ms_time_consumption.size(); + opt_perf_data.time_consumption_avg = std::accumulate(opt_perf_data.ms_time_consumption.begin(), + opt_perf_data.ms_time_consumption.end(), + 0.0) / opt_perf_data.ms_time_consumption.size(); + + inst_speedup = round((ori_perf_data.inst_count_avg - opt_perf_data.inst_count_avg) + * 100 / opt_perf_data.inst_count_avg); + time_speedup = round((ori_perf_data.time_consumption_avg - opt_perf_data.time_consumption_avg) + * 100 / opt_perf_data.time_consumption_avg); + } int ir_reduce = round((ori_perf_data.ir_lines - opt_perf_data.ir_lines) * 100 / opt_perf_data.ir_lines); int lib_size_reduce = round((ori_perf_data.library_size - opt_perf_data.library_size) * 100 / opt_perf_data.library_size); ofs << "speed up after optimization\t" << param_str << "\t" << inst_speedup << "%\t" << time_speedup << "%\t" diff --git a/applications/newton/llvm-ir/performance_test/main.c b/applications/newton/llvm-ir/performance_test/main.c index eacd82fb8..4c646a4fa 100644 --- a/applications/newton/llvm-ir/performance_test/main.c +++ b/applications/newton/llvm-ir/performance_test/main.c @@ -267,19 +267,19 @@ main(int argc, char** argv) } #elif defined(FLOAT64_ADD) for (size_t idx = 0; idx < iteration_num; idx++) { - result[idx] = float64_add(xOps[idx], yOps[idx]); + result[idx] = float64_add((uint64_t)(xOps[idx]), (uint64_t)(yOps[idx])); } #elif defined(FLOAT64_DIV) for (size_t idx = 0; idx < iteration_num; idx++) { - result[idx] = float64_div(xOps[idx], yOps[idx]); + result[idx] = float64_div((uint64_t)(xOps[idx]), (uint64_t)(yOps[idx])); } #elif defined(FLOAT64_MUL) for (size_t idx = 0; idx < iteration_num; idx++) { - result[idx] = float64_mul(xOps[idx], yOps[idx]); + result[idx] = float64_mul((uint64_t)(xOps[idx]), (uint64_t)(yOps[idx])); } #elif defined(FLOAT64_SIN) for (size_t idx = 0; idx < iteration_num; idx++) { - result[idx] = float64_sin(xOps[idx], yOps[idx]); + result[idx] = float64_sin((uint64_t)(xOps[idx]), (uint64_t)(yOps[idx])); } #elif defined(BENCHMARK_SUITE_INT) int32_add_test(intXOps, intYOps, intResult); diff --git a/src/newton/newton-irPass-LLVMIR-optimizeByRange.cpp b/src/newton/newton-irPass-LLVMIR-optimizeByRange.cpp index be6aa1e23..fcfe16626 100644 --- a/src/newton/newton-irPass-LLVMIR-optimizeByRange.cpp +++ b/src/newton/newton-irPass-LLVMIR-optimizeByRange.cpp @@ -146,8 +146,7 @@ class FunctionNodeCmp { using hashFuncSet = std::set; void -cleanFunctionMap(const std::unique_ptr & Mod, std::map & callerMap, - std::unordered_map> & funcCallTree) +cleanFunctionMap(const std::unique_ptr & Mod, std::map & callerMap) { for (auto itFunc = callerMap.begin(); itFunc != callerMap.end();) { @@ -156,18 +155,10 @@ cleanFunctionMap(const std::unique_ptr & Mod, std::mapgetFunction(itFunc->first)) - itFunc = funcCallTree.erase(itFunc); - else - ++itFunc; - } } void -overloadFunc(std::unique_ptr & Mod, std::map & callerMap, - const std::unordered_map> & funcCallTree) +overloadFunc(std::unique_ptr & Mod, std::map & callerMap) { /* * compare the functions and remove the redundant one @@ -206,45 +197,9 @@ overloadFunc(std::unique_ptr & Mod, std::map & baseFuncNum = baseFuncs.size(); } - std::set baseFuncNames; - for (auto f : baseFuncs) - { - baseFuncNames.emplace(f.getFunc()->getName().str()); - } - - /* - * iterate functions in Mod, if it cannot be found in baseFuncs, delete it. - * */ - for (auto itFunc = Mod->getFunctionList().begin(); itFunc != Mod->getFunctionList().end(); itFunc++) - { - if (!itFunc->hasName() || itFunc->getName().empty()) - continue; - if (itFunc->getName().startswith("llvm.dbg.value") || - itFunc->getName().startswith("llvm.dbg.declare")) - continue; - if (itFunc->isDeclaration()) - continue; - if (baseFuncNames.find(itFunc->getName().str()) == baseFuncNames.end() && itFunc->hasLocalLinkage()) - { - callerMap.erase(itFunc->getName().str()); - Mod->getFunctionList().remove(itFunc); - /* - * delete its children functions - * PS: if we delete some functions, we should also remove it from the "callerMap" - * */ - auto itFoundParent = funcCallTree.find(itFunc->getName().str()); - if (itFoundParent != funcCallTree.end()) - { - for (const auto & calleeName : itFoundParent->second) - { - callerMap.erase(calleeName); - Mod->getFunctionList().remove(Mod->getFunction(calleeName)); - itFunc--; - } - } - itFunc--; - } - } + legacy::PassManager passManager; + passManager.add(createGlobalDCEPass()); + passManager.run(*Mod); } void @@ -361,8 +316,6 @@ irPassLLVMIROptimizeByRange(State * N) flexprint(N->Fe, N->Fm, N->Fpinfo, "infer bound\n"); std::map callerMap; callerMap.clear(); - std::unordered_map> funcCallTree; - funcCallTree.clear(); bool useOverLoad = true; for (auto & mi : *Mod) { @@ -372,7 +325,6 @@ irPassLLVMIROptimizeByRange(State * N) funcBoundInfo.emplace(mi.getName().str(), boundInfo); std::vector calleeNames; collectCalleeInfo(calleeNames, funcBoundInfo, boundInfo); - funcCallTree.emplace(mi.getName().str(), calleeNames); } /* @@ -402,16 +354,15 @@ irPassLLVMIROptimizeByRange(State * N) * remove the functions that are optimized by passes. * */ if (useOverLoad) - cleanFunctionMap(Mod, callerMap, funcCallTree); + cleanFunctionMap(Mod, callerMap); if (useOverLoad) - overloadFunc(Mod, callerMap, funcCallTree); + overloadFunc(Mod, callerMap); useOverLoad = false; flexprint(N->Fe, N->Fm, N->Fpinfo, "infer bound\n"); funcBoundInfo.clear(); - funcCallTree.clear(); for (auto & mi : *Mod) { auto boundInfo = new BoundInfo(); @@ -420,7 +371,6 @@ irPassLLVMIROptimizeByRange(State * N) funcBoundInfo.emplace(mi.getName().str(), boundInfo); std::vector calleeNames; collectCalleeInfo(calleeNames, funcBoundInfo, boundInfo); - funcCallTree.emplace(mi.getName().str(), calleeNames); } flexprint(N->Fe, N->Fm, N->Fpinfo, "constant substitution\n"); @@ -448,27 +398,17 @@ irPassLLVMIROptimizeByRange(State * N) // } // } - /* - * todo: there's a bug when running gbDCE after `overloadFunc` - * GUESS: 1. related to GlobalNumberState - * 2. related to setCalledFunction - * test cases: `float_add`, `float_mul` - * */ - // passManager.add(createGlobalDCEPass()); - // passManager.run(*Mod); - /* * remove the functions that are optimized by passes. * */ if (useOverLoad) - cleanFunctionMap(Mod, callerMap, funcCallTree); + cleanFunctionMap(Mod, callerMap); if (useOverLoad) - overloadFunc(Mod, callerMap, funcCallTree); + overloadFunc(Mod, callerMap); flexprint(N->Fe, N->Fm, N->Fpinfo, "infer bound\n"); funcBoundInfo.clear(); - funcCallTree.clear(); for (auto & mi : *Mod) { auto boundInfo = new BoundInfo(); @@ -477,7 +417,6 @@ irPassLLVMIROptimizeByRange(State * N) funcBoundInfo.emplace(mi.getName().str(), boundInfo); std::vector calleeNames; collectCalleeInfo(calleeNames, funcBoundInfo, boundInfo); - funcCallTree.emplace(mi.getName().str(), calleeNames); } /* @@ -504,10 +443,10 @@ irPassLLVMIROptimizeByRange(State * N) * remove the functions that are optimized by passes. * */ if (useOverLoad) - cleanFunctionMap(Mod, callerMap, funcCallTree); + cleanFunctionMap(Mod, callerMap); if (useOverLoad) - overloadFunc(Mod, callerMap, funcCallTree); + overloadFunc(Mod, callerMap); /* * Dump BC file to a file. diff --git a/src/newton/newton-irPass-LLVMIR-rangeAnalysis.cpp b/src/newton/newton-irPass-LLVMIR-rangeAnalysis.cpp index 33d325b4f..517f1cbbc 100644 --- a/src/newton/newton-irPass-LLVMIR-rangeAnalysis.cpp +++ b/src/newton/newton-irPass-LLVMIR-rangeAnalysis.cpp @@ -1104,8 +1104,14 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, } else if (funcName == "sqrt") { - lowRange = sqrt(argRanges[0].first); - highRange = sqrt(argRanges[0].second); + if (argRanges[0].first < 0) + lowRange = 0; + else + lowRange = sqrt(argRanges[0].first); + if (argRanges[0].second < 0) + highRange = 0; + else + highRange = sqrt(argRanges[0].second); } else if (funcName == "log1p") { @@ -1309,7 +1315,7 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, * update the inner bound info with the new function. * // todo: this code is a bit wired, maybe can be improved * */ - auto innerBoundInfo = new BoundInfo(); + auto overloadBoundInfo = new BoundInfo(); for (size_t idx = 0; idx < llvmIrCallInstruction->getNumOperands() - 1; idx++) { /* @@ -1319,17 +1325,17 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, { int64_t constIntValue = cInt->getSExtValue(); flexprint(N->Fe, N->Fm, N->Fpinfo, "\tCall: It's a constant int value: %d.\n", constIntValue); - innerBoundInfo->virtualRegisterRange.emplace(realCallee->getArg(idx), - std::make_pair(static_cast(constIntValue), - static_cast(constIntValue))); + overloadBoundInfo->virtualRegisterRange.emplace(realCallee->getArg(idx), + std::make_pair(static_cast(constIntValue), + static_cast(constIntValue))); } else if (ConstantFP * constFp = dyn_cast(llvmIrCallInstruction->getOperand(idx))) { double constDoubleValue = (constFp->getValueAPF()).convertToDouble(); flexprint(N->Fe, N->Fm, N->Fpinfo, "\tCall: It's a constant double value: %f.\n", constDoubleValue); - innerBoundInfo->virtualRegisterRange.emplace(realCallee->getArg(idx), - std::make_pair(constDoubleValue, - constDoubleValue)); + overloadBoundInfo->virtualRegisterRange.emplace(realCallee->getArg(idx), + std::make_pair(constDoubleValue, + constDoubleValue)); } else { @@ -1342,8 +1348,8 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, { flexprint(N->Fe, N->Fm, N->Fpinfo, "\tCall: the range of the operand is: %f - %f.\n", vrRangeIt->second.first, vrRangeIt->second.second); - innerBoundInfo->virtualRegisterRange.emplace(realCallee->getArg(idx), - vrRangeIt->second); + overloadBoundInfo->virtualRegisterRange.emplace(realCallee->getArg(idx), + vrRangeIt->second); } else { @@ -1352,13 +1358,33 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, } } - returnRange = rangeAnalysis(N, *realCallee, innerBoundInfo, callerMap, + returnRange = rangeAnalysis(N, *realCallee, overloadBoundInfo, callerMap, typeRange, virtualRegisterVectorRange, useOverLoad); + /* + * If the "realCallee" pass arguments by pointer, update the pointer argus. + * If the outer function have such operand value, but doesn't exist after the callee, + * remove it from boundInfo->virtualRegisterRange + * If both exist before and after callee, then update its value. + * */ + for (size_t idx = 0; idx < llvmIrCallInstruction->getNumOperands() - 1; idx++) { + auto operand = llvmIrCallInstruction->getOperand(idx); + if (operand->getType()->getTypeID() == Type::PointerTyID) { + auto vrIt = boundInfo->virtualRegisterRange.find(operand); + if (vrIt != boundInfo->virtualRegisterRange.end()) { + auto ibIt = innerBoundInfo->virtualRegisterRange.find(operand); + if (ibIt != innerBoundInfo->virtualRegisterRange.end()) { + vrIt->second = ibIt->second; + } else { + boundInfo->virtualRegisterRange.erase(vrIt); + } + } + } + } if (returnRange.first != nullptr) { boundInfo->virtualRegisterRange.emplace(llvmIrCallInstruction, returnRange.second); } - boundInfo->calleeBound.emplace(newFuncName, innerBoundInfo); + boundInfo->calleeBound.emplace(newFuncName, overloadBoundInfo); } else { @@ -1369,6 +1395,26 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, realCallee = calledFunction; returnRange = rangeAnalysis(N, *realCallee, innerBoundInfo, callerMap, typeRange, virtualRegisterVectorRange, useOverLoad); + /* + * If the "realCallee" pass arguments by pointer, update the pointer argus. + * If the outer function have such operand value, but doesn't exist after the callee, + * remove it from boundInfo->virtualRegisterRange + * If both exist before and after callee, then update its value. + * */ + for (size_t idx = 0; idx < llvmIrCallInstruction->getNumOperands() - 1; idx++) { + auto operand = llvmIrCallInstruction->getOperand(idx); + if (operand->getType()->getTypeID() == Type::PointerTyID) { + auto vrIt = boundInfo->virtualRegisterRange.find(operand); + if (vrIt != boundInfo->virtualRegisterRange.end()) { + auto ibIt = innerBoundInfo->virtualRegisterRange.find(operand); + if (ibIt != innerBoundInfo->virtualRegisterRange.end()) { + vrIt->second = ibIt->second; + } else { + boundInfo->virtualRegisterRange.erase(vrIt); + } + } + } + } if (returnRange.first != nullptr) { boundInfo->virtualRegisterRange.emplace(llvmIrCallInstruction, returnRange.second); @@ -1583,7 +1629,7 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, { constValue = (constFp->getValueAPF()).convertToDouble(); } - else if (ConstantInt * constInt = llvm::dyn_cast(rightOperand)) + else if (ConstantInt * constInt = llvm::dyn_cast(leftOperand)) { constValue = constInt->getSExtValue(); } @@ -1903,6 +1949,12 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, case Instruction::Shl: if (auto llvmIrBinaryOperator = dyn_cast(&llvmIrInstruction)) { + Type * instType = llvmIrBinaryOperator->getType(); + uint bitWidth = 64; + if (instType->isIntegerTy()) + { + bitWidth = cast(instType)->getBitWidth(); + } Value * leftOperand = llvmIrInstruction.getOperand(0); Value * rightOperand = llvmIrInstruction.getOperand(1); if ((isa(leftOperand) && isa(rightOperand))) @@ -1921,8 +1973,27 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, auto vrRangeIt = boundInfo->virtualRegisterRange.find(leftOperand); if (vrRangeIt != boundInfo->virtualRegisterRange.end()) { - lowerBound = vrRangeIt->second.first; - upperBound = vrRangeIt->second.second; + switch (bitWidth) + { + case 8: + lowerBound = static_cast(static_cast(vrRangeIt->second.first)); + upperBound = static_cast(static_cast(vrRangeIt->second.second)); + break; + case 16: + lowerBound = static_cast(static_cast(vrRangeIt->second.first)); + upperBound = static_cast(static_cast(vrRangeIt->second.second)); + break; + case 32: + lowerBound = static_cast(static_cast(vrRangeIt->second.first)); + upperBound = static_cast(static_cast(vrRangeIt->second.second)); + break; + case 64: + lowerBound = static_cast(static_cast(vrRangeIt->second.first)); + upperBound = static_cast(static_cast(vrRangeIt->second.second)); + break; + default: + assert(false); + } } else { @@ -1932,18 +2003,18 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, vrRangeIt = boundInfo->virtualRegisterRange.find(rightOperand); if (vrRangeIt != boundInfo->virtualRegisterRange.end()) { - auto leftMin = lowerBound; - auto leftMax = upperBound; - auto rightMin = vrRangeIt->second.first; - auto rightMax = vrRangeIt->second.second; - lowerBound = min(min(min((int)leftMin << (int)rightMin, - (int)leftMin << (int)rightMax), - (int)leftMax << (int)rightMin), - (int)leftMax << (int)rightMax); - upperBound = max(max(max((int)leftMin << (int)rightMin, - (int)leftMin << (int)rightMax), - (int)leftMax << (int)rightMin), - (int)leftMax << (int)rightMax); + auto leftMin = lowerBound; + auto leftMax = upperBound; + double rightMin = vrRangeIt->second.first; + double rightMax = vrRangeIt->second.second; + lowerBound = min(min(min((uint64_t)leftMin << (int64_t)rightMin, + (uint64_t)leftMin << (int64_t)rightMax), + (uint64_t)leftMax << (int64_t)rightMin), + (uint64_t)leftMax << (int64_t)rightMax); + upperBound = max(max(max((uint64_t)leftMin << (int64_t)rightMin, + (uint64_t)leftMin << (int64_t)rightMax), + (uint64_t)leftMax << (int64_t)rightMin), + (uint64_t)leftMax << (int64_t)rightMax); } else { @@ -1971,11 +2042,28 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, auto vrRangeIt = boundInfo->virtualRegisterRange.find(rightOperand); if (vrRangeIt != boundInfo->virtualRegisterRange.end()) { - // todo: if we need assert or other check here? - uint64_t rightMin = vrRangeIt->second.first < 0 ? 0 : vrRangeIt->second.first; - uint64_t rightMax = vrRangeIt->second.second < 0 ? 0 : vrRangeIt->second.second; - double lowerBound = min(constValue << rightMin, constValue << rightMax); - double upperBound = max(constValue << rightMin, constValue << rightMax); + double lowerBound, upperBound; + switch (bitWidth) + { + case 8: + lowerBound = constValue << (static_cast(vrRangeIt->second.first)); + upperBound = constValue << (static_cast(vrRangeIt->second.second)); + break; + case 16: + lowerBound = constValue << (static_cast(vrRangeIt->second.first)); + upperBound = constValue << (static_cast(vrRangeIt->second.second)); + break; + case 32: + lowerBound = constValue << (static_cast(vrRangeIt->second.first)); + upperBound = constValue << (static_cast(vrRangeIt->second.second)); + break; + case 64: + lowerBound = constValue << (static_cast(vrRangeIt->second.first)); + upperBound = constValue << (static_cast(vrRangeIt->second.second)); + break; + default: + assert(false); + } boundInfo->virtualRegisterRange.emplace(llvmIrBinaryOperator, std::make_pair(lowerBound, upperBound)); } @@ -1998,9 +2086,30 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, auto vrRangeIt = boundInfo->virtualRegisterRange.find(leftOperand); if (vrRangeIt != boundInfo->virtualRegisterRange.end()) { + double resMin = 0, resMax = 0; + switch (bitWidth) + { + case 8: + resMin = static_cast(vrRangeIt->second.first) << constValue; + resMax = static_cast(vrRangeIt->second.second) << constValue; + break; + case 16: + resMin = static_cast(vrRangeIt->second.first) << constValue; + resMax = static_cast(vrRangeIt->second.second) << constValue; + break; + case 32: + resMin = static_cast(vrRangeIt->second.first) << constValue; + resMax = static_cast(vrRangeIt->second.second) << constValue; + break; + case 64: + resMin = static_cast(vrRangeIt->second.first) << constValue; + resMax = static_cast(vrRangeIt->second.second) << constValue; + break; + default: + assert(false); + } boundInfo->virtualRegisterRange.emplace(llvmIrBinaryOperator, - std::make_pair((int)vrRangeIt->second.first << constValue, - (int)vrRangeIt->second.second << constValue)); + std::make_pair(resMin, resMax)); } else { @@ -2015,10 +2124,18 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, } break; - case Instruction::LShr: + /* + * Sign extend + * */ case Instruction::AShr: if (auto llvmIrBinaryOperator = dyn_cast(&llvmIrInstruction)) { + Type * instType = llvmIrBinaryOperator->getType(); + uint bitWidth = 64; + if (instType->isIntegerTy()) + { + bitWidth = cast(instType)->getBitWidth(); + } Value * leftOperand = llvmIrInstruction.getOperand(0); Value * rightOperand = llvmIrInstruction.getOperand(1); if ((isa(leftOperand) && isa(rightOperand))) @@ -2027,8 +2144,8 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, } if (!isa(leftOperand) && !isa(rightOperand)) { - double lowerBound = 0.0; - double upperBound = 0.0; + double leftMin = 0.0; + double leftMax = 0.0; /* * e.g. x1 >> x2 * range: [min(x1_min>>x2_min, x1_min>>x2_max, x1_max>>x2_min, x1_max>>x2_max), @@ -2037,29 +2154,29 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, auto vrRangeIt = boundInfo->virtualRegisterRange.find(leftOperand); if (vrRangeIt != boundInfo->virtualRegisterRange.end()) { - lowerBound = vrRangeIt->second.first; - upperBound = vrRangeIt->second.second; + leftMin = vrRangeIt->second.first; + leftMax = vrRangeIt->second.second; } else { assert(!valueRangeDebug && "failed to get range"); break; } + double lowerBound, upperBound; vrRangeIt = boundInfo->virtualRegisterRange.find(rightOperand); if (vrRangeIt != boundInfo->virtualRegisterRange.end()) { - auto leftMin = lowerBound; - auto leftMax = upperBound; - auto rightMin = vrRangeIt->second.first; - auto rightMax = vrRangeIt->second.second; - lowerBound = min(min(min((int)leftMin >> (int)rightMin, - (int)leftMin >> (int)rightMax), - (int)leftMax >> (int)rightMin), - (int)leftMax >> (int)rightMax); - upperBound = max(max(max((int)leftMin >> (int)rightMin, - (int)leftMin >> (int)rightMax), - (int)leftMax >> (int)rightMin), - (int)leftMax >> (int)rightMax); + double rightMin = 0, rightMax = 0; + rightMin = vrRangeIt->second.first; + rightMax = vrRangeIt->second.second; + lowerBound = min(min(min(static_cast(leftMin) >> static_cast(rightMin), + static_cast(leftMin) >> static_cast(rightMax)), + static_cast(leftMax) >> static_cast(rightMin)), + static_cast(leftMax) >> static_cast(rightMax)); + upperBound = max(max(max(static_cast(leftMin) >> static_cast(rightMin), + static_cast(leftMin) >> static_cast(rightMax)), + static_cast(leftMax) >> static_cast(rightMin)), + static_cast(leftMax) >> static_cast(rightMax)); } else { @@ -2078,7 +2195,7 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, uint64_t constValue = 1.0; if (ConstantFP * constFp = llvm::dyn_cast(leftOperand)) { - constValue = static_cast((constFp->getValueAPF()).convertToDouble()); + constValue = static_cast((constFp->getValueAPF()).convertToDouble()); } else if (ConstantInt * constInt = llvm::dyn_cast(leftOperand)) { @@ -2087,11 +2204,28 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, auto vrRangeIt = boundInfo->virtualRegisterRange.find(rightOperand); if (vrRangeIt != boundInfo->virtualRegisterRange.end()) { - // todo: if we need assert or other check here? - uint64_t rightMin = vrRangeIt->second.first < 0 ? 0 : vrRangeIt->second.first; - uint64_t rightMax = vrRangeIt->second.second < 0 ? 0 : vrRangeIt->second.second; - double lowerBound = min(constValue >> rightMin, constValue >> rightMax); - double upperBound = max(constValue >> rightMin, constValue >> rightMax); + double lowerBound, upperBound; + switch (bitWidth) + { + case 8: + lowerBound = constValue >> (static_cast(vrRangeIt->second.first)); + upperBound = constValue >> (static_cast(vrRangeIt->second.second)); + break; + case 16: + lowerBound = constValue >> (static_cast(vrRangeIt->second.first)); + upperBound = constValue >> (static_cast(vrRangeIt->second.second)); + break; + case 32: + lowerBound = constValue >> (static_cast(vrRangeIt->second.first)); + upperBound = constValue >> (static_cast(vrRangeIt->second.second)); + break; + case 64: + lowerBound = constValue >> (static_cast(vrRangeIt->second.first)); + upperBound = constValue >> (static_cast(vrRangeIt->second.second)); + break; + default: + assert(false); + } boundInfo->virtualRegisterRange.emplace(llvmIrBinaryOperator, std::make_pair(lowerBound, upperBound)); } @@ -2114,10 +2248,230 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, auto vrRangeIt = boundInfo->virtualRegisterRange.find(leftOperand); if (vrRangeIt != boundInfo->virtualRegisterRange.end()) { - uint64_t rightMin = vrRangeIt->second.first < 0 ? 0 : vrRangeIt->second.first; - uint64_t rightMax = vrRangeIt->second.second < 0 ? 0 : vrRangeIt->second.second; + double resMin = 0, resMax = 0; + switch (bitWidth) + { + case 8: + resMin = static_cast(vrRangeIt->second.first) >> constValue; + resMax = static_cast(vrRangeIt->second.second) >> constValue; + break; + case 16: + resMin = static_cast(vrRangeIt->second.first) >> constValue; + resMax = static_cast(vrRangeIt->second.second) >> constValue; + break; + case 32: + resMin = static_cast(vrRangeIt->second.first) >> constValue; + resMax = static_cast(vrRangeIt->second.second) >> constValue; + break; + case 64: + resMin = static_cast(vrRangeIt->second.first) >> constValue; + resMax = static_cast(vrRangeIt->second.second) >> constValue; + break; + default: + assert(false); + } boundInfo->virtualRegisterRange.emplace(llvmIrBinaryOperator, - std::make_pair(rightMin >> constValue, rightMax >> constValue)); + std::make_pair(min(resMin, resMax), max(resMin, resMax))); + } + else + { + assert(!valueRangeDebug && "failed to get range"); + } + } + else + { + flexprint(N->Fe, N->Fm, N->Fperr, "\tShr: Unexpected error. Might have an invalid operand.\n"); + assert(!valueRangeDebug && "failed to get range"); + } + } + break; + + /* + * Zero extend + * */ + case Instruction::LShr: + if (auto llvmIrBinaryOperator = dyn_cast(&llvmIrInstruction)) + { + Type * instType = llvmIrBinaryOperator->getType(); + uint bitWidth = 64; + if (instType->isIntegerTy()) + { + bitWidth = cast(instType)->getBitWidth(); + } + Value * leftOperand = llvmIrInstruction.getOperand(0); + Value * rightOperand = llvmIrInstruction.getOperand(1); + if ((isa(leftOperand) && isa(rightOperand))) + { + flexprint(N->Fe, N->Fm, N->Fperr, "\tShr: Expression normalization needed.\n"); + } + if (!isa(leftOperand) && !isa(rightOperand)) + { + double leftMin = 0.0; + double leftMax = 0.0; + /* + * e.g. x1 >> x2 + * range: [min(x1_min>>x2_min, x1_min>>x2_max, x1_max>>x2_min, x1_max>>x2_max), + * max(x1_min>>x2_min, x1_min>>x2_max, x1_max>>x2_min, x1_max>>x2_max)] + */ + auto vrRangeIt = boundInfo->virtualRegisterRange.find(leftOperand); + if (vrRangeIt != boundInfo->virtualRegisterRange.end()) + { + switch (bitWidth) + { + case 8: + leftMin = static_cast(static_cast(vrRangeIt->second.first)); + leftMax = static_cast(static_cast(vrRangeIt->second.second)); + break; + case 16: + leftMin = static_cast(static_cast(vrRangeIt->second.first)); + leftMax = static_cast(static_cast(vrRangeIt->second.second)); + break; + case 32: + leftMin = static_cast(static_cast(vrRangeIt->second.first)); + leftMax = static_cast(static_cast(vrRangeIt->second.second)); + break; + case 64: + leftMin = static_cast(static_cast(vrRangeIt->second.first)); + leftMax = static_cast(static_cast(vrRangeIt->second.second)); + break; + default: + assert(false); + } + } + else + { + assert(!valueRangeDebug && "failed to get range"); + break; + } + double lowerBound, upperBound; + vrRangeIt = boundInfo->virtualRegisterRange.find(rightOperand); + if (vrRangeIt != boundInfo->virtualRegisterRange.end()) + { + double rightMin = 0, rightMax = 0; + switch (bitWidth) + { + case 8: + rightMin = static_cast(vrRangeIt->second.first); + rightMax = static_cast(vrRangeIt->second.second); + break; + case 16: + rightMin = static_cast(vrRangeIt->second.first); + rightMax = static_cast(vrRangeIt->second.second); + break; + case 32: + rightMin = static_cast(vrRangeIt->second.first); + rightMax = static_cast(vrRangeIt->second.second); + break; + case 64: + rightMin = static_cast(vrRangeIt->second.first); + rightMax = static_cast(vrRangeIt->second.second); + break; + default: + assert(false); + } + lowerBound = min(min(min((uint64_t)leftMin >> (uint64_t)rightMin, + (uint64_t)leftMin >> (uint64_t)rightMax), + (uint64_t)leftMax >> (uint64_t)rightMin), + (uint64_t)leftMax >> (uint64_t)rightMax); + upperBound = max(max(max((uint64_t)leftMin >> (uint64_t)rightMin, + (uint64_t)leftMin >> (uint64_t)rightMax), + (int64_t)leftMax >> (uint64_t)rightMin), + (uint64_t)leftMax >> (uint64_t)rightMax); + } + else + { + assert(!valueRangeDebug && "failed to get range"); + break; + } + boundInfo->virtualRegisterRange.emplace(llvmIrBinaryOperator, std::make_pair(lowerBound, upperBound)); + } + else if (isa(leftOperand) && !isa(rightOperand)) + { + /* + * e.g. 2 >> x + * range: [min(2>>x2_min, 2>>x2_max), + * max(2>>x2_min, 2>>x2_max)] + */ + uint64_t constValue = 1.0; + if (ConstantFP * constFp = llvm::dyn_cast(leftOperand)) + { + constValue = static_cast((constFp->getValueAPF()).convertToDouble()); + } + else if (ConstantInt * constInt = llvm::dyn_cast(leftOperand)) + { + constValue = constInt->getZExtValue(); + } + auto vrRangeIt = boundInfo->virtualRegisterRange.find(rightOperand); + if (vrRangeIt != boundInfo->virtualRegisterRange.end()) + { + double lowerBound, upperBound; + switch (bitWidth) + { + case 8: + lowerBound = constValue >> (static_cast(vrRangeIt->second.first)); + upperBound = constValue >> (static_cast(vrRangeIt->second.second)); + break; + case 16: + lowerBound = constValue >> (static_cast(vrRangeIt->second.first)); + upperBound = constValue >> (static_cast(vrRangeIt->second.second)); + break; + case 32: + lowerBound = constValue >> (static_cast(vrRangeIt->second.first)); + upperBound = constValue >> (static_cast(vrRangeIt->second.second)); + break; + case 64: + lowerBound = constValue >> (static_cast(vrRangeIt->second.first)); + upperBound = constValue >> (static_cast(vrRangeIt->second.second)); + break; + default: + assert(false); + } + boundInfo->virtualRegisterRange.emplace(llvmIrBinaryOperator, + std::make_pair(lowerBound, upperBound)); + } + else + { + assert(!valueRangeDebug && "failed to get range"); + break; + } + } + else if (!isa(leftOperand) && isa(rightOperand)) + { + /* + * eg. x>>2 + */ + int constValue = 1.0; + if (ConstantInt * constInt = llvm::dyn_cast(rightOperand)) + { + constValue = constInt->getZExtValue(); + } + auto vrRangeIt = boundInfo->virtualRegisterRange.find(leftOperand); + if (vrRangeIt != boundInfo->virtualRegisterRange.end()) + { + double resMin = 0, resMax = 0; + switch (bitWidth) + { + case 8: + resMin = (static_cast(vrRangeIt->second.first)) >> constValue; + resMax = (static_cast(vrRangeIt->second.second)) >> constValue; + break; + case 16: + resMin = (static_cast(vrRangeIt->second.first)) >> constValue; + resMax = (static_cast(vrRangeIt->second.second)) >> constValue; + break; + case 32: + resMin = (static_cast(vrRangeIt->second.first)) >> constValue; + resMax = (static_cast(vrRangeIt->second.second)) >> constValue; + break; + case 64: + resMin = (static_cast(vrRangeIt->second.first)) >> constValue; + resMax = (static_cast(vrRangeIt->second.second)) >> constValue; + break; + default: + assert(false); + } + boundInfo->virtualRegisterRange.emplace(llvmIrBinaryOperator, + std::make_pair(min(resMin, resMax), max(resMin, resMax))); } else { @@ -2503,7 +2857,8 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, if (uaIt != unionAddress.end()) { flexprint(N->Fe, N->Fm, N->Fpinfo, "\tStore Union: %f - %f\n", vrRangeIt->second.first, vrRangeIt->second.second); - boundInfo->virtualRegisterRange.emplace(uaIt->second, vrRangeIt->second); + if (nullptr != vrRangeIt->first) + boundInfo->virtualRegisterRange.emplace(uaIt->second, vrRangeIt->second); } } } @@ -2572,7 +2927,9 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, break; case Type::IntegerTyID: { - bool canGetRange = false; + bool canGetRange = false; + float f_originLow = (float)originLow; + float f_originHigh = (float)originHigh; switch (DestEleType->getIntegerBitWidth()) { case 8: @@ -2584,8 +2941,9 @@ rangeAnalysis(State * N, llvm::Function & llvmIrFunction, BoundInfo * boundInfo, highRange = static_cast(*reinterpret_cast(&originHigh)); break; case 32: - lowRange = static_cast(*reinterpret_cast(&originLow)); - highRange = static_cast(*reinterpret_cast(&originHigh)); + lowRange = static_cast(*reinterpret_cast(&f_originLow)); + highRange = static_cast(*reinterpret_cast(&f_originHigh)); + canGetRange = true; break; case 64: lowRange = static_cast(*reinterpret_cast(&originLow)); diff --git a/src/newton/newton-irPass-LLVMIR-simplifyControlFlowByRange.cpp b/src/newton/newton-irPass-LLVMIR-simplifyControlFlowByRange.cpp index 9326bf53e..d6daac232 100644 --- a/src/newton/newton-irPass-LLVMIR-simplifyControlFlowByRange.cpp +++ b/src/newton/newton-irPass-LLVMIR-simplifyControlFlowByRange.cpp @@ -49,101 +49,6 @@ enum CmpRes { Unsupported = 6, }; -CmpRes -compareFCmpConstWithVariableRange(FCmpInst * llvmIrFCmpInstruction, double variableLowerBound, double variableUpperBound, - double constValue) -{ - switch (llvmIrFCmpInstruction->getPredicate()) - { - case FCmpInst::FCMP_TRUE: - return CmpRes::AlwaysTrue; - case FCmpInst::FCMP_FALSE: - return CmpRes::AlwaysFalse; - /* - * Ordered means that neither operand is a QNAN while unordered means that either operand may be a QNAN. - * More details in https://llvm.org/docs/LangRef.html#fcmp-instruction - * */ - case FCmpInst::FCMP_OEQ: - case FCmpInst::FCMP_UEQ: - if ((variableLowerBound == variableUpperBound) && (variableUpperBound == constValue)) - { - return CmpRes::AlwaysTrue; - } - else - { - return CmpRes::AlwaysFalse; - } - case FCmpInst::FCMP_OGT: - case FCmpInst::FCMP_UGT: - if (variableLowerBound > constValue) - { - return CmpRes::AlwaysTrue; - } - else if (variableUpperBound <= constValue) - { - return CmpRes::AlwaysFalse; - } - else - { - return CmpRes::Depends; - } - case FCmpInst::FCMP_OGE: - case FCmpInst::FCMP_UGE: - if (variableLowerBound >= constValue) - { - return CmpRes::AlwaysTrue; - } - else if (variableUpperBound < constValue) - { - return CmpRes::AlwaysFalse; - } - else - { - return CmpRes::Depends; - } - case FCmpInst::FCMP_OLT: - case FCmpInst::FCMP_ULT: - if (variableUpperBound < constValue) - { - return CmpRes::AlwaysTrue; - } - else if (variableLowerBound >= constValue) - { - return CmpRes::AlwaysFalse; - } - else - { - return CmpRes::Depends; - } - case FCmpInst::FCMP_OLE: - case FCmpInst::FCMP_ULE: - if (variableUpperBound <= constValue) - { - return CmpRes::AlwaysTrue; - } - else if (variableLowerBound > constValue) - { - return CmpRes::AlwaysFalse; - } - else - { - return CmpRes::Depends; - } - case FCmpInst::FCMP_ONE: - case FCmpInst::FCMP_UNE: - if ((variableLowerBound == variableUpperBound) && (variableUpperBound != constValue)) - { - return CmpRes::AlwaysTrue; - } - else - { - return CmpRes::AlwaysFalse; - } - default: - return CmpRes::Unsupported; - } -} - CmpRes compareFCmpWithVariableRange(FCmpInst * llvmIrFCmpInstruction, double leftVariableLowerBound, double leftVariableUpperBound, @@ -162,14 +67,37 @@ compareFCmpWithVariableRange(FCmpInst * llvmIrFCmpInstruction, double leftVariab case FCmpInst::FCMP_OEQ: case FCmpInst::FCMP_UEQ: if ((leftVariableLowerBound == rightVariableLowerBound) && - (leftVariableUpperBound == rightVariableUpperBound)) + (rightVariableLowerBound == leftVariableUpperBound) && + (leftVariableUpperBound == rightVariableUpperBound)) { return CmpRes::AlwaysTrue; } - else - { - return CmpRes::AlwaysFalse; - } + else if (leftVariableLowerBound > rightVariableUpperBound || + leftVariableUpperBound < rightVariableLowerBound) + { + return CmpRes::AlwaysFalse; + } + else + { + return CmpRes::Depends; + } + case FCmpInst::FCMP_ONE: + case FCmpInst::FCMP_UNE: + if ((leftVariableUpperBound < rightVariableLowerBound) || + (leftVariableLowerBound > rightVariableUpperBound)) + { + return CmpRes::AlwaysTrue; + } + else if ((leftVariableLowerBound == rightVariableLowerBound) && + (rightVariableLowerBound == leftVariableUpperBound) && + (leftVariableUpperBound == rightVariableUpperBound)) + { + return CmpRes::AlwaysFalse; + } + else + { + return CmpRes::Depends; + } case FCmpInst::FCMP_OGT: case FCmpInst::FCMP_UGT: if (leftVariableLowerBound > rightVariableUpperBound) @@ -226,106 +154,6 @@ compareFCmpWithVariableRange(FCmpInst * llvmIrFCmpInstruction, double leftVariab { return CmpRes::Depends; } - case FCmpInst::FCMP_ONE: - case FCmpInst::FCMP_UNE: - if ((leftVariableUpperBound < rightVariableLowerBound) || - (leftVariableLowerBound > rightVariableUpperBound)) - { - return CmpRes::AlwaysTrue; - } - else - { - return CmpRes::AlwaysFalse; - } - default: - return CmpRes::Unsupported; - } -} - -CmpRes -compareICmpConstWithVariableRange(ICmpInst * llvmIrICmpInstruction, double variableLowerBound, double variableUpperBound, - double constValue) -{ - switch (llvmIrICmpInstruction->getPredicate()) - { - /* - * Ordered means that neither operand is a QNAN while unordered means that either operand may be a QNAN. - * More details in https://llvm.org/docs/LangRef.html#icmp-instruction - * */ - case ICmpInst::ICMP_EQ: - if ((variableLowerBound == variableUpperBound) && (variableUpperBound == constValue)) - { - return CmpRes::AlwaysTrue; - } - else - { - return CmpRes::AlwaysFalse; - } - case ICmpInst::ICMP_NE: - if ((variableLowerBound == variableUpperBound) && (variableUpperBound != constValue)) - { - return CmpRes::AlwaysTrue; - } - else - { - return CmpRes::AlwaysFalse; - } - case ICmpInst::ICMP_UGT: - case ICmpInst::ICMP_SGT: - if (variableLowerBound > constValue) - { - return CmpRes::AlwaysTrue; - } - else if (variableUpperBound <= constValue) - { - return CmpRes::AlwaysFalse; - } - else - { - return CmpRes::Depends; - } - case ICmpInst::ICMP_UGE: - case ICmpInst::ICMP_SGE: - if (variableLowerBound >= constValue) - { - return CmpRes::AlwaysTrue; - } - else if (variableUpperBound < constValue) - { - return CmpRes::AlwaysFalse; - } - else - { - return CmpRes::Depends; - } - case ICmpInst::ICMP_ULT: - case ICmpInst::ICMP_SLT: - if (variableUpperBound < constValue) - { - return CmpRes::AlwaysTrue; - } - else if (variableLowerBound >= constValue) - { - return CmpRes::AlwaysFalse; - } - else - { - return CmpRes::Depends; - } - case ICmpInst::ICMP_ULE: - case ICmpInst::ICMP_SLE: - if (variableUpperBound <= constValue) - { - return CmpRes::AlwaysTrue; - } - else if (variableLowerBound > constValue) - { - return CmpRes::AlwaysFalse; - } - else - { - return CmpRes::Depends; - } default: return CmpRes::Unsupported; } @@ -344,23 +172,35 @@ compareICmpWithVariableRange(ICmpInst * llvmIrICmpInstruction, double leftVariab * */ case ICmpInst::ICMP_EQ: if ((leftVariableLowerBound == rightVariableLowerBound) && + (rightVariableLowerBound == leftVariableUpperBound) && (leftVariableUpperBound == rightVariableUpperBound)) { return CmpRes::AlwaysTrue; } - else + else if (leftVariableLowerBound > rightVariableUpperBound || + leftVariableUpperBound < rightVariableLowerBound) { return CmpRes::AlwaysFalse; } + else + { + return CmpRes::Depends; + } case ICmpInst::ICMP_NE: if (leftVariableUpperBound < rightVariableLowerBound || leftVariableLowerBound > rightVariableUpperBound) { return CmpRes::AlwaysTrue; } - else + else if ((leftVariableLowerBound == rightVariableLowerBound) && + (rightVariableLowerBound == leftVariableUpperBound) && + (leftVariableUpperBound == rightVariableUpperBound)) { return CmpRes::AlwaysFalse; } + else + { + return CmpRes::Depends; + } case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_SGT: if (leftVariableLowerBound > rightVariableUpperBound) @@ -465,7 +305,9 @@ simplifyControlFlow(State * N, BoundInfo * boundInfo, Function & llvmIrFunction) auto rightOperand = llvmIrICmpInstruction->getOperand(1); if ((isa(leftOperand) && !isa(rightOperand))) { - std::swap(leftOperand, rightOperand); + llvmIrICmpInstruction->swapOperands(); + leftOperand = llvmIrICmpInstruction->getOperand(0); + rightOperand = llvmIrICmpInstruction->getOperand(1); flexprint(N->Fe, N->Fm, N->Fperr, "\tICmp: swap left and right, need to change the type of prediction\n"); } else if (isa(leftOperand) && isa(rightOperand)) @@ -537,10 +379,10 @@ simplifyControlFlow(State * N, BoundInfo * boundInfo, Function & llvmIrFunction) flexprint(N->Fe, N->Fm, N->Fpinfo, "\tICmp: varibale's lower bound: %f, upper bound: %f\n", vrRangeIt->second.first, vrRangeIt->second.second); - CmpRes compareResult = compareICmpConstWithVariableRange(llvmIrICmpInstruction, + CmpRes compareResult = compareICmpWithVariableRange(llvmIrICmpInstruction, vrRangeIt->second.first, vrRangeIt->second.second, - constValue); + constValue, constValue); flexprint(N->Fe, N->Fm, N->Fpinfo, "\tICmp: the comparison result is %d\n", compareResult); /* @@ -581,7 +423,7 @@ simplifyControlFlow(State * N, BoundInfo * boundInfo, Function & llvmIrFunction) auto rightOperand = llvmIrFCmpInstruction->getOperand(1); if ((isa(leftOperand) && !isa(rightOperand))) { - std::swap(leftOperand, rightOperand); + llvmIrFCmpInstruction->swapOperands(); flexprint(N->Fe, N->Fm, N->Fperr, "\tFCmp: swap left and right, need to change the type of prediction\n"); } else if (isa(leftOperand) && isa(rightOperand)) @@ -656,10 +498,10 @@ simplifyControlFlow(State * N, BoundInfo * boundInfo, Function & llvmIrFunction) flexprint(N->Fe, N->Fm, N->Fpinfo, "\tFCmp: varibale's lower bound: %f, upper bound: %f\n", vrRangeIt->second.first, vrRangeIt->second.second); - CmpRes compareResult = compareFCmpConstWithVariableRange(llvmIrFCmpInstruction, + CmpRes compareResult = compareFCmpWithVariableRange(llvmIrFCmpInstruction, vrRangeIt->second.first, vrRangeIt->second.second, - constValue); + constValue, constValue); flexprint(N->Fe, N->Fm, N->Fpinfo, "\tFCmp: the comparison result is %d\n", compareResult); /*