1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803
|
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8298935
* @summary Test forced vectorization, and check IR for vector instructions
* @requires vm.compiler2.enabled
* @library /test/lib /
* @run driver compiler.vectorization.TestOptionVectorizeIR
*/
package compiler.vectorization;
import compiler.lib.ir_framework.*;
public class TestOptionVectorizeIR {
static int RANGE = 1024*2;
static int ITER = 100;
int[] gold1 = new int[RANGE];
int[] gold2 = new int[RANGE];
int[] gold3 = new int[RANGE];
int[] gold4 = new int[RANGE];
int[] gold5 = new int[RANGE];
int[] gold6 = new int[RANGE];
long[] gold10 = new long[RANGE];
long[] gold11 = new long[RANGE];
long[] gold12 = new long[RANGE];
long[] gold13 = new long[RANGE];
short[] gold20 = new short[RANGE];
short[] gold21 = new short[RANGE];
short[] gold22 = new short[RANGE];
short[] gold23 = new short[RANGE];
byte[] gold30 = new byte[RANGE];
byte[] gold31 = new byte[RANGE];
byte[] gold32 = new byte[RANGE];
byte[] gold33 = new byte[RANGE];
char[] gold40 = new char[RANGE];
char[] gold41 = new char[RANGE];
char[] gold42 = new char[RANGE];
char[] gold43 = new char[RANGE];
float[] gold50 = new float[RANGE];
float[] gold51 = new float[RANGE];
float[] gold52 = new float[RANGE];
float[] gold53 = new float[RANGE];
double[] gold60 = new double[RANGE];
double[] gold61 = new double[RANGE];
double[] gold62 = new double[RANGE];
double[] gold63 = new double[RANGE];
public static void main(String args[]) {
TestFramework.runWithFlags("-XX:CompileCommand=option,compiler.vectorization.TestOptionVectorizeIR::test*,Vectorize");
}
TestOptionVectorizeIR() {
// compute the gold standard in interpreter mode
// test1
test1(gold1);
// test2
test1(gold2);
test2(gold2);
// test3
test1(gold3);
test3(gold3, 2, 3);
// test4
test1(gold4);
test4(gold4);
// test5
test1(gold5);
test5(gold5);
// test6
test1(gold6);
test6(gold6);
// long
init(gold10);
test10(gold10);
init(gold11);
test11(gold11);
init(gold12);
test12(gold12);
init(gold13);
test13(gold13);
// short
init(gold20);
test20(gold20);
init(gold21);
test21(gold21);
init(gold22);
test22(gold22);
init(gold23);
test23(gold23);
// byte
init(gold30);
test30(gold30);
init(gold31);
test31(gold31);
init(gold32);
test32(gold32);
init(gold33);
test33(gold33);
// char
init(gold40);
test40(gold40);
init(gold41);
test41(gold41);
init(gold42);
test42(gold42);
init(gold43);
test43(gold43);
// float
init(gold50);
test50(gold50);
init(gold51);
test51(gold51);
init(gold52);
test52(gold52);
init(gold53);
test53(gold53);
// double
init(gold60);
test60(gold60);
init(gold61);
test61(gold61);
init(gold62);
test62(gold62);
init(gold63);
test63(gold63);
}
@Run(test = "test1")
@Warmup(100)
public void runTest1() {
int[] data = new int[RANGE];
test1(data);
verify("test1", data, gold1);
}
@Run(test = "test2")
@Warmup(100)
public void runTest2() {
int[] data = new int[RANGE];
test1(data);
test2(data);
verify("test2", data, gold2);
}
@Run(test = "test3")
@Warmup(100)
public void runTest3() {
int[] data = new int[RANGE];
test1(data);
test3(data, 2, 3);
verify("test3", data, gold3);
}
@Run(test = "test4")
@Warmup(100)
public void runTest4() {
int[] data = new int[RANGE];
test1(data);
test4(data);
verify("test4", data, gold4);
}
@Run(test = "test5")
@Warmup(100)
public void runTest5() {
int[] data = new int[RANGE];
test1(data);
test5(data);
verify("test5", data, gold5);
}
@Run(test = "test6")
@Warmup(100)
public void runTest6() {
int[] data = new int[RANGE];
test1(data);
test6(data);
verify("test6", data, gold6);
}
@Test
static void test1(int[] data) {
for (int j = 0; j < RANGE; j++) {
// Vectorizes even if it is not forced
data[j] = j;
}
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", IRNode.ADD_VI, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test2(int[] data) {
for (int j = 0; j < RANGE - 1; j++) {
// Only vectorizes if forced, because of offset by 1
data[j] = data[j] + data[j + 1];
}
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", IRNode.REPLICATE_I, "> 0", IRNode.ADD_VI, "> 0", IRNode.MUL_VI, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test3(int[] data, int A, int B) {
for (int j = 0; j < RANGE - 1; j++) {
// Only vectorizes if forced, because of offset by 1
data[j] = A * data[j] + B * data[j + 1];
}
}
@Test
static void test4(int[] data) {
for (int j = 0; j < RANGE - 1; j++) {
// write forward -> cyclic dependency -> cannot vectorize
// independent(s1, s2) for adjacent loads should detect this
data[j + 1] = data[j];
}
}
@Test
static void test5(int[] data) {
for (int j = 0; j < RANGE - 3; j++) {
// write forward -> cyclic dependency -> cannot vectorize
// independent(s1, s2) for adjacent loads cannot detect this
// Checks with memory_alignment are disabled via compile option
data[j + 2] = data[j];
}
}
@Test
static void test6(int[] data) {
for (int j = 0; j < RANGE - 3; j++) {
// write forward -> cyclic dependency -> cannot vectorize
// independent(s1, s2) for adjacent loads cannot detect this
// Checks with memory_alignment are disabled via compile option
data[j + 3] = data[j];
}
}
// ------------------------- Long -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR_L, "> 0", IRNode.ADD_VL, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test10(long[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 2];
}
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR_L, "> 0", IRNode.ADD_VL, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test11(long[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 1];
}
}
@Test
static void test12(long[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 1];
}
}
@Test
static void test13(long[] data) {
// 128-bit vectors -> can vectorize because only 2 elements
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 2];
}
}
@Run(test = "test10")
@Warmup(100)
public void runTest10() {
long[] data = new long[RANGE];
init(data);
test10(data);
verify("test10", data, gold10);
}
@Run(test = "test11")
@Warmup(100)
public void runTest11() {
long[] data = new long[RANGE];
init(data);
test11(data);
verify("test11", data, gold11);
}
@Run(test = "test12")
@Warmup(100)
public void runTest12() {
long[] data = new long[RANGE];
init(data);
test12(data);
verify("test12", data, gold12);
}
@Run(test = "test13")
@Warmup(100)
public void runTest13() {
long[] data = new long[RANGE];
init(data);
test13(data);
verify("test13", data, gold13);
}
// ------------------------- Short -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR_S, "> 0", IRNode.ADD_VS, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test20(short[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 2];
}
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR_S, "> 0", IRNode.ADD_VS, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test21(short[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 1];
}
}
@Test
static void test22(short[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 1];
}
}
@Test
static void test23(short[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 2];
}
}
@Run(test = "test20")
@Warmup(100)
public void runTest20() {
short[] data = new short[RANGE];
init(data);
test20(data);
verify("test20", data, gold20);
}
@Run(test = "test21")
@Warmup(100)
public void runTest21() {
short[] data = new short[RANGE];
init(data);
test21(data);
verify("test21", data, gold21);
}
@Run(test = "test22")
@Warmup(100)
public void runTest22() {
short[] data = new short[RANGE];
init(data);
test22(data);
verify("test22", data, gold22);
}
@Run(test = "test23")
@Warmup(100)
public void runTest23() {
short[] data = new short[RANGE];
init(data);
test23(data);
verify("test23", data, gold23);
}
// ------------------------- Byte -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", IRNode.ADD_VB, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test30(byte[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 2];
}
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", IRNode.ADD_VB, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test31(byte[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 1];
}
}
@Test
static void test32(byte[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 1];
}
}
@Test
static void test33(byte[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 2];
}
}
@Run(test = "test30")
@Warmup(100)
public void runTest30() {
byte[] data = new byte[RANGE];
init(data);
test30(data);
verify("test30", data, gold30);
}
@Run(test = "test31")
@Warmup(100)
public void runTest31() {
byte[] data = new byte[RANGE];
init(data);
test31(data);
verify("test31", data, gold31);
}
@Run(test = "test32")
@Warmup(100)
public void runTest32() {
byte[] data = new byte[RANGE];
init(data);
test32(data);
verify("test32", data, gold32);
}
@Run(test = "test33")
@Warmup(100)
public void runTest33() {
byte[] data = new byte[RANGE];
init(data);
test33(data);
verify("test33", data, gold33);
}
// ------------------------- Char -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR_C, "> 0", IRNode.ADD_VS, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test40(char[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 2];
}
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR_C, "> 0", IRNode.ADD_VS, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test41(char[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 1];
}
}
@Test
static void test42(char[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 1];
}
}
@Test
static void test43(char[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 2];
}
}
@Run(test = "test40")
@Warmup(100)
public void runTest40() {
char[] data = new char[RANGE];
init(data);
test40(data);
verify("test40", data, gold40);
}
@Run(test = "test41")
@Warmup(100)
public void runTest41() {
char[] data = new char[RANGE];
init(data);
test41(data);
verify("test41", data, gold41);
}
@Run(test = "test42")
@Warmup(100)
public void runTest42() {
char[] data = new char[RANGE];
init(data);
test42(data);
verify("test42", data, gold42);
}
@Run(test = "test43")
@Warmup(100)
public void runTest43() {
char[] data = new char[RANGE];
init(data);
test43(data);
verify("test43", data, gold43);
}
// ------------------------- Float -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR_F, "> 0", IRNode.ADD_VF, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test50(float[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 2];
}
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR_F, "> 0", IRNode.ADD_VF, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test51(float[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 1];
}
}
@Test
static void test52(float[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 1];
}
}
@Test
static void test53(float[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 2];
}
}
@Run(test = "test50")
@Warmup(100)
public void runTest50() {
float[] data = new float[RANGE];
init(data);
test50(data);
verify("test50", data, gold50);
}
@Run(test = "test51")
@Warmup(100)
public void runTest51() {
float[] data = new float[RANGE];
init(data);
test51(data);
verify("test51", data, gold51);
}
@Run(test = "test52")
@Warmup(100)
public void runTest52() {
float[] data = new float[RANGE];
init(data);
test52(data);
verify("test52", data, gold52);
}
@Run(test = "test53")
@Warmup(100)
public void runTest53() {
float[] data = new float[RANGE];
init(data);
test53(data);
verify("test53", data, gold53);
}
// ------------------------- Double -----------------------------
@Test
@IR(counts = {IRNode.LOAD_VECTOR_D, "> 0", IRNode.ADD_VD, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test60(double[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 2];
}
}
@Test
@IR(counts = {IRNode.LOAD_VECTOR_D, "> 0", IRNode.ADD_VD, "> 0", IRNode.STORE_VECTOR, "> 0"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true", "rvv", "true"})
static void test61(double[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j + 1];
}
}
@Test
static void test62(double[] data) {
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 1];
}
}
@Test
static void test63(double[] data) {
// 128-bit vectors -> can vectorize because only 2 elements
for (int j = 2; j < RANGE - 2; j++) {
data[j] += data[j - 2];
}
}
@Run(test = "test60")
@Warmup(100)
public void runTest60() {
double[] data = new double[RANGE];
init(data);
test60(data);
verify("test60", data, gold60);
}
@Run(test = "test61")
@Warmup(100)
public void runTest61() {
double[] data = new double[RANGE];
init(data);
test61(data);
verify("test61", data, gold61);
}
@Run(test = "test62")
@Warmup(100)
public void runTest62() {
double[] data = new double[RANGE];
init(data);
test62(data);
verify("test62", data, gold62);
}
@Run(test = "test63")
@Warmup(100)
public void runTest63() {
double[] data = new double[RANGE];
init(data);
test63(data);
verify("test63", data, gold63);
}
static void init(long[] data) {
for (int j = 0; j < RANGE; j++) {
data[j] = j;
}
}
static void init(short[] data) {
for (int j = 0; j < RANGE; j++) {
data[j] = (short)j;
}
}
static void init(byte[] data) {
for (int j = 0; j < RANGE; j++) {
data[j] = (byte)j;
}
}
static void init(char[] data) {
for (int j = 0; j < RANGE; j++) {
data[j] = (char)j;
}
}
static void init(float[] data) {
for (int j = 0; j < RANGE; j++) {
data[j] = j;
}
}
static void init(double[] data) {
for (int j = 0; j < RANGE; j++) {
data[j] = j;
}
}
static void verify(String name, int[] data, int[] gold) {
for (int i = 0; i < RANGE; i++) {
if (data[i] != gold[i]) {
throw new RuntimeException(" Invalid " + name + " result: data[" + i + "]: " + data[i] + " != " + gold[i]);
}
}
}
static void verify(String name, long[] data, long[] gold) {
for (int i = 0; i < RANGE; i++) {
if (data[i] != gold[i]) {
throw new RuntimeException(" Invalid " + name + " result: data[" + i + "]: " + data[i] + " != " + gold[i]);
}
}
}
static void verify(String name, short[] data, short[] gold) {
for (int i = 0; i < RANGE; i++) {
if (data[i] != gold[i]) {
throw new RuntimeException(" Invalid " + name + " result: data[" + i + "]: " + data[i] + " != " + gold[i]);
}
}
}
static void verify(String name, byte[] data, byte[] gold) {
for (int i = 0; i < RANGE; i++) {
if (data[i] != gold[i]) {
throw new RuntimeException(" Invalid " + name + " result: data[" + i + "]: " + data[i] + " != " + gold[i]);
}
}
}
static void verify(String name, char[] data, char[] gold) {
for (int i = 0; i < RANGE; i++) {
if (data[i] != gold[i]) {
throw new RuntimeException(" Invalid " + name + " result: data[" + i + "]: " + data[i] + " != " + gold[i]);
}
}
}
static void verify(String name, float[] data, float[] gold) {
for (int i = 0; i < RANGE; i++) {
if (data[i] != gold[i]) {
throw new RuntimeException(" Invalid " + name + " result: data[" + i + "]: " + data[i] + " != " + gold[i]);
}
}
}
static void verify(String name, double[] data, double[] gold) {
for (int i = 0; i < RANGE; i++) {
if (data[i] != gold[i]) {
throw new RuntimeException(" Invalid " + name + " result: data[" + i + "]: " + data[i] + " != " + gold[i]);
}
}
}
}
|