smm_process_mm_stack_d Subroutine

private subroutine smm_process_mm_stack_d(stack_descr, params, stack_size, a_data, b_data, c_data, used_smm)

Processes MM stack and issues SMM library calls

Arguments

Type IntentOptional Attributes Name
type(stack_descriptor_type), intent(in) :: stack_descr
integer, intent(in), DIMENSION(dbcsr_ps_width, 1:stack_size) :: params

Stack of MM parameters

integer, intent(in) :: stack_size

Number of parameters

real(kind=real_8), intent(in), DIMENSION(*) :: a_data

Left-matrix data Right-matrix data

real(kind=real_8), intent(in), DIMENSION(*) :: b_data

Left-matrix data Right-matrix data

real(kind=real_8), intent(inout), DIMENSION(*) :: c_data

Product data

logical, intent(out) :: used_smm

Source Code

      SUBROUTINE smm_process_mm_stack_d (stack_descr, params, &
                                                     stack_size, &
                                                     a_data, b_data, c_data, used_smm)
     !! Processes MM stack and issues SMM library calls

         INTEGER, INTENT(IN)                       :: stack_size
        !! Number of parameters
         TYPE(stack_descriptor_type), INTENT(IN)   :: stack_descr
         INTEGER, DIMENSION(dbcsr_ps_width, 1:stack_size), &
            INTENT(IN)                              :: params
        !! Stack of MM parameters
         REAL(kind=real_8), DIMENSION(*), INTENT(IN)         :: a_data, &
            b_data
        !! Left-matrix data
        !! Right-matrix data
         REAL(kind=real_8), DIMENSION(*), INTENT(INOUT)      :: c_data
        !! Product data
         LOGICAL, INTENT(OUT)                      :: used_smm

#if defined(__HAS_smm_dnn)

         INTEGER                                   :: sp

         ! TODO we have no way of knowing which calls to libsmm actually resolve to BLAS
         ! Fixing this requires an interface change to libsmm.
         used_smm = .TRUE.

#if defined(__HAS_smm_vec)
         IF (stack_descr%defined_mnk) THEN
            CALL smm_vec_dnn(stack_descr%m, stack_descr%n, stack_descr%k, &
                                         a_data, b_data, c_data, stack_size, &
                                         dbcsr_ps_width, params, p_a_first, p_b_first, p_c_first)
            RETURN
         END IF
#endif

         DO sp = 1, stack_size
            CALL smm_dnn( &
               params(p_m, sp), &
               params(p_n, sp), &
               params(p_k, sp), &
               a_data(params(p_a_first, sp)), &
               b_data(params(p_b_first, sp)), &
               c_data(params(p_c_first, sp)))
         END DO

#else
         ! We do not want to abort here, fall back to BLAS.
         used_smm = .FALSE.
         CALL blas_process_mm_stack_d (params, stack_size, a_data, b_data, c_data)
#endif

         MARK_USED(stack_descr)
      END SUBROUTINE smm_process_mm_stack_d