Commit Graph

530 Commits

Author SHA1 Message Date
Field G. Van Zee
9135dfd69d Minor updates to test/3m4m files. 2015-06-05 13:37:44 -05:00
Field G. Van Zee
d62ceece94 Minor update to test/3m4m/runme.sh.
Details:
- Removed some stale script code that should have been removed
  during 590bb3b8c.
2015-06-03 12:56:45 -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
1213f5ceba POSIX thread bugfixes/edits to bli_init.c, _mem.c.
Details:
- Fixed a sort-of bug in bli_init.c whereby the wrong pthread mutex
  was used to lock access to initialization/finalization actions.
  But everything worked out okay as long as bli_init() was called by
  single-threaded code.
- Changed to static initialization for memory allocator mutex in
  bli_mem.c, and moved mutex to that file (from bli_init.c).
- Fixed some type mismatches in bli_threading_pthreads.c that resulted
  in compiler warnings.
- Fixed a small memory leak with allocated-but-never-freed (and unused)
  pthread_attr_t objects.
- Whitespace changes to bli_init.c and bli_mem.c.
2015-06-02 13:27:47 -05:00
Field G. Van Zee
590bb3b8c5 Backed-out adjusted dim changes to test/3m4m.
Details:
- Reverted most changes applied during commit ec25807b.
2015-05-24 16:02:53 -05:00
Field G. Van Zee
ec25807b26 Tweaks to test/3m4m to test with adjusted dims.
Details:
- Updated test/3m4m driver files to build test drivers that allow
  comparision of real "asm_blis" results to complex "asm_blis" results,
  except with the latter's problem sizes adjusted so that problems are
  generated with equal flop counts.
2015-04-10 13:23:50 -05:00
Field G. Van Zee
426b648858 Fixed a packing bug that manifested in trsm_r.
Details:
- Fixed a bug that caused a memory leak in the contiguous memory
  allocator. Because packm_init() was using simple aliasing when
  a subpartition object was marked as zeros by bli_acquire_mpart_*(),
  the "destination" pack object's mem_t entry was being overwritten
  by the corresponding field of the "source" object (which was likely
  NULL). This prevented the block from being released back to the
  memory allocator. But this bug only manifested when changing the
  location of packing B from outside the var1 loop to inside the
  var3 loop, and only for trsm with triangular B (side = right). The
  bug was fixed by changing the type of alias used in packm_init()
  when handling zero partition cases. Specifically, we now use
  bli_obj_alias_for_packing(), which does not clobber the destination
  (pack) object's mem_t field. Thanks to Devangi Parikh for this bug
  report.
2015-04-08 15:12:21 -05:00
Field G. Van Zee
c84286d5ce More minor tweaks to test/3m4m.
Details:
- Added a line of output that forces matlab to allocate the entire array
  up-front.
- Re-enabled real domain benchmarks in runme.sh, which were temporarily
  disabled.
2015-04-04 15:39:14 -05:00
Field G. Van Zee
309717c8eb More tweaks to test/3m4m, configurations.
Details:
- Fixed incorrect number of mc_x_kc memory blocks in
  sandybridge/bli_config.h.
- Enabled OpenMP multithreding in piledriver/bli_config.h.
- More updates to test/3m4m driver files.
2015-04-03 19:28:49 -05:00
Field G. Van Zee
4baf3b9c69 Tweaked test/3m4m driver, including acml support.
Details:
- Added ACML support to test/3m4m driver Makefile and runme.sh script.
2015-04-03 16:44:32 -05:00
Field G. Van Zee
a32f7c49ca Merge pull request #23 from xianyi/master
Add auto-detecting CPU  on configure stage.
2015-04-03 08:28:11 -05:00
Field G. Van Zee
349e075ad6 Tweaks to sandybridge config, test/3m4m driver.
Details:
- Enable OpenMP support by default in sandybridge's bli_config.h.
- Reorganized sandybridge's bli_kernel.h.
- Updated 3m4m Makefile, runme.sh to also test MKL implementation.
2015-04-02 18:12:28 -05:00
Zhang Xianyi
4bfd1ce8ca Detect NEON for cortex-a9 and cortex-a15. 2015-04-02 16:40:21 -05:00
Zhang Xianyi
aa6eec4f43 Detect the CPU architecture. Support ARM cores.
Detect the CPU architecture by compiler's predefined macros.
Then, detect the CPU cores.

Support detecting x86 and ARM architectures.
2015-04-02 16:09:02 -05:00
Zhang Xianyi
2947cfb749 Add auto-detecting CPU on configure stage.
e.g.  /Path_to_BLIS/configure auto

