# ########################################################################
# Copyright (c) 2019-2022 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.
#
# ########################################################################

# Data types are defined as either aliases to Python-recognized ctypes,
# or enums defined with c_int base clases and attributes.
Datatypes:
  - rocsparse_int: c_int
  - rocsparse_indextype:
      bases: [ c_int ]
      attr:
        u16: 1
        i32: 2
        i64: 3
  - rocsparse_datatype:
      bases: [ c_int ]
      attr:
        f32_r: 151
        f64_r: 152
        f32_c: 154
        f64_c: 155
  - { single: f32_r, double: f64_r }
  - { single complex: f32_c, double complex: f64_c }
  - rocsparse_matrix_init:
      bases: [ c_int ]
      attr:
        rocsparse_matrix_random: 0
        rocsparse_matrix_laplace_2d: 1
        rocsparse_matrix_laplace_3d: 2
        rocsparse_matrix_file_mtx: 3
        rocsparse_matrix_file_rocalution: 4
        rocsparse_matrix_zero: 5
        rocsparse_matrix_file_rocsparseio: 6
  - rocsparse_matrix_init_kind:
      bases: [ c_int ]
      attr:
        rocsparse_matrix_init_kind_default: 0
        rocsparse_matrix_init_kind_tunedavg: 1
  - rocsparse_operation:
      bases: [ c_int ]
      attr:
        rocsparse_operation_none: 111
        rocsparse_operation_transpose: 112
        rocsparse_operation_conjugate_transpose: 113
  - rocsparse_index_base:
      bases: [ c_int ]
      attr:
        rocsparse_index_base_zero: 0
        rocsparse_index_base_one: 1
  - rocsparse_matrix_type:
      bases: [ c_int ]
      attr:
        rocsparse_matrix_type_general: 0
        rocsparse_matrix_type_symmetric: 1
        rocsparse_matrix_type_hermitian: 2
        rocsparse_matrix_type_triangular: 3
  - rocsparse_diag_type:
      bases: [ c_int ]
      attr:
        rocsparse_diag_type_non_unit: 0
        rocsparse_diag_type_unit: 1
  - rocsparse_fill_mode:
      bases: [ c_int ]
      attr:
        rocsparse_fill_mode_lower: 0
        rocsparse_fill_mode_upper: 1
  - rocsparse_storage_mode:
      bases: [ c_int ]
      attr:
        rocsparse_storage_mode_sorted: 0
        rocsparse_storage_mode_unsorted: 1
  - rocsparse_action:
      bases: [ c_int ]
      attr:
        rocsparse_action_symbolic: 0
        rocsparse_action_numeric: 1
  - rocsparse_hyb_partition:
      bases: [ c_int ]
      attr:
        rocsparse_hyb_partition_auto: 0
        rocsparse_hyb_partition_user: 1
        rocsparse_hyb_partition_max: 2
  - rocsparse_analysis_policy:
      bases: [ c_int ]
      attr:
        rocsparse_analysis_policy_reuse: 0
        rocsparse_analysis_policy_force: 1
  - rocsparse_solve_policy:
      bases: [ c_int ]
      attr:
        rocsparse_solve_policy_auto: 0
  - rocsparse_direction:
      bases: [ c_int ]
      attr:
        rocsparse_direction_row: 0
        rocsparse_direction_column: 1
  - rocsparse_order:
      bases: [c_int ]
      attr:
        rocsparse_order_row: 0
        rocsparse_order_column: 1
  - rocsparse_format:
      bases: [c_int ]
      attr:
        rocsparse_format_coo: 0
        rocsparse_format_coo_aos: 1
        rocsparse_format_csr: 2
        rocsparse_format_csc: 3
        rocsparse_format_ell: 4
  - rocsparse_sddmm_alg:
      bases: [c_int ]
      attr:
        rocsparse_sddmm_alg_default: 0
  - rocsparse_spmv_alg:
      bases: [c_int ]
      attr:
        rocsparse_spmv_alg_default: 0
        rocsparse_spmv_alg_coo: 1
        rocsparse_spmv_alg_csr_adaptive: 2
        rocsparse_spmv_alg_csr_stream: 3
        rocsparse_spmv_alg_ell: 4
  - rocsparse_spsv_alg:
      bases: [c_int ]
      attr:
        rocsparse_spsv_alg_default: 0
  - rocsparse_spsm_alg:
      bases: [c_int ]
      attr:
        rocsparse_spsm_alg_default: 0
  - rocsparse_spmm_alg:
      bases: [c_int ]
      attr:
        rocsparse_spmm_alg_default: 0
        rocsparse_spmm_alg_csr: 1
        rocsparse_spmm_alg_coo_segmented: 2
        rocsparse_spmm_alg_coo_atomic: 3
        rocsparse_spmm_alg_csr_row_split: 4
        rocsparse_spmm_alg_csr_merge: 5
        rocsparse_spmm_alg_coo_segmented_atomic: 6
        rocsparse_spmm_alg_bell: 7

  - rocsparse_spgemm_alg:
      bases: [c_int ]
      attr:
        rocsparse_spgemm_alg_default: 0
  - rocsparse_sparse_to_dense_alg:
      bases: [c_int ]
      attr:
        rocsparse_sparse_to_dense_alg_default: 0
  - rocsparse_dense_to_sparse_alg:
      bases: [c_int ]
      attr:
        rocsparse_dense_to_sparse_alg_default: 0
  - rocsparse_gtsv_interleaved_alg:
      bases: [c_int ]
      attr:
        rocsparse_gtsv_interleaved_alg_default: 0
        rocsparse_gtsv_interleaved_alg_thomas: 1
        rocsparse_gtsv_interleaved_alg_lu: 2
        rocsparse_gtsv_interleaved_alg_qr: 3
  - rocsparse_gpsv_interleaved_alg:
      bases: [c_int ]
      attr:
        rocsparse_gpsv_interleaved_alg_default: 0
        rocsparse_gpsv_interleaved_alg_qr: 1

