Commit Graph

158 Commits

Author SHA1 Message Date
Field G. Van Zee
37e55ca39b Fixed obscure 3m1/4m1a bugs in trmm[3] and trsm.
Details:
- Fixed a family of bugs in the triangular level-3 operations for
  certain complex implementations (3m1 and 4m1a) that only manifest if
  one of the register blocksizes (PACKMR/PACKNR, actually) is odd:
  - Fixed incorrect imaginary stride computation in bli_packm_blk_var2()
    for the triangular case.
  - Fixed the incorrect computation of imaginary stride, as stored in
    the auxinfo_t struct in trmm and trsm macro-kernels.
  - Fixed incorrect pointer arithmetic in the trsm macro-kernels in the
    cases where the the register blocksize for the triangular matrix is
    odd. Introduced a new byte-granular pointer arithmetic macro,
    bli_ptr_add(), that computes the correct value.
- Added cpp macro to bli_macro_defs.h for typeof() operator, defined in
  terms of __typeof__, which is used by bli_ptr_add() macro.
- Disabled the row- vs. column-storage optimization in bli_trmm_front()
  for singleton problems because the inherent ambiguity of whether a
  scalar is row-stored or column-stored causes the wrong parameter
  combination code to be executed (by dumb luck of our checking for
  row storage first).
- Added commented-out debugging lines to 3m1/4m1a and reference
  micro-kernels, and trsm_ll macro-kernel.
2015-10-30 18:25:04 -05:00
Field G. Van Zee
77ddb0b1d3 Removed flop-counting mechanism.
Details:
- Removed the optional flop-counting feature introduced in commit
  7574c994.
2015-10-13 12:53:06 -05:00
Field G. Van Zee
e2e9d64a63 Load balance thread ranges for arbitrary diagonals.
Details:
- Expanded/updated interface for bli_get_range_weighted() and
  bli_get_range() so that the direction of movement is specified in the
  function name (e.g. bli_get_range_l2r(), bli_get_range_weighted_t2b())
  and also so that the object being partitioned is passed instead of an
  uplo parameter. Updated invocations in level-3 blocked variants, as
  appropriate.
- (Re)implemented bli_get_range_*() and bli_get_range_weighted_*() to
  carefully take into account the location of the diagonal when computing
  ranges so that the area of each subpartition (which, in all present
  level-3 operations, is proportional to the amount of computation
  engendered) is as equal as possible.
- Added calls to a new class of routines to all non-gemm level-3 blocked
  variants:
    bli_<oper>_prune_unref_mparts_[mnk]()
  where <oper> is herk, trmm, or trsm and [mnk] is chosen based on which
  dimension is being partitioned. These routines call a more basic
  routine, bli_prune_unref_mparts(), to prune unreferenced/unstored
  regions from matrices and simultaneously adjust other matrices which
  share the same dimension accordingly.
- Simplified herk_blk_var2f, trmm_blk_var1f/b as a result of more the
  new pruning routines.
- Fixed incorrect blocking factors passed into bli_get_range_*() in
  bli_trsm_blk_var[12][fb].c
- Added a new test driver in test/thread_ranges that can exercise the new
  bli_get_range_*() and bli_get_range_weighted_*() under a range of
  conditions.
- Reimplemented m and n fields of obj_t as elements in a "dim"
  array field so that dimensions could be queried via index constant
  (e.g. BLIS_M, BLIS_N). Adjusted/added query and modification
  macros accordingly.
- Defined mdim_t type to enumerate BLIS_M and BLIS_N indexing values.
- Added bli_round() macro, which calls C math library function round(),
  and bli_round_to_mult(), which rounds a value to the nearest multiple
  of some other value.
- Added miscellaneous pruning- and mdim_t-related macros.
- Renamed bli_obj_row_offset(), bli_obj_col_offset() macros to
  bli_obj_row_off(), bli_obj_col_off().
2015-09-24 12:14:03 -05:00
Field G. Van Zee
4dd9dd3e1d Fixed minor alignment ambiguity bug in bli_pool.c.
Details:
- Fixed a typecasting ambiguity in bli_pool_alloc_block() in which
  pointer arithmetic was performed on a void* as if it were a byte
  pointer (such as char*). Some compilers may have already been
  interpreting this situation as intended, despite the sloppiness.
  Thanks to Aleksei Rechinskii for reporting this issue.
- Redefined pointer alignment macros to typecast to uintptr_t instead of
  siz_t.
2015-08-21 11:52:37 -05:00
Field G. Van Zee
7cd01b71b5 Implemented dynamic allocation for packing buffers.
Details:
- Replaced the old memory allocator, which was based on statically-
  allocated arrays, with one based on a new internal pool_t type, which,
  combined with a new bli_pool_*() API, provides a new abstract data
  type that implements the same memory pool functionality but with blocks
  from the heap (ie: malloc() or equivalent). Hiding the details of the
  pool in a separate API also allows for a much simpler bli_mem.c family
  of functions.
