Debian Codegraph @

frame/3/trsm/bli_trsm_blk_var3.c

raw symbols SCIP
1 /*
2
3 BLIS
4 An object-based framework for developing high-performance BLAS-like
5 libraries.
6
7 Copyright (C) 2014, The University of Texas at Austin
8
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(s) of the copyright holder(s) nor the names of its
18 contributors may be used to endorse or promote products derived
19 from this software without specific prior written permission.
20
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.
32
33 */
34
35 #include "blis.h"
36
37 void bli_trsm_blk_var3
38 (
39 const obj_t* a,
40 const obj_t* b,
41 const obj_t* c,
42 const cntx_t* cntx,
43 const cntl_t* cntl,
44 thrinfo_t* thread_par
45 )
46 {
47 obj_t ap, bp, cs;
48 bli_obj_alias_to( a, &ap );
49 bli_obj_alias_to( b, &bp );
50 bli_obj_alias_to( c, &cs );
51
52 thrinfo_t* thread = bli_thrinfo_sub_node( 0, thread_par );
53
54 // Determine the direction in which to partition (forwards or backwards).
55 const dir_t direct = bli_part_cntl_direct( cntl );
56
57 // Prune any zero region that exists along the partitioning dimension.
58 bli_l3_prune_unref_mparts_k( &ap, &bp, &cs );
59
60 // Query dimension in partitioning direction.
61 dim_t k_trans = bli_obj_width_after_trans( &ap );
62
63 // Partition along the k dimension.
64 dim_t b_alg;
65 for ( dim_t i = 0; i < k_trans; i += b_alg )
66 {
67 // Determine the current algorithmic blocksize.
68 b_alg = bli_determine_blocksize( direct, i, k_trans,
69 bli_part_cntl_blksz_alg( cntl ),
70 bli_part_cntl_blksz_max( cntl ) );
71
72 // Acquire partitions for A1 and B1.
73 obj_t a1, b1;
74 bli_acquire_mpart_ndim( direct, BLIS_SUBPART1,
75 i, b_alg, &ap, &a1 );
76 bli_acquire_mpart_mdim( direct, BLIS_SUBPART1,
77 i, b_alg, &bp, &b1 );
78
79 // Perform trsm subproblem.
80 bli_l3_int
81 (
82 &a1,
83 &b1,
84 &cs,
85 cntx,
86 bli_cntl_sub_node( 0, cntl ),
87 thread
88 );
89
90 // This variant executes multiple rank-k updates. Therefore, if the
91 // internal alpha scalars on A/B and C are non-zero, we must ensure
92 // that they are only used in the first iteration.
93 if ( i == 0 )
94 {
95 bli_obj_scalar_reset( &ap );
96 bli_obj_scalar_reset( &bp );
97 bli_obj_scalar_reset( &cs );
98 }
99 }
100 }
101