diff --git a/core/base/batch_instantiation.hpp b/core/base/batch_instantiation.hpp index 6ea3faa104e..a3e00d6ca99 100644 --- a/core/base/batch_instantiation.hpp +++ b/core/base/batch_instantiation.hpp @@ -20,14 +20,14 @@ namespace batch { // just make the call list more consistent #define GKO_CALL(_macro, ...) _macro(__VA_ARGS__) -#define GKO_BATCH_INSTANTIATE_PRECONDITIONER(_next, ...) \ - _next(__VA_ARGS__, gko::batch::matrix::Identity); \ - _next(__VA_ARGS__, gko::batch::preconditioner::Jacobi) +#define GKO_BATCH_INSTANTIATE_PRECONDITIONER(_next, ...) \ + _next(GKO_INDIRECT(__VA_ARGS__), gko::batch::matrix::Identity); \ + _next(GKO_INDIRECT(__VA_ARGS__), gko::batch::preconditioner::Jacobi) -#define GKO_BATCH_INSTANTIATE_MATRIX(_next, ...) \ - _next(__VA_ARGS__, gko::batch::matrix::Ell); \ - _next(__VA_ARGS__, gko::batch::matrix::Dense); \ - _next(__VA_ARGS__, gko::batch::matrix::Csr) +#define GKO_BATCH_INSTANTIATE_MATRIX(_next, ...) \ + _next(GKO_INDIRECT(__VA_ARGS__), gko::batch::matrix::Ell); \ + _next(GKO_INDIRECT(__VA_ARGS__), gko::batch::matrix::Dense); \ + _next(GKO_INDIRECT(__VA_ARGS__), gko::batch::matrix::Csr) /** * Instantiates a template for each valid combination of value type, batch @@ -42,10 +42,10 @@ namespace batch { * * @note the second and third arguments only accept the base type.s */ -#define GKO_INSTANTIATE_FOR_BATCH_VALUE_MATRIX_PRECONDITIONER(...) \ - GKO_CALL(GKO_BATCH_INSTANTIATE_MATRIX, \ - GKO_BATCH_INSTANTIATE_PRECONDITIONER, \ - GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_VARGS, __VA_ARGS__) +#define GKO_INSTANTIATE_FOR_BATCH_VALUE_MATRIX_PRECONDITIONER(...) \ + GKO_CALL( \ + GKO_BATCH_INSTANTIATE_MATRIX, GKO_BATCH_INSTANTIATE_PRECONDITIONER, \ + GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_VARGS, GKO_INDIRECT(__VA_ARGS__)) } // namespace batch diff --git a/core/solver/batch_dispatch.hpp b/core/solver/batch_dispatch.hpp index 2a438f9aafd..5b9359fb92f 100644 --- a/core/solver/batch_dispatch.hpp +++ b/core/solver/batch_dispatch.hpp @@ -166,27 +166,27 @@ enum class log_type { simple_convergence_completion }; #define GKO_BATCH_INSTANTIATE_STOP(_next, ...) \ - _next(__VA_ARGS__, \ + _next(GKO_INDIRECT(__VA_ARGS__), \ ::gko::batch::solver::device::batch_stop::SimpleAbsResidual); \ - _next(__VA_ARGS__, \ + _next(GKO_INDIRECT(__VA_ARGS__), \ ::gko::batch::solver::device::batch_stop::SimpleRelResidual) #define GKO_BATCH_INSTANTIATE_DEVICE_PRECONDITIONER(_next, ...) \ - _next(__VA_ARGS__, \ + _next(GKO_INDIRECT(__VA_ARGS__), \ ::gko::batch::solver::device::batch_preconditioner::Identity); \ - _next(__VA_ARGS__, \ + _next(GKO_INDIRECT(__VA_ARGS__), \ ::gko::batch::solver::device::batch_preconditioner::ScalarJacobi); \ - _next(__VA_ARGS__, \ + _next(GKO_INDIRECT(__VA_ARGS__), \ ::gko::batch::solver::device::batch_preconditioner::BlockJacobi) #define GKO_BATCH_INSTANTIATE_LOGGER(_next, ...) \ - _next(__VA_ARGS__, \ + _next(GKO_INDIRECT(__VA_ARGS__), \ ::gko::batch::solver::device::batch_log::SimpleFinalLogger) -#define GKO_BATCH_INSTANTIATE_MATRIX_BATCH(_next, ...) \ - _next(__VA_ARGS__, batch::matrix::ell::uniform_batch); \ - _next(__VA_ARGS__, batch::matrix::dense::uniform_batch); \ - _next(__VA_ARGS__, batch::matrix::csr::uniform_batch) +#define GKO_BATCH_INSTANTIATE_MATRIX_BATCH(_next, ...) \ + _next(GKO_INDIRECT(__VA_ARGS__), batch::matrix::ell::uniform_batch); \ + _next(GKO_INDIRECT(__VA_ARGS__), batch::matrix::dense::uniform_batch); \ + _next(GKO_INDIRECT(__VA_ARGS__), batch::matrix::csr::uniform_batch) /** * Passes each valid configuration of batch solver template parameter to a @@ -199,7 +199,8 @@ enum class log_type { simple_convergence_completion }; GKO_CALL(GKO_BATCH_INSTANTIATE_MATRIX_BATCH, GKO_BATCH_INSTANTIATE_LOGGER, \ GKO_BATCH_INSTANTIATE_DEVICE_PRECONDITIONER, \ GKO_BATCH_INSTANTIATE_STOP, \ - GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_VARGS, __VA_ARGS__) + GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_VARGS, \ + GKO_INDIRECT(__VA_ARGS__)) /** * Handles dispatching to the correct instantiation of a batched solver