- Added a new internal header, bli_config_macro_defs.h, which enables
  sane defaults for the values previously found in bli_config. Those
  values can be overridden by #defining them in bli_config.h the same
  way kernel defaults can be overridden in bli_kernel.h. This file most
  resembles what was previously a typical configuration's bli_config.h.
- Added a new configuration macro, BLIS_POOL_ADDR_ALIGN_SIZE, which
  defaults to BLIS_PAGE_SIZE, to specify the alignment of individual
  blocks in the memory pool. Also added a corresponding query routine to
  the bli_info API.
- Deprecated (once again) the micro-panel alignment feature. Upon further
  reflection, it seems that the goal of more predictable L1 cache
  replacement behavior is outweighed by the harm caused by non-contiguous
  micro-panels when k % kc != 0. I honestly don't think anyone will even
  miss this feature.
- Changed bli_ukr_get_funcs() and bli_ukr_get_ref_funcs() to call
  bli_cntl_init() instead of bli_init().
- Removed query functions from bli_info.c that are no longer applicable
  given the dynamic memory allocator.
- Removed unnecessary definitions from configurations' bli_config.h files,
  which are now pleasantly sparse.
- Fixed incorrect flop counts in addv, subv, scal2v, scal2m testsuite
  modules. Thanks to Devangi Parikh for pointing out these
  miscalculations.
- Comment, whitespace changes.
2015-06-19 11:31:53 -05:00
Field G. Van Zee
ee129c6b02 Fixed bugs in _get_range(), _get_range_weighted().
Details:
- Fixed some bugs that only manifested in multithreaded instances of
  some (non-gemm) level-3 operations. The bugs were related to invalid
  allocation of "edge" cases to thread subpartitions. (Here, we define
  an "edge" case to be one where the dimension being partitioned for
  parallelism is not a whole multiple of whatever register blocksize
  is needed in that dimension.) In BLIS, we always require edge cases
  to be part of the bottom, right, or bottom-right subpartitions.
  (This is so that zero-padding only has to happen at the bottom, right,
  or bottom-right edges of micro-panels.) The previous implementations
  of bli_get_range() and _get_range_weighted() did not adhere to this
  implicit policy and thus produced bad ranges for some combinations of
  operation, parameter cases, problem sizes, and n-way parallelism.
- As part of the above fix, the functions bli_get_range() and
  _get_range_weighted() have been renamed to use _l2r, _r2l, _t2b,
  and _b2t suffixes, similar to the partitioning functions. This is
  an easy way to make sure that the variants are calling the right
  version of each function. The function signatures have also been
  changed slightly.
- Comment/whitespace updates.
- Removed unnecessary '/' from macros in bli_obj_macro_defs.h.
2015-06-10 12:53:28 -05:00
Field G. Van Zee
b6ee82a3d4 Minor cleanup to bli_init() and friends.
Details:
- Spun-off initialization of global scalar constants to bli_const_init()
  and of threading stuff to bli_thread_init().
- Added some missing _finalize() functions, even when there is nothing
  to do.
2015-06-03 12:14:23 -05:00
Field G. Van Zee
26a4b8f6f9 Implemented 3m2, 3m3 induced algorithms (gemm only).
Details:
- Defined a new "3ms" (separated 3m) pack schema and added appropriate
  support in packm_init(), packm_blk_var2().
- Generalized packm_struc_cxk_3mi to take the imaginary stride (is_p)
  as an argument instead of computing it locally. Exception: for trmm,
  is_p must be computed locally, since it changes for triangular
  packed matrices. Also exposed is_p in interface to dt-specific
  packm_blk_var2 (and _var1, even though it does not use imaginary
  stride).
- Renamed many functions/variables from _3mi to _3mis to indicate that
  they work for either interleaved or separated 3m pack schemas.
- Generalized gemm and herk macro-kernels to pass in imaginary stride
  rather than compute them locally.
- Added support for 3m2 and 3m3 algorithms to frame/ind, including 3m2-
  and 3m3-specific virtual micro-kernels.
- Added special gemm macro-kernels to support 3m2 and 3m3.
- Added support for 3m2 and 3m3 to testsuite.
- Corrected the type of the panel dimension (pd_) in various macro-
  kernels from inc_t to dim_t.
- Renamed many functions defined in bli_blocksize.c.
- Moved most induced-related macro defs from frame/include to
  frame/ind/include.
- Updated the _ukernel.c files so that the micro-kernel function pointers
  are obtained from the func_t objects rather than the cpp macros that
  define the function names.
