# ########################################################################
# Copyright (c) 2021 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ########################################################################

---
include: rocsparse_common.yaml
include: known_bugs.yaml

Definitions:
  - &M_N_range_quick
    - { M:  50, N:  50 }
    - { M: 124, N: 124 }

  - &M_N_range_checkin
    - { M:  -1, N:  -1 }
    - { M:   0, N:   0 }
    - { M:   1, N:   1 }
    - { M:   2, N:   2 }
    - { M:   8, N:   8 }

  - &M_N_range_nightly
    - { M:  9381, N:  9381 }
    - { M: 37017, N: 37017 }

  - &alpha_range_quick
    - { alpha:   1.0, alphai: -0.2 }
    - { alpha:  -0.5, alphai:  0.1 }

  - &alpha_range_checkin
    - { alpha:   2.0, alphai:  0.0 }
    - { alpha:   3.0, alphai: -1.0 }

  - &alpha_range_nightly
    - { alpha:   0.0,  alphai:  0.05 }
    - { alpha:  -0.02, alphai: -0.1 }

Tests:

#
# CATEGORY: PRE_CHECKIN
#

- name: bsrsm_bad_arg
  category: pre_checkin
  function: bsrsm_bad_arg
  precision: *single_double_precisions_complex_real

- name: bsrsm
  category: pre_checkin
  function: bsrsm
  precision: *single_double_precisions_complex_real
  M_N: *M_N_range_checkin
  K: [0, 1, 2, 8]
  block_dim: [5, 14, 71]
  alpha_alphai: *alpha_range_checkin
  direction: [rocsparse_direction_row]
  transA: [rocsparse_operation_none]
  transB: [rocsparse_operation_transpose]
  diag: [rocsparse_diag_type_unit]
  uplo: [rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_one]
  matrix: [rocsparse_matrix_random]

- name: bsrsm_file
  category: pre_checkin
  function: bsrsm
  precision: *single_double_precisions
  M: 1
  K: [41, 175]
  block_dim: [6, 23]
  alpha_alphai: *alpha_range_checkin
  direction: [rocsparse_direction_column]
  transA: [rocsparse_operation_transpose]
  transB: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit]
  uplo: [rocsparse_fill_mode_lower]
  apol: [rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [nos1,
             nos5,
             scircuit]

- name: bsrsm_file
  category: pre_checkin
  function: bsrsm
  precision: *double_only_precisions_complex
  M: 1
  K: [4, 18]
  block_dim: [3, 12]
  alpha_alphai: *alpha_range_checkin
  direction: [rocsparse_direction_row]
  transA: [rocsparse_operation_transpose]
  transB: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit]
  uplo: [rocsparse_fill_mode_lower]
  apol: [rocsparse_analysis_policy_reuse]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [mplate,
             Chevron3]

#
# CATEGORY: QUICK
#

- name: bsrsm
  category: quick
  function: bsrsm
  precision: *single_double_precisions_complex_real
  M_N: *M_N_range_quick
  K: [65, 153, 280]
  block_dim: [2, 14, 71]
  alpha_alphai: *alpha_range_quick
  direction: [rocsparse_direction_row]
  transA: [rocsparse_operation_none, rocsparse_operation_transpose]
  transB: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit]
  uplo: [rocsparse_fill_mode_lower]
  apol: [rocsparse_analysis_policy_reuse]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero]
  matrix: [rocsparse_matrix_random]

- name: bsrsm
  category: quick
  function: bsrsm
  precision: *single_double_precisions_complex_real
  M_N: *M_N_range_quick
  K: [65]
  block_dim: [2]
  alpha_alphai: *alpha_range_quick
  direction: [rocsparse_direction_row]
  transA: [rocsparse_operation_none, rocsparse_operation_transpose]
  transB: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit]
  uplo: [rocsparse_fill_mode_lower]
  apol: [rocsparse_analysis_policy_reuse]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero]
  matrix: [rocsparse_matrix_zero]

- name: bsrsm_file
  category: quick
  function: bsrsm
  precision: *single_double_precisions
  M: 1
  K: [63, 316]
  block_dim: [4, 27, 52]
  alpha_alphai: *alpha_range_quick
  direction: [rocsparse_direction_column]
  transA: [rocsparse_operation_none]
  transB: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit]
  uplo: [rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_one]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [nos2,
             nos4,
             nos6,
             nos7]

- name: bsrsm_file
  category: quick
  function: bsrsm
  precision: *single_double_precisions_complex
  M: 1
  K: [12, 27]
  block_dim: [5, 12, 22]
  alpha_alphai: *alpha_range_quick
  direction: [rocsparse_direction_row]
  transA: [rocsparse_operation_none]
  transB: [rocsparse_operation_transpose]
  diag: [rocsparse_diag_type_non_unit]
  uplo: [rocsparse_fill_mode_lower]
  apol: [rocsparse_analysis_policy_reuse]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [Chevron2]

#
# CATEGORY: NIGHTLY
#

- name: bsrsm
  category: nightly
  function: bsrsm
  precision: *single_double_precisions_complex_real
  M_N: *M_N_range_nightly
  K: [32, 135]
  block_dim: [5, 11, 33]
  alpha_alphai: *alpha_range_nightly
  direction: [rocsparse_direction_row]
  transA: [rocsparse_operation_none, rocsparse_operation_transpose]
  transB: [rocsparse_operation_transpose]
  diag: [rocsparse_diag_type_unit]
  uplo: [rocsparse_fill_mode_lower]
  apol: [rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero]
  matrix: [rocsparse_matrix_random]

- name: bsrsm_file
  category: nightly
  function: bsrsm
  precision: *single_double_precisions
  M: 1
  K: [16, 57]
  block_dim: [9, 15, 19]
  alpha_alphai: *alpha_range_nightly
  direction: [rocsparse_direction_column]
  transA: [rocsparse_operation_transpose]
  transB: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit]
  uplo: [rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_one]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [bmwcra_1,
             sme3Dc,
             shipsec1]

- name: bsrsm_file
  category: nightly
  function: bsrsm
  precision: *single_double_precisions_complex
  M: 1
  K: [3]
  block_dim: [2, 3, 11]
  alpha_alphai: *alpha_range_nightly
  direction: [rocsparse_direction_row]
  transA: [rocsparse_operation_none]
  transB: [rocsparse_operation_transpose]
  diag: [rocsparse_diag_type_non_unit]
  uplo: [rocsparse_fill_mode_lower]
  apol: [rocsparse_analysis_policy_reuse]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [Chevron4]