Now, it only support detecting x86 CPUs.
2015-04-01 12:24:00 -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
Tyler Smith
ddf62ba7d2 Refuse to free the packm thread info if it uses the single threaded version 2015-03-27 14:27:51 -05:00
Tyler Smith
016fc58758 Don't free packm thread info if it is null 2015-03-27 14:23:02 -05:00
Tyler Smith
00a443c529 Use bli_malloc instead of malloc for the thread info paths 2015-03-27 14:11:07 -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
c0acca0f51 Clarified comments in testsuite input.operations. 2015-03-03 10:56:22 -06:00
Field G. Van Zee
03ba9a6b17 Removed some 'old' directories. 2015-02-24 10:33:28 -06: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
Tyler Michael Smith
411e637ee7 Merge branch 'master' of http://github.com/flame/blis 2015-02-20 20:39:25 -06:00
Tyler Michael Smith
c2569b8803 Fixed a memory leak in freeing the thread infos 2015-02-20 20:38:19 -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
Tyler Michael Smith
af32e3a608 Fixed a bug with get_range_weighted would return end = 0 for small problem sizes 2015-02-19 22:51:11 -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
518a1756cc Fixed indexing bug for trmm3 via 3mh, 4mh.
Details:
- Fixed a bug that only affected trmm3 when performed via 3mh or 4mh,
  whereby micro-panels of the triangular matrix were packed with "dead
  space" between them due to failing to adjust for the fact that pointer
  arithmetic was occurring in units of complex elements while the data
  being packed consisted of real elements. It turns out that the macro-
  kernel suffered from the same bug, meaning the panels were actually
  being packed and read consistently. The only way I was able to
  discover the bug in the first place was because the packed block of A
  was overflowing into the beginning of the packed row panel of B using
  the sandybridge configuration.
2015-02-19 14:27:09 -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
25021299b6 Merge branch 'master' of github.com:flame/blis 2015-02-11 20:03:21 -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
f05a57634a Defined gemm cntl function to query ukrs func_t.
Details:
- Added a new function, bli_gemm_cntl_ukrs(), that returns the func_t*
  for the gemm micro-kernels from the leaf node of the control tree.
  This allows all the func_t* fields from higher-level nodes in the tree
  to be NULL, which makes the function that builds the control trees
  slightly easier to read.
- Call bli_gemm_cntl_ukrs() instead of the cntl_gemm_ukrs() macro in
  all bli_*_front() functions (which is needed to apply the row/column
  preference optimization).
- In all level-3 bli_*_cntl_init() functions, changed the _obj_create()
  function arguments corresponding to the gemm_ukrs fields in higher-
  level cntl tree nodes to NULL.
- Removed some old her2k macro-kernels.
2015-02-08 19:40:34 -06:00
Tyler Smith
cefd3d5d20 A couple of functions were incorrectly ifdeffed away on Xeon Phi. Fixed this 2015-02-05 11:09:12 -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
ceda4f27d1 Implemented bli_obj_imag_equals().
Details:
- Implemented a new function, bli_obj_imag_equals(), which compares the
  imaginary part of the first argument to the second argument, which may
  be a BLIS_CONSTANT or of a regular real datatype.
2015-01-29 13:22:54 -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
Tyler Michael Smith
36a9b7b743 reduced the default number of MC by KC blocks for bgq 2014-12-17 21:55:50 +00:00
Field G. Van Zee
c60619c7c3 Minor tweaks for 3m4m test drivers.
Details:
- Changed gemm_kc blocksizes to be reduced by two-thirds instead of
  half.
- Changed 3m4m/test_gemm.c driver to divide by 3 instead of 2 when
  computing the fixed k dimension.
- Fixed runme.sh so that it would use multiple threads for s/dgemm
  cases.
2014-12-16 17:08:22 -06:00
Field G. Van Zee
c6929ba6a5 Added 4m_1b to test/3m4m test driver and script. 2014-12-16 11:27:50 -06:00
Field G. Van Zee
785d480805 Merge branch 'master' of github.com:flame/blis 2014-12-12 14:34:19 -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
4156c0880d Fixed obscure level-2 packing / general stride bug.
Details:
- Fixed a bug in certain structured level-2 operations that manifested
  only when the structured matrix was provided to BLIS as matrix stored
  with general stride. The bug was introduced in c472993b when the
  densify field was removed from the packm control tree node and
  associated APIs. Since then, the packed object was unconditionally
  marked with an uplo field of BLIS_DENSE. This is fine for level-3
  operations where micro-panels are always densified, but in level-2
  contexts, the underlying unblocked variant (fused or unfused) of
  structured operations (e.g. trmv) still needs to know whether to
  execute its "lower" or "upper" branches of code. Since this field
  was unconditionally being set to BLIS_DENSE, the unblocked variants
  were always executed the "else" branch, which happened to be the
  "lower" case code. Thus, running an upper case produced the wrong
  answer. This most obviously manifested in the form of failures for
  trmm, trmm3, and trsm in the test suite.
  The bug was fixed by setting the packed object's uplo field to
  BLIS_DENSE only if the schema indicated that micro-panels were to be
  packed. Otherwise, we can assume we are packing to regular row or
  column storage, as is the case with level-2 packing. Thanks to
  Francisco Igual for reporting the testsuite failures and ultimately
  leading us to this bug.
2014-12-09 16:03:14 -06:00
Field G. Van Zee
689f60a578 Merge pull request #21 from figual/master
Adding armv8a configuration and micro-kernels.
2014-12-07 14:03:30 -06:00
Francisco D. Igual
483e4d6a3f Adding armv8a configuration and micro-kernels.
Only sgemm micro-kernel is fully functional at this point.
2014-12-07 20:27:49 +01:00
Tyler Smith
bef24e67e0 Fixed a type of race condition exposed by pthreads implementation.
Lead thread of the inner thread communicator could exit subproblem, move on the next iteration of the loop and modify a1_pack, b1_pack, or c1_pack while other threads were still using those.

Barriers were inserted to fix this.
2014-11-26 18:00:56 -06:00
Field G. Van Zee
76bde44411 Merge branch 'master' of github.com:flame/blis 2014-11-26 17:25:24 -06:00