- Updated test/3m4m driver, Makefile, and run script.
2015-04-01 10:44:54 -05:00
Field G. Van Zee
f1a6b7d028 Reorganized code for induced complex methods.
Details:
- Consolidated most of the code relating to induced complex methods
  (e.g. 4mh, 4m1, 3mh, 3m1, etc.) into frame/ind. Induced methods
  are now enabled on a per-operation basis. The current "available"
  (enabled and implemented) implementation can then be queried on
  an operation basis. Micro-kernel func_t objects as well as blksz_t
  objects can also be queried in a similar maner.
- Redefined several micro-kernel and operation-related functions in
  bli_info_*() API, in accordance with above changes.
- Added mr and nr fields to blksz_t object, which point to the mr
  and nr blksz_t objects for each cache blocksize (and are NULL for
  register blocksizes). Renamed the sub-blocksize field "sub" to
  "mult" since it is really expressing a blocksize multiple.
- Updated bli_*_determine_kc_[fb]() for gemm/hemm/symm, trmm, and
  trsm to correctly query mr and nr (for purposes of nudging kc).
- Introduced an enumerated opid_t in bli_type_defs.h that uniquely
  identifies an operation. For now, only level-3 id values are defined,
  along with a generic, catch-all BLIS_NOID value.
- Reworked testsuite so that all induced methods that are enabled
  are tested (one at a time) rather than only testing the first
  available method.
- Reformated summary at the beginning of testsuite output so that
  blocksize and micro-kernel info is shown for each induced method
  that was requested (as well as native execution).
- Reduced the number of columns needed to display non-matlab
  testsuite output (from approx. 90 to 80).
2015-03-18 15:37:10 -05:00
Field G. Van Zee
8d5169ccda Fixed bug in release of mem_t buffer.
Details:
- Fixed a bug that affects all level-2 and level-3 blocked variants. The
  bug only manifested, however, if the packing of operands (A and B in
  gemm, for example) spanned multiple nodes in the control tree. Until
  recently, the main consumers of packm were level-3 operations, all of
  which packed both input operands from blocked variant 1 (B outside of
  the loop, and A within the loop). This particular usage masked a flaw
  in the code whereby bli_obj_release_pack() would always release the
  underlying mem_t buffer (provided it was allocated), even if the buffer
  was not allocated in the current variant. This has been fixed by
  replacing all calls to bli_obj_release_pack() with calls to a new
  function, bli_packm_release(), which takes the same control tree node
  argument passed into the object's corresponding call to packm_init()
  or packv_init(). bli_packm_release() then proceeds to invoke
  bli_obj_release_pack() only if the control tree node indicates that
  packing was requested. Thanks to Devangi Parikh for identifying this
  bug.
2015-03-18 11:38:08 -05:00
Field G. Van Zee
a86db60ee2 Extensive renaming of 3m/4m-related files, symbols.
Details:
- Renamed all remaining 3m/4m packing files and symbols to 3mi/4mi
  ('i' for "interleaved"). Similar changes to 3M/4M macros.
- Renamed all 3m/4m files and functions to 3m1/4m1.
- Whitespace changes.
2015-02-23 18:42:39 -06:00
Field G. Van Zee
8cf8da291a Minor updates to induced complex mode management.
Details:
- Relocated bli_4mh.c, bli_4mb.c, bli_4m.c, bli_3mh.c, bli_3m.c (and
  associated headers) from frame/base to frame/base/induced.
- Added bli_xm.? to frame/base/induced, which implements
  bli_xm_is_enabled(), which detects whether ANY induced complex method
  is currently enabled.
- The new function bli_xm_is_enabled() is now used in bli_info.c to
  detect when an induced complex method is used, so we know when to
  return blocksizes from one of the induced methods' blocksize objects.
2015-02-20 15:24:27 -06:00
Field G. Van Zee
fc0b771227 Added max(mr,nr) to kc in static mem pools.
Details:
- Changed the static memory definitions to compute the maximum register
  blocksize for each datatype and add it to kc when computing the size
  of blocks of A and B. This formally accounts for the nudging of kc
  up to a multiple of mr or nr at runtime for triangular operations
  (e.g. trmm).
2015-02-20 11:47:44 -06:00
Field G. Van Zee
441d47542a Renamed 3m and 4m symbols/macros to 3mi and 4mi.
Details:
- Renamed several variables and macros from 3m/4m to 3mi/4mi. This is
  because those packing schemas were always implicitly "interleaved".
  This new naming scheme will make way for new schemas that separate
  instead of interleve the real and imaginary (and summed) parts.
- Expanded the pack format sub-field of the pack schema field of the
  info_t to 4 bits (from 3). This will allow for more schema types
  going forward.
