]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - dense-linear-algebra-libraries/linalg.git/blob - blis/frame/3/gemm/bli_gemm_threading.h
Consolidate all git repos of linalg into one.
[dense-linear-algebra-libraries/linalg.git] / blis / frame / 3 / gemm / bli_gemm_threading.h
1 /*
3    BLIS    
4    An object-based framework for developing high-performance BLAS-like
5    libraries.
7    Copyright (C) 2014, The University of Texas at Austin
9    Redistribution and use in source and binary forms, with or without
10    modification, are permitted provided that the following conditions are
11    met:
12     - Redistributions of source code must retain the above copyright
13       notice, this list of conditions and the following disclaimer.
14     - Redistributions in binary form must reproduce the above copyright
15       notice, this list of conditions and the following disclaimer in the
16       documentation and/or other materials provided with the distribution.
17     - Neither the name of The University of Texas at Austin nor the names
18       of its contributors may be used to endorse or promote products
19       derived from this software without specific prior written permission.
21    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25    HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
36 struct gemm_thrinfo_s //implements thrinfo_t
37 {
38     thread_comm_t*      ocomm;       //The thread communicator for the other threads sharing the same work at this level
39     dim_t               ocomm_id;    //Our thread id within that thread comm
40     thread_comm_t*      icomm;       //The thread communicator for the other threads sharing the same work at this level
41     dim_t               icomm_id;    //Our thread id within that thread comm
43     dim_t               n_way;       //Number of distinct caucuses used to parallelize the loop
44     dim_t               work_id;     //What we're working on
46     packm_thrinfo_t*    opackm;
47     packm_thrinfo_t*    ipackm;
48     struct gemm_thrinfo_s*    sub_gemm;
49 };
50 typedef struct gemm_thrinfo_s gemm_thrinfo_t;
52 #define gemm_thread_sub_gemm( thread )  thread->sub_gemm
53 #define gemm_thread_sub_opackm( thread )  thread->opackm
54 #define gemm_thread_sub_ipackm( thread )  thread->ipackm
56 // For use in gemm micro-kernel
57 #define gemm_get_next_a_micropanel( thread, a1, step ) ( a1 + step * thread->n_way )
58 #define gemm_get_next_b_micropanel( thread, b1, step ) ( b1 + step * thread->n_way )
60 gemm_thrinfo_t** bli_create_gemm_thrinfo_paths( );
61 void bli_gemm_thrinfo_free_paths( gemm_thrinfo_t**, dim_t n_threads );
63 void bli_setup_gemm_thrinfo_node( gemm_thrinfo_t* thread,
64                                   thread_comm_t* ocomm, dim_t ocomm_id,
65                                   thread_comm_t* icomm, dim_t icomm_id,
66                                   dim_t n_way, dim_t work_id, 
67                                   packm_thrinfo_t* opackm,
68                                   packm_thrinfo_t* ipackm,
69                                   gemm_thrinfo_t* sub_gemm );
71 gemm_thrinfo_t* bli_create_gemm_thrinfo_node( thread_comm_t* ocomm, dim_t ocomm_id,
72                                               thread_comm_t* icomm, dim_t icomm_id,
73                                               dim_t n_way, dim_t work_id, 
74                                               packm_thrinfo_t* opackm,
75                                               packm_thrinfo_t* ipackm,
76                                               gemm_thrinfo_t* sub_gemm );
78 void bli_setup_gemm_single_threaded_info( gemm_thrinfo_t* thread );