1 / 23

Strict Suboptions Ian McIntosh Toronto IBM Lab

Strict Suboptions Ian McIntosh Toronto IBM Lab. Agenda. Why Strict Suboptions Are Needed Overall Suboptions Design General Suboptions Detail Suboptions Examples Pragmas and Directives Interacting and Related Options Options Listing Q&A. Why Strict Suboptions Are Needed.

tarala
Download Presentation

Strict Suboptions Ian McIntosh Toronto IBM Lab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Strict SuboptionsIan McIntoshToronto IBM Lab

  2. Agenda • Why Strict Suboptions Are Needed • Overall Suboptions Design • General Suboptions • Detail Suboptions • Examples • Pragmas and Directives • Interacting and Related Options • Options Listing • Q&A

  3. Why Strict Suboptions Are Needed • Using nostrict allows many programs to run faster. • Using strict is sometimes necessary for correctness. • Some programs would run faster with nostrict for some compiler decisions but need strict for others. • nostrict-related problem investigation would be easier with more detailed controls.

  4. Overall Suboptions Design • Detail Level: • Some users want general high level controls, • other users need very specific low level controls, • so different views of the same controls are needed. • Hundreds of decisions are controlled by strict/nostrict, • so most suboptions will control groups of decisions. • Future versions may need even more detailed suboptions. • Constraints: • strict suboptions control the same things strict did. • Future versions may control more decisions, • so may need more suboptions. • As simple as will meet users’ needs.

  5. Overall Suboptions Design • -qstrict -- same as before • -qnostrict -- same as before • -qstrict=all -- same as -qstrict • -qstrict=none -- same as –qnostrict • -qstrict=X -- be strict about X(X is any strict suboption) • -qstrict=noX -- be relaxed about X • -qstrict=X:Y:Z -- be strict or relaxed about X, Y and Z • (X and/or Y and/or Z may have “no” prefix) • -qstrict=X\ -- be strict or relaxed about X, Y and Z-qstrict=Y:Z (X and/or Y and/or Z may have “no” prefix)

  6. General Suboptions • -qstrict=all -- be strict or • -qstrict=none -- relaxed about all changes • -qstrict=precision -- be strict or • -qstrict=noprecision-- relaxed about changing precision • -qstrict=exceptions -- be strict or • -qstrict=noexceptions -- relaxed about changing exceptions (whether more or less or moved) • [no]exceptions does not control everything that could produce different results, so different exceptions are possible even with –qstrict=noexceptions. • Each general suboption controls decisions itself,and also controls nested suboptions.

  7. General Suboptions • -qstrict=ieeefp -- be strict or • -qstrict=noieeefp -- relaxed about violating IEEE 754 • [no]ieeefp controls individual operations defined by IEEE 754, not how operations interact or are ordered. • Detail suboptions allow controlling specific aspects of [no]ieeefp.Most operations are affected by multiple detail suboptions, and also by [no]exceptions. • -qstrict=order -- be strict or • -qstrict=noorder -- relaxed about operation order • [no]order controls the order between operations, as defined by language semantics, not how each operation is implemented. • Detail suboptions allow controlling specific aspects of [no]order.

  8. Detail Suboptions – ieeefp group • -qstrict=nans -- be strict or • -qstrict=nonans -- relaxed about calculations with NaNs eg, x+0. => x is wrong if x is a NaN • -qstrict=infinities -- be strict or • -qstrict=noinfinities -- relaxed about calculations with infinities eg, x*0. => 0. is wrong if x is an infinity • -qstrict=subnormals -- be strict or • -qstrict=nosubnormals -- relaxed about calculations with subnormals eg, x/10. => x*.1 overflows if x is subnormal • -qstrict=zerosigns -- be strict or • -qstrict=nozerosigns -- relaxed about calculations with sign of zero eg, (-a)-b*c => –(a+b*c) may give the wrong zero • -qstrict=operationprecision -- be strict or • -qstrict=nooperationprecision-- relaxed about operation precision eg,x/5. => x*.2 is not precise Most operations need more than one of these; some also need noexceptions.

  9. Detail Suboptions – order group • -qstrict=association -- be strict or • -qstrict=noassociation -- relaxed about changing association order • eg, a+b+c, (a+b)+c, a+(b+c), (a+c)+b may give different results • -qstrict=reductionorder -- be strict or • -qstrict=noreductionorder -- relaxed about reductions like dot product changing the order of evaluation (and hence the order of rounding) • -qstrict=guards -- be strict or • -qstrict=noguards -- relaxed about moving variable use past if / for / while / call eg, if(k>=0) x=y[k] => t=y[k]; if(k>=0) x=t is faster but risky if k is not a valid subscript

  10. Detail Suboptions – miscellaneous • -qstrict=library -- be strict or • -qstrict=nolibrary -- relaxed about replacing library functions • eg, libm sin(x) => MASS sin(x) may give different results • -qstrict=constructcopy -- be strict or • -qstrict=noconstructcopy -- relaxed about constructing Fortran REAL arrays via a temporary array to ensure atomic construction or not in case of exceptions

  11. Suboption Grouping • all and none include: • everything. • precision includes: • subnormals, operationprecision, association, reductionorder, library, • and controls some things itself. • exceptions includes: • nans, infinities, subnormals, guards, library, constructcopy, • and controls some things itself. • ieeefp includes: • nans, infinities, subnormals, zerosigns, operationprecision. • order includes: • association, reductionorder, guards.

  12. Examples • -qstrict=all:nooperationprecision:noreductionorder • Be strict about everything, • except relaxed about operationprecision, part of what’s needed to allowx / loop_constant => x * (1 / loop_constant),which is needed to allow faster MOD(note this allows other changes too), • and relaxed about reductionorder, to allow recognizing dot product and similar reductions and generating faster parallelized code, without allowing other reordering.

  13. Examples

  14. Examples dp = 0. do i = 1, n dp = dp + a(i) * b(i) end do

  15. Examples

  16. Pragmas and Directives • XL C/C++ #pragma option_override • #pragma option_override (fname,"opt(strict,all,noreductionorder)") • XLF @PROCESS directive • @PROCESS STRICT(ALL, NOREDUCTIONORDER) These allow: • Putting required suboptions in the source file. • Having suboptions control specific functions or subroutinesinstead of everything in all the files compiled together.

  17. Interacting Options • -qstrict sets –qfloat=nofltint • -qnostrict sets –qfloat=fltintso do –qstrict=[no]operationprecision or/and [no]exceptions • -qstrict sets –qfloat=norsqrt • -qnostrict sets –qfloat=rsqrtso do –qstrict=[no]infinities or/and [no]operationprecision or/and [no]exceptions • -qstrict sets –qfloat=rngchkso do –qstrict=[no]nans or [no]infinities or [no]zerosignsor [no]exceptions • -qfloat=relaxaffects some of the same things as –qstrict=noieeefp

  18. Related Options • Other options which strict/nostrict users may have some interest in: -qsmp • -qfloat=maf-qessl • -qfloat=strictnmaf-qhot=vector • -qfloat=rndsngl-qhot=simd • -qfloat=hsflt-qenablevmx • -qfloat=hscmplx (xlf) -qalias=… • -qfloat=hssngl-qassert=… (xlf) • -qfloat=single (xlf) -qxlf90=signedzero (xlf) • -qfloat=fltint-qxlf2003=signdzerointr (xlf) • -qfloat=nans-qstrictieeemod (xlf) • -qfloat=spnans-qport=sce (xlf) • -qfloat=rrm-qswapomp (xlf) • -qstrict_induction-qfloat=fenv (xlf)

  19. Options Listing • -qstrict => STRICT (as before) • -qnostrict => NOSTRICT (as before) • -qstrict=all => STRICT=ALL • -qstrict=none => STRICT=NONE • -qstrict=X:Y => STRICT=[ALL|NONE]:X:Y:all “no” suboptions • -qlistopt => STRICT=all strict suboptions • Fortran listing syntax is STRICT(X,Y,Z) not STRICT=X:Y:Z. • With –qsaveopt, options are also put in the object file.

  20. Questions and Answers

More Related