- Removed old _cntl.c files for herk3m, herk4m, trmm3m, trmm4m.
2015-02-19 17:06:10 -06:00
Field G. Van Zee
493087d730 Merge branch 'master' of github.com:flame/blis 2015-02-18 09:45:51 -06:00
Field G. Van Zee
fe2b8d39a4 Fixed an obscure bug in 3mh/3m/4mh/4m packing.
Details:
- Modified bli_packm_blk_var1.c and _var2.c to increase the triangular
  case's panel increment by 1 if it would otherwise be odd. This is
  particularly necessary in _var2.c when handling the interleaved 3m
  or ro/io/rpi pack schemas, since division of an odd number by 2 can
  happen if both the panel length and the panel packing dimension
  (register packing blocksize) are odd, thus making their product odd.
- Modified bli_packm_init.c so that panel strides are increased by 1
  if they would otherwise be odd, even for non-3m related packing.
- Modified the trmm and trsm macro-kernels so that triangular packed
  micro-panels are traversed with this new "increment by 1 if odd"
  policy.
- Added sanity checks in trmm and trsm macro-kernels that would result
  in an abort() if the conditions that would lead to a "divide odd
  integer by 2" scenario ever manifest.
- Defined bli_is_odd(), _is_even() macros in bli_scalar_macro_defs.h.
2015-02-11 19:33:10 -06:00
Field G. Van Zee
650d2a6ff2 Added initial support for imaginary stride.
Details:
- Added an imaginary stride field ("is") to obj_t.
- Renamed bli_obj_set_incs() macro to bli_obj_set_strides().
- Defined bli_obj_imag_stride() and bli_obj_set_imag_stride() and
  added invocations in key locations.
- Added some basic error-checking related to imaginary stride.
- For now, imaginary stride will not be exposed into the most-used
  BLIS APIs such as bli_obj_create(), and certainly not the
  computational APIs such as bli_dgemm().
2015-02-09 14:59:20 -06:00
Field G. Van Zee
7574c9947d Added basic flop-counting mechanism (level-3 only).
Details:
- Added optional flop counting to all level-3 front-ends, which is
  enabled via BLIS_ENABLE_FLOP_COUNT. The flop count can be
  reset at any time via bli_flop_count_reset() and queried via
  bli_flop_count(). Caveats:
  - flop counts are approximate for her[2]k, syr[2]k, trmm, and
    trsm operations;
  - flop counts ignore extra flops due to non-unit alpha;
  - flop counts do not account for situations where beta is zero.
2015-02-04 12:11:55 -06:00
Field G. Van Zee
81114824a0 Minor 4m/3m consolidation to mem_pool_macro_defs.h.
Details:
- Merged the 4m and 3m definitions in bli_mem_pool_macro_defs.h to
  reduce code and improve readability.
2015-01-06 12:15:21 -06:00
Field G. Van Zee
9456f330af Added 4m_1b implementation for gemm.
Details:
- Added yet another 4m-based implementation for complex domain level-3
  operations. This method, which the 3m/4m paper identifies as Algorithm
  "4m_1b" fissures the first loop around the micro-kernel so that the
  real sub-panel of the current micro-panel of B is multiplied against
  (both sub-panels of) all micro-panels of A, before doing the same for
  the imaginary sub-panel of the micro-panel of B. For now, only gemm is
  supported, and 4m_1b (labeled "4mb" within the framework) is not yet
  integrated into the test suite.
2014-12-12 14:31:57 -06:00
Field G. Van Zee
e56e61438f Minor cleanups to bli_threading.h and friends.
Details:
- No longer need to define BLIS_ENABLE_MULTITHREADING manually in
  bli_config.h; it now gets defined when BLIS_ENABLE_OPENMP or
  BLIS_ENABLE_PTHREADS is defined.
- Added sanity check to prevent both BLIS__ENABLE_OPENMP and
  BLIS_ENABLE_PTHREADS from being enabled simultaneously.
- Reorganization of bli_threading*.h header files, which led to
  simplification of threading-related part of blis.h.
- added "-fopenmp -lpthread" to LDFLAGS of sandybridge make_defs.mk
  file.
2014-11-26 17:20:35 -06:00
Tyler Michael Smith
d71cc79786 Refactored bli_threading files and added support for pthreads 2014-11-26 21:36:39 -06:00
Field G. Van Zee
7bbc95a54f Added new piledriver micro-kernels.
Details:
- Added new micro-kernels for the AMD piledriver architecture (one
  for each datatype).
- Updates and tweaks to piledriver configuration.
- Added 3xk packm micro-kernel support.
- Explicitly unrolled some of the smaller packm micro-kernels.
- Added notes to avx/sandybridge and piledriver micro-kernel files
  acknowledging the influence of the corresponding kernel code in
  OpenBLAS.
2014-10-29 10:52:23 -05:00
Field G. Van Zee
59613f1d55 Added separeate micro-panel alignment for A and B.
Details:
- Changed the recently-added micro-panel alignment macros so that we now
  have two sets--one for micro-panels of matrix A and one for micro-
  panels of matrix B: BLIS_UPANEL_[AB]_ALIGN_SIZE_?.
