Commit Graph

3645 Commits

Author SHA1 Message Date
Field G. Van Zee
8a3066c315 Relocated gemmsup_ref general stride handling.
Details:
- Moved the logic that checks for general stridedness in any of the
  matrix operands in a gemmsup problem. The logic previously resided
  near the top of bli_gemmsup_int(), which is the thread entry point
  for the parallel region of the current gemmsup implementation. The
  problem with this setup was that the code would attempt to reject
  problems with any general-strided operands by returning BLIS_FAILURE,
  and that return value was then being ignored by the l3_sup thread
  decorator, which unconditionally returns BLIS_SUCCESS. To solve this
  issue, rather than try to manage n return values, one from each of n
  threads, I simply moved the logic into bli_gemmsup_ref(). I didn't
  move it any higher (e.g. bli_gemmsup()) because I still want the
  logic to be part of the current gemmsup handler implementation. That
  is, perhaps someone else will create a different handler, and that
  author wants to handle general stride differently. (We don't want to
  force them into a particular way of handling general stride.)
- Removed the general stride handling from bli_gemmtsup_int(), even
  though this function is inoperative for now.
- This commit addresses issue #484. Thanks to RuQing Xu for reporting
  this issue.
2021-03-09 17:52:59 -06:00
nphaniku
e3cc577ec1 AOCL Windows: 3.1 BLIS changes
1. Incorporated code review comments .
 2. Updated Copyright to 2021.

AMD Internal : [CPUPL-1422]

Change-Id: I722b0f71daae029a3dcc2cbd029524ea39ca78e6
2021-03-09 17:35:57 +05:30
nphaniku
d78defa0fc AOCL Windows: 3.1 BLIS changes
1. CMake script changes for adding new files to the build.
 2. Added Upper case support for couple of API's.
 3. bool is not support in clang so defined it.

AMD Internal : [CPUPL-1422]

Change-Id: I4cac8fb8ef86cd6bacfd29e3b1a84c5da1310f61
2021-03-08 22:32:13 +05:30
nphaniku
b3628cdfd3 AOCL Windows: 3.1 BLIS changes
1. CMake script changes for build with Clang compiler.
 2. CMake script changes for build test and testsuite based on the lib type ST/MT
 3. CMake script changes for testcpp and blastest
 4. Added python scripts to support library build and testsuite build.

AMD Internal : [CPUPL-1422]

