Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!uw-beaver!sumax!polari!thebes!happym!nwnexus!golder From: golder@nwnexus.WA.COM (Warren Jones) Newsgroups: comp.unix.aix Subject: XLF optimizer unreliable, inappropriate for benchmarks Keywords: fortran benchmark optimizer aix 6000 Message-ID: <384@nwnexus.WA.COM> Date: 19 Sep 90 21:06:16 GMT Organization: Golder Associates Lines: 166 Thanks to ichihara@rkna50.riken.go.jp (Takashi Ichihara) for posting detailed benchmark results for the Power Station 530. However, until the XLF optimizer can be trusted, realistic benchmarks should be compiled with optimization OFF. It doesn't matter how fast the machine is if the results are wrong. I'm including a short fortran program that demonstrates an optimizer bug that one of our applications people discovered. For the time being, I will not use the optimizer, period. It's not worth the grief. Incidentally -- does anyone know if all the XL languages (including C and Pascal) use the same optimizer? Until I'm sure of the answer, I'm not using the C optimizer either. ------------------------ cut here --------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # README # bug.f # Makefile # bugdemo # This archive created: Wed Sep 19 12:54:26 1990 export PATH; PATH=/bin:$PATH echo shar: extracting "'README'" '(884 characters)' if test -f 'README' then echo shar: will not over-write existing file "'README'" else sed 's/^X//' << \SHAR_EOF > 'README' X XThis is a test program that demonstrates a bug in the XLF fortran Xcompiler under AIX 3.1. The applications programmer who discovered Xthe problem has tried a number of variations, and this code seems to Xbe the minimum required to reproduce the bug in a predictable manner. X XIBM problem number: 1X991 X XWe are running AIX 3.1 on a RISC6000-530. XHere is some version information produced by "lslpp -h": X XOption Name State Event Date/Time Release User Name X-------------------- ---------- ---------- --------- --------------- ---------- Xxlfcmp.obj ACTIVE COMMIT 07/14/90 01.01.0000.0000 root Xxlfrte.obj ACTIVE COMMIT 07/14/90 01.01.0000.0000 root X XWarren Jones Sept 5, 1990 XGolder Associates Inc. X4104 148th Ave NE (206) 883-0777 XRedmond, WA 98052 email: golder@nwnexus.wa.com X SHAR_EOF if test 884 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 884 characters)' fi fi # end of overwriting check echo shar: extracting "'bug.f'" '(1017 characters)' if test -f 'bug.f' then echo shar: will not over-write existing file "'bug.f'" else sed 's/^X//' << \SHAR_EOF > 'bug.f' Xc----------------------------------------------------------------- X program bug Xc Xc This code demonstrates an optimizer bug in the XLF fortran Xc compiler under AIX 3.1. It seems to be the minimum required Xc to reproduce the bug in a predictable manner. Compile with and Xc without the XLF optimizer turned on, and compare the results. Xc Xc Warren Jones Sept 5, 1990 Xc Golder Associates Inc. Xc 4104 148th Ave NE (206) 883-0777 Xc Redmond, WA 98052 email: golder@nwnexus.wa.com Xc----------------------------------------------------------------- X X integer*4 b, i, k, m, n X logical*4 test Xc X test = .true. X m = 0 X k = 0 X i = 0 Xc X 10 continue X i = i + 1 X if (test) then X do 2 n = 1, 3 X m = m + 1 X k = k + 1 X b = k + 1 X 2 continue X write (*,'(a,i6)')' k = ',k X write (*,'(a,i6)')' k - 1 = ',k - 1 X end if X if (i .lt. 2) goto 10 Xc X stop X end X SHAR_EOF if test 1017 -ne "`wc -c < 'bug.f'`" then echo shar: error transmitting "'bug.f'" '(should have been 1017 characters)' fi fi # end of overwriting check echo shar: extracting "'Makefile'" '(223 characters)' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else sed 's/^X//' << \SHAR_EOF > 'Makefile' X#! /bin/make -f X# X# Makefile to demonstrate an optimizer bug X# in the XLF fortran compiler under AIX 3.1. X Xbug.out : bug nobug X bugdemo 2>&1 | tee bug.out X Xbug : bug.f X xlf -O -o $@ bug.f X Xnobug : bug.f X xlf -o $@ bug.f X SHAR_EOF if test 223 -ne "`wc -c < 'Makefile'`" then echo shar: error transmitting "'Makefile'" '(should have been 223 characters)' fi fi # end of overwriting check echo shar: extracting "'bugdemo'" '(100 characters)' if test -f 'bugdemo' then echo shar: will not over-write existing file "'bugdemo'" else sed 's/^X//' << \SHAR_EOF > 'bugdemo' X#! /bin/sh X Xecho Xecho "NOBUG (Optimization OFF)"; nobug X Xecho Xecho "BUG (Optimization ON) "; bug X SHAR_EOF if test 100 -ne "`wc -c < 'bugdemo'`" then echo shar: error transmitting "'bugdemo'" '(should have been 100 characters)' fi chmod +x 'bugdemo' fi # end of overwriting check # End of shell archive exit 0 -- ---------------------------------------------------------------- Warren Jones Golder Associates Inc. (uucp: uunet!nwnexus!golder) 4104 148th Avenue NE (206) 883-0777 Redmond, WA 98052, USA