- Store each set of alignment values into a separate blksz_t object in
  bli_gemm_cntl_init().
- Adjusted packm_init() to use the separate alignment values.
- Added query routines for the new alignment values to bli_info.c.
- Modified test suite output accordingly.
2014-10-23 17:21:37 -05:00
Field G. Van Zee
4674ca8cff Extended newly relaxed KC to hemm, symm.
Details:
- These changes were intended for the previous commit.
- Defined bli_gemm_determine_kc_[fb]() and bli_gemm_determine_kc_[fb](),
  which determine blocksizes for gemm-based operations, taking special
  care to "nudge" the kc dimension up to a multiple of MR or NR for
  hemm and symm operations, as needed.
- Changed bli_gemm_blk_var3f.c to call bli_gemm_determine_kc_f().
  instead of bli_determine_blocksize_f().
- Comment updates to bli_trmm_blocksize.c, bli_trsm_blocksize.c.
2014-10-23 10:50:59 -05:00
Field G. Van Zee
ab954ba6f8 Relaxed constraint that KC be multiple of MR, NR.
Details:
- Relaxed a long-held requirement in register blocksizes that required
  the kernel programmer to choose a KC that was divisible by both MR
  and NR. This was very constraining on some architectures that did not
  use register blocksizes that were powers of two. The constraint is
  now enforced only for trmm and trsm, where it is needed, and it is
  now handled by "nudging" kc upward at runtime, if necessary, to be a
  multiple of MR or NR, as needed.
- Defined bli_trmm_determine_kc_[fb]() and bli_trsm_determine_kc_[fb](),
  which determine blocksizes for trmm and trsm, taking special care to
  "nudge" the kc dimension up to a multiple of MR or NR, as needed.
- Changed bli_trmm_blk_var3[fb].c to call bli_trmm_determine_kc_[fb]()
  instead of bli_determine_blocksize_[fb]().
- Added safeguard to bli_align_dim_to_mult() that returns the dimension
  unmodified if the dimension multiple is zero (to avoid division by
  zero).
- Removed cpp guard/check for KC % MR == 0 and KC % NR == 0 from
  bli_kernel_macro_defs.h.
- Whitespace, variable name changes to bli_blocksize.c.
- Removed old commented code from bli_gemm_cntl.c.
2014-10-23 10:12:27 -05:00
Field G. Van Zee
e64dba5633 Re-implemented micro-panel alignment.
Details:
- This commit re-implements a feature that was removed in commit
  c2b2ab62. It was removed because, at the time, I wasn't sure how the
  micro-panel alignment feature would interact with the 4m method (when
  applied at the micro-kernrel level), and so it seemed safer to disable
  the feature entirely rather than allow possible breakage. This commit
  revisits the issue and safely re-implements the feature in a way that
  is compatible with 4m, 3m, 4mh, and 3mh (and native execution).
- Modified the static memory pool to account for micro-panel alignment
  space.
- Modified packm_init and blocked variants to align whole micro-panels
  by a datatype-specific alignment value that may be set by the
  configuration. (If it is not set by the configuration, it will default
  to BLIS_SIZEOF_?.)
- Modified macro-kernels so that:
  - storage stride is handled properly given the new micro-panel
    alignment behavior;
  - indexing through 3m/4m/rih-type sub-panels, as is done by trmm and
    trsm, is more robust (e.g. will work if the applicable packing
    register blocksize is odd);
  - imaginary strides are computed and stored within auxinfo_t structs,
    which allows the virtual micro-kernels to more easily determine how
    to index into the micro-panel operands.
- Modified virtual 3m and 4m micro-kernels to use the imaginary strides
  within the auxinfo_t structs instead of panel strides.
- Deprecated the panel stride fields from the auxinfo_t structs.
- Updated test suite to print out the micro-panel alignment values.
2014-10-20 19:23:06 -05:00
Field G. Van Zee
e171504a72 Use correct definition of bli_is_last_iter().
Details:
- As intended for previous commit, the new definition of
  bli_is_last_iter() is now disabled in favor of the old
  definition.
2014-10-17 11:25:59 -05:00
Field G. Van Zee
0d954087b2 Minor changes and fixes.
Details:
- Redefined bli_is_last_iter() to take thread_id and num_thread
  arguments, which allows the macro to correctly compute whether a
  given iteration is the last that the thread will compute in that
  particular loop. The new definition, however, remains disabled
  (commented out) until someone can look at this more closely, as
  the new definition seems to actually hurt performance slightly.
- Whitespace and related updates to level-3 macro-kernels.
- Updated test suite so that performance results in the hundreds of
  gigaflops does not disrupt the column alignment of the output.