indextype i64: &i32
  - index_type_I: i32
    index_type_J: i32

indextype i64: &i64i32
  - index_type_I: i64
    index_type_J: i32

indextype i64: &i64
  - index_type_I: i64
    index_type_J: i64

indextype i32 and i64: &i32_i64
  - index_type_I: i32
    index_type_J: i32
  - index_type_I: i64
    index_type_J: i64

indextype i32 i64i32 mixture and i64: &i32i32_i64i32_i64i64
  - index_type_I: i32
    index_type_J: i32
  - index_type_I: i64
    index_type_J: i32
  - index_type_I: i64
    index_type_J: i64

Real precisions: &real_precisions
  - &single_precision
    { compute_type: f32_r }
  - &double_precision
    { compute_type: f64_r }

Complex precisions: &complex_precisions
  - &single_precision_complex
    { compute_type: f32_c }
  - &double_precision_complex
    { compute_type: f64_c }

C precisions real: &single_only_precisions
  - *single_precision

C precisions real: &double_only_precisions
  - *double_precision

C precisions real: &single_double_precisions
  - *single_precision
  - *double_precision

C precisions complex: &single_only_precisions_complex
  - *single_precision_complex

C precisions complex: &double_only_precisions_complex
  - *double_precision_complex

C precisions complex: &single_double_precisions_complex
  - *single_precision_complex
  - *double_precision_complex

C precisions complex and real: &single_double_precisions_complex_real
  - *single_precision
  - *double_precision
  - *single_precision_complex
  - *double_precision_complex

# The Arguments struct passed directly to C++. See rocsparse_arguments.hpp.
# The order of the entries is significant, so it can't simply be a dictionary.
# The types on the RHS are eval'd for Python-recognized types including ctypes
# and datatypes defined in Datatypes above. T*n represents array of length n.
Arguments:
  - M: rocsparse_int
  - N: rocsparse_int
  - K: rocsparse_int
  - nnz: rocsparse_int
  - block_dim: rocsparse_int
  - row_block_dimA: rocsparse_int
  - col_block_dimA: rocsparse_int
  - row_block_dimB: rocsparse_int
  - col_block_dimB: rocsparse_int
  - dimx: rocsparse_int
  - dimy: rocsparse_int
  - dimz: rocsparse_int
  - index_type_I: rocsparse_indextype
  - index_type_J: rocsparse_indextype
  - compute_type: rocsparse_datatype
  - alpha: c_double
  - alphai: c_double
  - beta: c_double
  - betai: c_double
  - threshold: c_double
  - percentage: c_double
  - transA: rocsparse_operation
  - transB: rocsparse_operation
  - baseA: rocsparse_index_base
  - baseB: rocsparse_index_base
  - baseC: rocsparse_index_base
  - baseD: rocsparse_index_base
  - action: rocsparse_action
  - part: rocsparse_hyb_partition
  - matrix_type: rocsparse_matrix_type
  - diag: rocsparse_diag_type
  - uplo: rocsparse_fill_mode
  - storage: rocsparse_storage_mode
  - apol: rocsparse_analysis_policy
  - spol: rocsparse_solve_policy
  - direction: rocsparse_direction
  - order: rocsparse_order
  - format: rocsparse_format
  - sddmm_alg: rocsparse_sddmm_alg
  - spmv_alg: rocsparse_spmv_alg
  - spsv_alg: rocsparse_spsv_alg
  - spsm_alg: rocsparse_spsm_alg
  - spmm_alg: rocsparse_spmm_alg
  - spgemm_alg: rocsparse_spgemm_alg
  - sparse_to_dense_alg: rocsparse_sparse_to_dense_alg
  - dense_to_sparse_alg: rocsparse_dense_to_sparse_alg
  - gtsv_interleaved_alg: rocsparse_gtsv_interleaved_alg
  - gpsv_interleaved_alg: rocsparse_gpsv_interleaved_alg
  - matrix: rocsparse_matrix_init
  - matrix_init_kind: rocsparse_matrix_init_kind
  - unit_check: rocsparse_int
  - timing: rocsparse_int
  - iters: rocsparse_int
  - denseld: rocsparse_int
  - batch_count: rocsparse_int
  - batch_stride: rocsparse_int
  - algo: c_uint
  - numericboost: c_int
  - boosttol: c_double
  - boostval: c_double
  - boostvali: c_double
  - tolm: c_double
  - filename: c_char*64
  - function: c_char*64
  - name: c_char*64
  - category: c_char*32