Change-Id: Ie34c3e60e9f8fbf7ea69b47fd1b50ee90099c898
2021-03-08 19:04:17 +05:30
Nicholai Tukanov
670bc7b60f Add low-precision POWER10 gemm kernels (#467)
Details:
- This commit adds a new BLIS sandbox that (1) provides implementations 
  based on low-precision gemm kernels, and (2) extends the BLIS typed 
  API for those new implementations. Currently, these new kernels can 
  only be used for the POWER10 microarchitecture; however, they may 
  provide a template for developing similar kernels for other 
  microarchitectures (even those beyond POWER), as changes would likely 
  be limited to select places in the microkernel and possibly the 
  packing routines. The new low-precision operations that are now 
  supported include: shgemm, sbgemm, i16gemm, i8gemm, i4gemm. For more 
  information, refer to the POWER10.md document that is included in 
  'sandbox/power10'.
2021-03-05 13:53:43 -06:00
Kiran Varaganti
12d13629f9 Fix Debug Trace Log in dgemm_ and zgemm_
Replaced "*MKSTR(ch)" in the DTL call "AOCL_DTL_LOG_GEMM_INPUTS(AOCL_DTL_LEVEL_TRACE_1, *MKSTR(ch)...)" with "D" and "Z" for dgemm_ and zgemm_ respectively to prevent printing wrong data-type.

[CPUPL-1449]

Change-Id: Ic91537189352bdb164411799e127de990a5c9a08
2021-03-02 15:16:21 +05:30
RuQing Xu
b8dcc5bc75 Fixed typed API definition for gemmt (#476)
Details:
- Fixed incorrect definition and prototype of bli_?gemmt() in 
  frame/3/bli_l3_tapi.c and .h, respectively. gemmt was previously
  defined identically to gemm, which was wrong because it did not
  take into account the uplo property of C.
- Fixed incorrect API documentation for her2k/syr2k in BLISTypedAPI.md.
  Specifically, the document erroneously listed only a single transab
  parameter instead of transa and transb.
2021-03-01 16:58:24 -06:00
Ilknur
a0e4fe2340 Fixed double free() in level1v example (#482)
Details:
- In exampls/tapi/00level1v.c, pointer 'z' was being freed twice and
  pointer 'a' was not being freed at all. This commit correctly frees 
  each pointer exactly once.
2021-03-01 16:06:56 -06:00
Nageshwar Singh
791903b31c Adding trans h support in bench_gemm.c
Change-Id: If340d515c38a593df26d5075e29685ef044601a5
2021-03-02 02:33:06 +05:30
Field G. Van Zee
f5871c7e06 Added complex asm packm kernels for 'haswell' set.
Details:
- Implemented assembly-based packm kernels for single- and double-
  precision complex domain (c and z) and housed them in the 'haswell'
  kernel set. This means c3xk, c8xk, z3xk, and z4xk are now all
  optimized.
- Registered the aforementioned packm kernels in the haswell, zen,
  and zen2 subconfigs.
- Minor modifications to the corresponding s and d packm kernels that
  were introduced in 426ad67.
- Thanks to AMD, who originally contributed the double-precision real
  packm kernels (d6xk and d8xk), upon which these complex kernels are
  partially based.
2021-02-28 17:03:57 -06:00
Field G. Van Zee
426ad679f5 Added assembly packm kernels for 'haswell' set.
Details:
- Implemented assembly-based packm kernels for single- and double-
  precision real domain (s and d) and housed them in the 'haswell'
  kernel set. This means s6xk, s16xk, d6xk, and d8xk are now all
  optimized.
- Registered the aforementioned packm kernels in the haswell, zen,
  and zen2 subconfigs.
- Thanks to AMD, who originally contributed the double-precision real
  packm kernels (d6xk and d8xk), which I have now tweaked and used to
  create comparable single-precision real kernels (s6xk and s16xk).
2021-02-27 18:39:56 -06:00
Meghana Vankadari
22d4689360 Implemented 16x3 based gemm kernel for the case where A has transpose
Details:
- This implementation does a transpose operation while packing 16xk of A
  buffer and passes it to 16x3-nn kernel.
- The same implementation works for the case where B has transpose.

AMD-Internal: [CPUPL-1376]
Change-Id: I81f74deb609926598f62c30f5bd6fc80fb1b9a17
2021-02-18 16:47:14 +05:30
Kiran Varaganti
851ab8b39f Merge "Code fixes for single-thread and multi-thread builds." into amd-staging-milan-3.1 2021-02-16 23:29:41 -05:00
Kiran Varaganti
e1a5e96c7f Code fixes for single-thread and multi-thread builds.
Made changes to dgemm_ and zgemm_ interfaces to support multi-thread GEMM implementations. When number of threads is greater than one, we call  multi-threaded gemm (sup or native) and for single thread version we call different flavors of single-thread gemm implementations decided based on the matrix dimensions.
[CPUPL-1376]

Change-Id: I2e37145ec9a07d6b7e7be1719bd49239e813aa8a
2021-02-16 12:44:31 +05:30
Meghana Vankadari
cf7d9c7314 Disabled calling of bli_dgemm_small from gemm_front
Details:
- Decision logic to choose small_gemm has been moved to blas interface.
- Redirecting all the calls to small_gemm from gemm_front to native
  implementation.

AMD-Internal: [CPUPL-1376]
Change-Id: I6490f67113e9f7c272269f441c86f2a0b3c89a53
2021-02-16 11:30:20 +05:30
Madan mohan Manokar
95e0fb3a05 sqp commenting
1. Added comments.

AMD-Internal: [CPUPL-1429]
Change-Id: Ie37e24e58cd8bf836038a2258ebd09c3912fab9e
2021-02-15 04:22:23 -05:00
Meghana Vankadari
42a0a6bc6f Added a basic dgemm implementation for smaller matrices.
Details:
- This kernel works best for cases where k = 1.
- This implementation is called directly from blas interface when A, B
  matrices have no-transpose and k = 1.

AMD-Internal: [CPUPL-1376]
Change-Id: I3b31673a28290c81d4a4cb64c8605d56e50b5d3d
2021-02-15 09:43:47 +05:30
Meghana Vankadari
943b1362c7 Enabled vectorized pack kernels for zen2 configuration.
Details:
- These kernels are implemented by Field G. Van Zee as part of TRSM SUP
  implementation with commit-ID 9e31f5e8553f8ae99cfe8a80052fc63499e0891a.

AMD-Internal: [CPUPL-1376]
Change-Id: Ib39a87fc20571ae9aeff82c9b87516ac583093c2
2021-02-12 19:16:57 +05:30
Madan mohan Manokar
4c8b823972 gemm_sqp(gemm_squarePacked): 3m_sqp and dgemm_sqp
1. SquarePacked algorithm focuses on efficient zgemm/dgemm implementation for square matrix sizes (m=k=n)
2. Variation of 3m algorithm (3m_sqp) is implemented to allow single load and store of C matrix in kernel.
3. Currently the method supports only m multiple of 8. Residues cases to be implemented later.
4. dgemm Real kernel (dgemm_sqp) implementation without alpha, beta multiple is done,
    since real alpha and beta scaling are in 3m_sqp framework.
5. gemm_sqp supports dgemm when alpha = +/-1.0 and beta = 1.0.

Change-Id: I49becaf6079da4be29be5b06057ff4e50770a7d8
AMD-Internal: [CPUPL-1352]
2021-02-12 15:57:59 +05:30
Kiran Varaganti
29ddec241a Merge "DGEMM Optimizations for smaller dimensions" into amd-staging-milan-3.1 2021-02-11 08:22:36 -05:00
Kiran Varaganti
a7d43cf720 DGEMM Optimizations for smaller dimensions
Modified dgemm_ to able to call small_gemm 16x3 kernel.
small_gemm will be called if((m + n -k) < 2000 && (m + k-n) < 2000 && n + k-m < 2000) && n > 2.
small_gemm kernel - if m or n or k = 0 we return and this case will be handled by sup or native kernel.

[CPUPL - 1376]

Change-Id: I61c2b36ad0ae4fb3dd23bc37c2b6c78556b3105b
2021-02-11 11:05:42 +05:30
Mangala V
503e912fc5 Merge "Modified blas interface of TRSM to call TRSV whenever m=1 or n=1." into amd-staging-milan-3.1 2021-02-11 00:21:45 -05:00
managalv
8face536fd Modified blas interface of TRSM to call TRSV whenever m=1 or n=1.
TRSM API: AX = B, where X=B
  Case1: Call TRSV when matrix B is vector & A is matrix,
         When n = 1 for left side and when m = 1 for right side
  Case2: Divide B/A when matrix B is vector & A is scalar(Diagonal element),
         When m = 1 for left side and when n = 1 for right side
  For right side, Transpose complete operation, Change upper to lower and
                  vice versa when A is being transposed

Change-Id: Ib020f2a568f04a6e8d8f75bfc38adbfd7c5d175a
2021-02-11 18:47:37 +05:30
Madan mohan Manokar
3ab9104dae Handling zgemm real(+/-1) alpha and beta
1.Improved performance when zgemm's alpha and beta are real and equal to +/-1.
2.change done in bli_zgemmsup_rv_zen_asm_3x4n.
3.change done in bli_zgemmsup_rv_zen_asm_3x4m.
4.change done in bli_zgemm_haswell_asm_3x4.

Change-Id: Ic14d8507b264c24a8748febf6bc73eb60e476430
AMD-Internal: [CPUPL-1352]
2021-02-10 02:58:58 -05:00
managalv
1ff4981203 Modified blas interface of TRSM to call TRSV whenever m=1 or n=1.
Case1: Call TRSV when matrix C & B are vector & A is matrix,
         When n = 1 for left side and when m = 1 for right side
  Case2: Divide B/A when matrix C & B are vector & A is scalar(Diagonal element),
         When m = 1 for left side and when n = 1 for right side
  For right side, Transpose complete operation, Change upper to lower and
                  vice versa when A is being transposed

Change-Id: Ie87e4a263c287ba554832ccc56b629f982e3ac4c
2021-02-08 19:02:25 +05:30
Madan mohan Manokar
f1ea1f1d34 Adpative zgemm
1. 3m1 choosen for (m<=128) &  (68>n<=128) & (k<=128)
2. Default blis3.1 path for rest of the sizes.

Change-Id: I1e50dece013e72a67f1162faef5cbeb9bfbbc23a
AMD-Internal: [CPUPL-1352]
2021-02-03 12:43:57 +05:30
Meghana Vankadari
2e7cf8d82f Added 16x4 AXPYF kernel for zen2 config
Details:
- Added a new AXPYF kernel with fuse_factor = 4 and iter_unroll = 4.
- Modified blas interface of GEMM to call GEMV whenever m=1 or n=1.

Change-Id: I3f5acd37b009f53cf63f462cec79fd3e73676dbc
2021-02-02 21:22:44 +05:30
Devin Matthews
f50c1b7e58 Merge pull request #473 from ajaypanyala/pkgconfig
build: generate pkgconfig file
2021-02-01 11:55:51 -06:00
Field G. Van Zee
8f39aea11f Merge branch 'dev' 2021-01-30 17:59:56 -06:00
Field G. Van Zee
f8db9fb33b Fixed missing parentheses in README.md Citations. 2021-01-28 08:04:52 -06:00
Ajay Panyala
b3953b938e drop CFLAGS in the generated pkgconfig file 2021-01-12 17:07:04 -08:00
Ajay Panyala
b02d9376ba add datadir 2021-01-12 11:47:58 -08:00
Ajay Panyala
d8d8deeb6d generate pkgconfig file 2021-01-11 17:47:50 -08:00
Devin Matthews
8c65411c7c Merge pull request #471 from flame/fix-470
Fix kernel-to-config mapping for intel64
2021-01-11 16:01:45 -06:00
Devin Matthews
874c3f04ec Update configure
Choose last sub-config in the kernel-to-config map if the config list doesn't contain the name of the kernel set. E.g. for "zen: skx knl haswell" pick "haswell" instead of "skx" which was chosen previously. Fixes #470.
2021-01-08 13:56:30 -06:00
dzambare
48f2366b6f Updated BLIS version string to "AOCL BLIS X.x" format
AMD-Internal : [CPUPL-1394]

Change-Id: Ifebcb14d9eb064d231b831f5a1e151853ad5a009
2021-01-07 12:38:32 +05:30
Field G. Van Zee
2a815d5b36 Support trsm pre-inversion in 1m, bb, ref kernels.
Details:
- Expanded support for disabling trsm diagonal pre-inversion to other
  microkernel types, including the reference microkernel as well as the
  kernel implementations for 1m and the pre-broadcast B (bb) format used
  by the power9 subconfig. This builds on the 'haswell' and 'penryn'
  kernel support added in 7038bba. Thanks to Bhaskar Nallani for
  reminding me, in #461 (post-closure), that 1m support was missing from
  that commit.
- Removed cpp branch of ref_kernels/3/bli_trsm_ref.c that contained the
  omp simd implementation after making a stripped-down copy in 'old'.
  This code has been disabled for some time and it seemed better suited
  to rot away out of sight rather than clutter up a file that is already
  cluttered by the presence of lower and upper versions.
- Minor comment update to bli_ind_init().
2021-01-04 18:03:39 -06:00
Field G. Van Zee
c3ed2cbb9f Enable 1m only if real domain ukr is not reference.
Details:
- Previously, BLIS would automatically enable use of the 1m method
  for a given precision if the complex domain microkernel was a
  reference kernel. This commit adds an additional constraint so that
  1m is only enabled if the corresponding real domain microkernel is
  NOT reference. That is, BLIS now forgos use of 1m if both the real and
  complex domain kernels are reference implementations. Note that this
  does not prevent 1m from being enabled manually under those
  conditions; it only means that 1m will not be enabled automatically
  at initialization-time.
2021-01-04 16:16:32 -06:00
Field G. Van Zee
ed50c94738 Merge branch 'master' into dev 2021-01-04 14:31:44 -06:00
Devin Matthews
328b4f8872 Shared object (dylib) was not built correctly for partial build.
The SO build rule used $? instead of $^. Observed on macOS, not sure if it affected Linux or not.
2020-12-30 17:54:18 -06:00
Devin Matthews
ae6ef66ef8 bli_diag_offset_with_trans had wrong return type. Fixes #468. 2020-12-30 17:34:55 -06:00
Nagendra Prasad M
566f586547 Merge "Blis: DOTC Additional argument for Complex types when using FLANG" into amd-staging-milan-3.1 2020-12-21 06:03:11 -05:00
nprasadm
10ac4e2aba Blis: DOTC Additional argument for Complex types when using FLANG
Merged the changes done in UT Austin BLIS repo for DOTC Additional
argument.
Other modifications related to test application included.

Verifed the above code changes through scalapack test applications 'xztrd' , 'xctrd'

Change-Id: I7e16f3953db71890f9e8fbb0f7b363eaad899f62
Signed-off-by: Nagendra <Nagendra.PrasadM@amd.com>
AMD-Internal: [CPUPL-1323]
2020-12-16 14:03:10 +05:30
Kiran Varaganti
fc80892bb2 Improve sup GEMM performance (CCC - row prefer kernel)
Column-storage (CCC) case m is large and n & k are relatively small - row preferred kernels,
in this case var1n sup kernels are called. But actually block-panel var2m works better here.
After induced transposition the n becomes m which is large and m becomes n which is smaller.
The micropanels of induced B are larger than micropanels of induced A, therefore var2m is better option than var1n.
[CPUPL-1376]

Change-Id: I9214140d340ea4ac3edfefc31c465c926ba93326
2020-12-10 19:16:44 +05:30
Dipal M Zambare
66fd5e547a Update AMD copyright notice for current year.
Change-Id: I2ffd3d3306499922be15638d37c4d1e806acd36c
AMD-Internal: [CPUPL-1367]
2020-12-10 13:44:29 +05:30
Devin Matthews
ebcf197fb8 Merge pull request #466 from isuruf/patch-3
fix cc_vendor for crosstool-ng toolchains
2020-12-05 22:26:27 -06:00
Isuru Fernando
21aa67e11c fix cc_vendor for crosstool-ng toolchains 2020-12-05 21:59:13 -06:00
Field G. Van Zee
472f138cb9 Fixed typo in README.md to CodingConventions.md. 2020-12-05 14:13:52 -06:00
Field G. Van Zee
0cef09aa92 Consolidated code in level-3 _front() functions.
Details:
- Reduced a code segment that appears in all of the bli_*_front()
  functions except for bli_gemm_front(). Previously, the code looked
  like this (taken from bli_herk_front()):

    if ( bli_cntx_method( cntx ) == BLIS_NAT )
    {
        bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local );
        bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &ah_local );
    }
    else // if ( bli_cntx_method( cntx ) != BLIS_NAT )
    {
        pack_t schema_a = bli_cntx_schema_a_block( cntx );
        pack_t schema_b = bli_cntx_schema_b_panel( cntx );

        bli_obj_set_pack_schema( schema_a, &a_local );
        bli_obj_set_pack_schema( schema_b, &ah_local );
    }

  This code segment is part of a sort-of-hack that allows us to
  communicate the pack schemas into the level-3 thread decorator, which
  needs them so that they can be passed into bli_l3_cntl_create_if(),
  where the control tree is created. However, the first conditional case
  above is unnecessary because the second case is fully generalized.
  That is, even in the native case, the context contains correct,
  queryable schemas. Thus, these code segments were reduced to something
  like:

    pack_t schema_a = bli_cntx_schema_a_block( cntx );
    pack_t schema_b = bli_cntx_schema_b_panel( cntx );

    bli_obj_set_pack_schema( schema_a, &a_local );
    bli_obj_set_pack_schema( schema_b, &ah_local );

  There's always a small chance that the seemingly unnecessary code
  in the first branch case has some special use that is not apparent to
  me, but the testsuite's default input parameters seem to think this
  commit will be fine.
2020-12-04 16:40:59 -06:00
Field G. Van Zee
7038bbaa05 Optionally disable trsm diagonal pre-inversion.
Details:
- Implemented a configure-time option, --disable-trsm-preinversion, that
  optionally disables the pre-inversion of diagonal elements of the
  triangular matrix in the trsm operation and instead uses division
  instructions within the gemmtrsm microkernels. Pre-inversion is
  enabled by default. When it is disabled, performance may suffer
  slightly, but numerical robustness should improve for certain
  pathological cases involving denormal (subnormal) numbers that would
  otherwise result in overflow in the pre-inverted value. Thanks to
  Bhaskar Nallani for reporting this issue via #461.
- Added preprocessor macro guards to bli_trsm_cntl.c as well as the
  gemmtrsm microkernels for 'haswell' and 'penryn' kernel sets pursuant
  to the aforementioned feature.
- Added macros to frame/include/bli_x86_asm_macros.h related to division
  instructions.
2020-12-04 16:08:15 -06:00