2014-10-17 11:19:34 -05:00
Field G. Van Zee
76b7c34af0 Fixed a bug in the pack schema-related bit macros.
Details:
- Expanded the BLIS_PACK_SCHEMA_BITS value in bli_type_defs.h to
  include all six bits presently used in the pack schema bitfield of
  the info field of obj_t structs. Prior to this commit, the macro
  constant only included the lowest five bits, which excluded the
  "is or is not packed" bit. This manifested as a strange bug in
  probably many level-2 codes that invoked packing, though we only
  observed it in ger before fixing. Thanks to Devin Matthews for
  finding and reporting this bug.
2014-10-02 14:15:38 -05:00
Field G. Van Zee
4a7df04e8a Added 30xk support for packm ukernels.
Details:
- Updated bli_kernel_*_macro_defs.h headers to include default
  definitions for 30xk packm kernels.
- Extended function pointer arrays in bli_packm_cxk_*() out to 31 and
  included 30xk kernels.
- Addex 30xk kernels to frame/1m/packm/ukernels/bli_packm_ref_cxk_*.c.
2014-09-22 16:06:15 -05:00
Field G. Van Zee
e9899be090 Added high-level implementations of 4m, 3m.
Details:
- Added "4mh" and "3mh" APIs, which implement the 4m and 3m methods at
  high levels, respectively. APIs for trmm and trsm were NOT added due
  to the fact that these approaches are inherently incompatible with
  implementing 4m or 3m at high levels (because the input right-hand
  side matrix is overwritten).
- Added 4mh, 3mh virtual micro-kernels, and updated the existing 4m and
  3m so that all are stylistically consistent.
- Added new "rih" packing kernels (both low-level and structure-aware)
  to support both 4mh and 3mh.
- Defined new pack_t schemas to support real-only, imaginary-only, and
  real+imaginary packing formats.
- Added various level0 scalar macros to support the rih packm kernels.
- Minor tweaks to trmm macro-kernels to facilitate 4mh and 3mh.
- Added the ability to enable/disable 4mh, 3m, and 3mh, and adjusted
  level-3 front-ends to check enabledness of 3mh, 3m, 4mh, and 4m (in
  that order) and execute the first one that is enabled, or the native
  implementation if none are enabled.
- Added implementation query functions for each level-3 operation so
  that the user can query a string that describes the implementation
  that is currently enabled.
- Updated test suite to output implementation types for reach level-3
  operation, as well as micro-kernel types for each of the five micro-
  kernels.
- Renamed BLIS_ENABLE_?COMPLEX_VIA_4M macros to _ENABLE_VIRTUAL_?COMPLEX.
- Fixed an obscure bug when packing Hermitian matrices (regular packing
  type) whereby the diagonal elements of the packed micro-panels could
  get tainted if the source matrix's imaginary diagonal part contained
  garbage.
2014-09-16 18:19:32 -05:00
Field G. Van Zee
9dc9b44a05 Renamed bli_obj_pack_status() to _pack_schema().
Details:
- Renamed the bli_obj_pack_status() macro to bli_obj_pack_schema() in
  order to help avoid confusion as to what the macro returns.
2014-09-11 12:03:28 -05:00
Field G. Van Zee
cf5efdde05 Pass pack_t schemas into ukernels via auxinfo_t.
Details:
- Modified macro-kernels to pass the pack_t schema values for matrices
  A and B into the datatype-specific functions, where they are now
  inserted into a newly-expanded auxinfo_t struct. This gives gives the
  micro-kernels access to the pack_t schema values embedded in the
  control trees, which determine the precise format into which the
  matrix elements are packed.
- Updated a call to bli_packm_init_pack() in src/test_libblis.c to
  remove densify argument. Meant to include this in commit c472993b.
2014-09-11 11:47:56 -05:00
Field G. Van Zee
189def3667 Retired portions of bli_kernel_3m/4m_macro_defs.h.
Details:
- Removed sections of bli_kernel_[4m|3m]_macro_defs.h that defined
  4m/3m-specific blocksizes after realizing that this can be done in
  bli_gemm[4m|3m]_cntl.c, since that is (mostly) the only place they
  are used.
- The maximum cache values for 4m/3m are stll needed when computing mem
  pool dimensions in bli_mem_pool_macro_defs.h. As a workaround, "local"
  definitions in terms of the regular cache blocksizes are now in place.
- Similarly, the register blocksizes for 4m/3m are still needed in
  bli_kernel_post_macro_defs.h. As a workaround, "local" definitions in
  terms of the regular register blocksizes are now in place.
2014-09-01 16:23:17 -05:00
Field G. Van Zee
af521ee6f2 Changed semantics of blocksize extensions.
Details:
- Changed semantics of cache and register blocksize extensions so that
  the extended values are tracked, rather than just the marginal
  extensions.
