Пример #1
0
void bli_gemmtrsm_ukr_make_subparts( dim_t  k,
                                     obj_t* a,
                                     obj_t* b,
                                     obj_t* a1x,
                                     obj_t* a11,
                                     obj_t* bx1,
                                     obj_t* b11 )
{
	dim_t mr = bli_obj_length( *a );
	dim_t nr = bli_obj_width( *b );

	dim_t off_a1x, off_a11;
	dim_t off_bx1, off_b11;

	if ( bli_obj_is_lower( *a ) )
	{
		off_a1x = 0;
		off_a11 = k;
		off_bx1 = 0;
		off_b11 = k;
	}
	else
	{
		off_a1x = mr;
		off_a11 = 0;
		off_bx1 = mr;
		off_b11 = 0;
	}

	bli_obj_init_subpart_from( *a, *a1x );
	bli_obj_set_dims( mr, k, *a1x );
	bli_obj_inc_offs( 0, off_a1x, *a1x );

	bli_obj_init_subpart_from( *a, *a11 );
	bli_obj_set_dims( mr, mr, *a11 );
	bli_obj_inc_offs( 0, off_a11, *a11 );

	bli_obj_init_subpart_from( *b, *bx1 );
	bli_obj_set_dims( k, nr, *bx1 );
	bli_obj_inc_offs( off_bx1, 0, *bx1 );

	bli_obj_init_subpart_from( *b, *b11 );
	bli_obj_set_dims( mr, nr, *b11 );
	bli_obj_inc_offs( off_b11, 0, *b11 );

	// Mark a1x as having general structure (which overwrites the triangular
	// property it inherited from a).
	bli_obj_set_struc( BLIS_GENERAL, *a1x );

	// Set the diagonal offset of a11 to 0 (which overwrites the diagonal
	// offset value it inherited from a).
	bli_obj_set_diag_offset( 0, *a11 );
}
Пример #2
0
void bli_packm_acquire_mpart_t2b( subpart_t requested_part,
                                  dim_t     i,
                                  dim_t     b,
                                  obj_t*    obj,
                                  obj_t*    sub_obj )
{
	dim_t m, n;

	// For now, we only support acquiring the middle subpartition.
	if ( requested_part != BLIS_SUBPART1 )
	{
		bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED );
	}

	// Partitioning top-to-bottom through packed column panels (which are
	// row-stored) is not yet supported.
	if ( bli_obj_is_col_packed( *obj ) )
	{
		bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED );
	}

	// Query the dimensions of the parent object.
	m = bli_obj_length( *obj );
	n = bli_obj_width( *obj );

	// Foolproofing: do not let b exceed what's left of the m dimension at
	// row offset i.
	if ( b > m - i ) b = m - i;

	// Begin by copying the info, elem size, buffer, row stride, and column
	// stride fields of the parent object. Note that this omits copying view
	// information because the new partition will have its own dimensions
	// and offsets.
	bli_obj_init_subpart_from( *obj, *sub_obj );

	// Modify offsets and dimensions of requested partition.
	bli_obj_set_dims( b, n, *sub_obj );

	// Tweak the padded length of the subpartition to trick the underlying
	// implementation into only zero-padding for the narrow submatrix of
	// interest. Usually, the value we want is b (for non-edge cases), but
	// at the edges, we want the remainder of the mem_t region in the m
	// dimension. Edge cases are defined as occurring when i + b is exactly
	// equal to the inherited sub-object's length (which happens since the
	// determine_blocksize function would have returned a smaller value of
	// b for the edge iteration). In these cases, we arrive at the new
	// packed length by simply subtracting off i.
	{
		dim_t  m_pack_max = bli_obj_padded_length( *sub_obj );
		dim_t  m_pack_cur;

		if ( i + b == m ) m_pack_cur = m_pack_max - i;
		else              m_pack_cur = b;

		bli_obj_set_padded_length( m_pack_cur, *sub_obj );
	}

	// Translate the desired offsets to a panel offset and adjust the
	// buffer pointer of the subpartition object.
	{
		char* buf_p        = bli_obj_buffer( *sub_obj );
		siz_t elem_size    = bli_obj_elem_size( *sub_obj );
		dim_t off_to_panel = bli_packm_offset_to_panel_for( i, sub_obj );

		buf_p = buf_p + elem_size * off_to_panel;

		bli_obj_set_buffer( ( void* )buf_p, *sub_obj );
	}
}