# These named dictionary lists [ {dict1}, {dict2}, etc. ] supply subsets of
# test arguments in a structured way. The dictionaries are applied to the test
# one at a time, to generate combinations.  If one of this table's entries is
# a dictionary of size one, it means that the argument named by its key takes
# on values paired with argument named by its value. For example:
#
# - function: precision
#
# when used with the code:
#
# function:
#   func1: prec1
#   func2: prec2
#   func3: prec3
#
# causes (function, precision) to take on the values (func1, prec1),
# (func2, prec2), (func3, prec3), etc.

Dictionary lists to expand:
  - arguments
  - M_N
  - M_N_K
  - dimx_dimy_dimz
  - transA_transB
  - alpha_beta
  - alpha_alphai
  - beta_betai
  - alphai_betai
  - boostval_boostvali
  - matrix_size
  - indextype
  - precision
  - function: precision

# In case an array argument needs to be passed directly to C as an array,
# it needs to be listed here to avoid being expanded into multiple test
# cases with each of its elements.
Lists to not expand:
  - e.g., an array argument not to be expanded

# Defaults
Defaults:
  M: -1
  N: -1
  K: -1
  nnz: -1
  block_dim: 2
  row_block_dimA: 2
  col_block_dimA: 2
  row_block_dimB: 2
  col_block_dimB: 2
  dimx: 0
  dimy: 0
  dimz: 0
  alpha: 1.0
  alphai: 0.0
  beta: 0.0
  betai: 0.0
  threshold: 1.0
  percentage: 0.0
  transA: rocsparse_operation_none
  transB: rocsparse_operation_none
  baseA: rocsparse_index_base_zero
  baseB: rocsparse_index_base_zero
  baseC: rocsparse_index_base_zero
  baseD: rocsparse_index_base_zero
  action: rocsparse_action_numeric
  part: rocsparse_hyb_partition_auto
  matrix_type: rocsparse_matrix_type_general
  diag: rocsparse_diag_type_non_unit
  uplo: rocsparse_fill_mode_lower
  storage: rocsparse_storage_mode_sorted
  apol: rocsparse_analysis_policy_reuse
  spol: rocsparse_solve_policy_auto
  direction: rocsparse_direction_row
  order: rocsparse_order_column
  format: rocsparse_format_coo
  sddmm_alg: rocsparse_sddmm_alg_default
  spmv_alg: rocsparse_spmv_alg_default
  spsv_alg: rocsparse_spsv_alg_default
  spsm_alg: rocsparse_spsm_alg_default
  spmm_alg: rocsparse_spmm_alg_default
  spgemm_alg: rocsparse_spgemm_alg_default
  sparse_to_dense_alg: rocsparse_sparse_to_dense_alg_default
  dense_to_sparse_alg: rocsparse_dense_to_sparse_alg_default
  gtsv_interleaved_alg: rocsparse_gtsv_interleaved_alg_default
  gpsv_interleaved_alg: rocsparse_gpsv_interleaved_alg_default
  matrix: rocsparse_matrix_random
  matrix_init_kind: rocsparse_matrix_init_kind_default
  unit_check: 1
  timing: 0
  iters: 10
  denseld: -1
  batch_count: -1
  batch_stride: -1
  algo: 0
  numericboost: 0
  boosttol: 0.0
  boostval: 1.0
  boostvali: 0.0
  tolm: 1.0
  workspace_size: 0
  category: nightly
  filename: '*'
  name: '*'
  index_type_I: i32
  index_type_J: i32
  compute_type: f32_r