- BLIS_EXTEND_[MKN]C_? has been renamed BLIS_MAXIMUM_[MKN]C_?.
- BLIS_EXTEND_[MKN]R_? has been renamed BLIS_PACKDIM_[MKN]R_?.
- bli_blksz_ext_*() APIs have been renamed to bli_blksz_max_*(). Note
  that these "max" query routines grab the maximum value for cache
  blocksizes and the packdim value for register blocksizes.
- bli_info_*() API has been updated accordingly.
- All configurations have been updated accordingly.
2014-09-01 14:06:46 -05:00
Field G. Van Zee
07f23aefd5 Pass pack schema into packm_struc_cxk*().
Details:
- Changed the interface to the packm_struc_cxk*() kernels to include
  the pack_t schema. This allows the implementation to more easily
  determine how the micro-panel is stored (row-stored column panel
  or column-stored row panel).
- Updated packm blocked variants to pass in the schema.
- Updated packm_ker_t function pointer definition accordingly.
2014-08-31 11:58:50 -05:00
Field G. Van Zee
f032ba9b11 Reorganized packm implementation.
Details:
- Reorganized packm variants and structure-aware kernels so that all
  routines for a given pack format (4m, 3m, regular) reside in a single
  file.
- Renamed _blk_var4 to _blk_var2 and generalized so that it will work
  for
  both 4m and 3m, and adjusted 4m/3m _cntl_init() functions accordingly.
- Added a new packm_ker_t function pointer type to
  bli_kernel_type_defs.h
  to facilitate function pointer typecasting in the datatype-specific
  packm_blk_var2() functions.
- Deprecated _blk_var3.
- Fixed a bug in the triangular micro-panel packing facility that
  affected trmm and trmm3 with unit diagonals.
2014-08-30 16:21:20 -05:00
Field G. Van Zee
c6793cecb7 Reorganized #includes for scalar macro headers.
Details:
- Reordered the #include statements in bli_scalar_macro_defs.h so that
  conventional, ri-, and ri3-based macros are grouped together.
- Renamed bli_eqri.h (and macros within) to end with 'ris' suffix.
2014-08-28 17:14:48 -05:00
Field G. Van Zee
7fc48a7d92 Combined 4m/3m bits into an expanded bitfield.
Details:
- Combined the 4m/3m bits into an expanded bitfield, which will encode
  the packing "format" of the micro-panels. This will allow for more
  easily and compactly encoding additional formats.
- Other minor comment/whitespace updates to bli_type_defs.h.
- Updated bli_obj_macro_defs.h and bli_param_macro_defs.h to use the new
  format bitfield.
- Comment update to bli_kernel_post_macro_defs.h.
- Whitespace changes to bli_kernel_3m_macro_defs.h, _4m_macro_defs.h.
2014-08-23 16:50:58 -05:00
Field G. Van Zee
ef0143cc14 Renamed _ri, _ri3 packm ukernels to _4m, _3m.
Details:
- Renamed packm ukernels, _cxk dispatcher, and structure-aware _cxk
  helper functions to use _4m and _3m instead of _ri and _ri3 suffixes.
- Updated names of cpp macros that correspond to packm ukernels.
2014-08-23 14:02:27 -05:00
Field G. Van Zee
bedec95451 Added bli_4m API for querying 4m enabled state.
Details:
- Added bli_4m.c (and header), which defines a simple API that can be
  used to query, enable, and disable 4m-based complex support in BLIS.
  The macros BLIS_ENABLE_?COMPLEX_VIA_4M are now used to initialize
  the variable that determines the state (enabled or disabled).
- Changed bli_info*() API so that all cache and register blocksize-
  related query routines return the blksz_t objects' values as they
  exist at runtime, rather than return the values as determined by the
  configuration system (e.g. bli_kernel.h, or defaults for those values
  not specified). This sets the foundation for being able to change
  those blocksizes at runtime.
2014-08-21 18:25:48 -05:00
Field G. Van Zee
d0eec4bddd Added optional row preference to ukernel config.
Details:
- Added the ability for the kernel developer to indicate the gemm micro-
  kernel as having a preference for accessing the micro-tile of C via
  contiguous rows (as opposed to contiguous columns). This property may
  be encoded in bli_kernel.h as BLIS_?GEMM_UKERNEL_PREFERS_CONTIG_ROWS,
  which may be defined or left undefined. Leaving it undefined leads to
  the default assumption of column preference.
- Changed conditionals in frame/3/*/*_front.c that induce transposition
  of the operation so that the transposition is induced only if there
  is disagreement between the storage of C and the preference of the
  micro-kernel. Previously, the only conditional that needed to be met
  was that C was row-stored, which is to say that we assumed the micro-
  kernel preferred column-contiguous access on C.
- Added a "prefers_contig_rows" property to func_t objects, and updated
  calls to bli_func_obj_create() in _cntl.c files in order to support
  the above changes.
- Removed the row-storage optimization from bli_trsm_front.c because
  it is actually ineffective. This is because the right-side case of
  trsm flips the A and B micro-panel operands (since BLIS only requires
  left-side gemmtrsm/trsm kernels), meaning any transposition done
  at the high level is then undone at the low level.
- Tweaked trmm, trmm3 _front.c files to eliminate a possible redundant
  invocation of the bli_obj_swap() macro.
2014-08-19 15:49:19 -05:00
Field G. Van Zee
7f77856e25 Removed unused 4m/3m-related packm macro defs.
Details:
- Removed unused and unneeded s- and d-flavored macro definitions for
  packm ukernels related to the complex 4m and 3m methods, as
  implemented in BLIS.
2014-08-12 12:20:15 -05:00
Field G. Van Zee
98ec95877a Corrected comment for _obj_is_[row|col]_stored().
Details:
- Fixed a mistake in the comments introduced in the previous commit for
  bli_obj_is_row_stored() and bli_obj_is_col_stored().
2014-08-07 18:28:32 -05:00
Field G. Van Zee
43d5e419e1 Reverted _obj_is_[row|col]_stored() macros.
Details:
- Rolled back recent changes to bli_obj_is_row_stored() and
  bli_obj_is_col_stored() so that those macros now only inspect the
  strides (row or column). It turns out that the more sophisticated
  definitions introduced in a51e32e are not necessary, because these
  "obj" macros are virtually never used on packed matrices, and when
  they are, they can use bli_obj_is_[row|col}_packed() macros, which
  inspect the info bitfield.
2014-08-07 18:20:40 -05:00
Field G. Van Zee
4c6ceea4be Added CBLAS compatibility layer.
Details:
- Added a new section in bli_config.h files of all configurations for
  enabling CBLAS support. (Currently, the default is for the CBLAS layer
  to be disabled.)
- Added a directory, frame/compat/cblas, to house CBLAS source code. A
  subdirectory 'f77_sub' holds subroutine wrappers corresponding to
  subroutines found in CBLAS that allow calling some BLAS routines with
  the return value passed as the last argument rather than as an actual
  (function) return value. This was probably intended to allow CBLAS to
  avoid the whole f2c debacle altogether. However, since BLIS does not
  assume the presence of a Fortran compiler, we had to provide similar
  routines in C.
- A script, integrate-cblas-tarball.sh, is included to streamline the
  integration of future revisions of the CBLAS source code.
- The current tarball, cblas.tgz, that was used with the above script to
  generate the present set of CBLAS source code is also included.
- Updated blis.h to include necessary CBLAS-related headers.
2014-08-04 15:49:59 -05:00
Field G. Van Zee
383631b514 Redefined bit field macros with bitshift operator.
Details:
- Redefined many of the macros that define bit fields and bit values in
  the obj_t info field using the bitshift operator (<<). This makes it
  easier to reorder bit fields, or expand existing bit fields, or add
  new fields. The bitshifting should be evaluated by the compiler at
  compile-time.
2014-07-31 14:51:48 -05:00
Field G. Van Zee
137143345d Reimplemented unit blocksize fix in prev commit.
Details:
- Instead of inferring the storage format of the micro-panels from within
  the packm variants, we now pass in a bool_t value that denotes whether
  the packed matrix contains row-stored column panels or column-stored
  row panels. This value can then be tested more easily inside the main
  packm variant loop.
- Renumbered pack_t schema values in bli_type_defs.h so that there are
  now five bits, each with different meaning:
  - 4: packed or not packed?
  - 3: packed for 3m?
  - 2: packed for 4m?
  - 1: packed to panels?
  - 0: stored by rows or columns?
- Added new macros that test for status of above bits in schema bit
  subfield, and renamed some existing macros related to 4m/3m.
2014-07-31 12:12:45 -05:00
Field G. Van Zee
a51e32ec06 Fixed unit register blocksize brokenness.
Details:
- Fixed a breakdown in BLIS's ability to differentiate between row-stored
  and column-stored micro-panels when MR or NR is unit. When either
  register blocksize (or both) is equal to one, inspecting the strides of
  the affected packed micro-panel is no longer sufficient to determine
  whether the micro-panel is a row-stored column panel or a column-stored
  row panel (because both strides are unit). At that point, dimension
  information is necessary when invoking the bli_is_row_stored_f() and
  bli_is_col_stored_f() macros (and their "obj" counterparts). Thanks to
  Ilya Polkovnichenko for reporting this bug.
- Added panel dimensions (m and n) to obj_t, which are set in
  packm_init() and then passed into the blocked variants to support the
  aforementioned update.
2014-07-30 10:41:48 -05:00