From dddbd88968b0ad7202a244a513523879e75dc066 Mon Sep 17 00:00:00 2001 From: Jeremy L Thompson Date: Tue, 16 Jul 2024 15:34:45 -0600 Subject: [PATCH] gpu - fix min size of QF inputs for gen --- backends/cuda-gen/ceed-cuda-gen-operator-build.cpp | 10 +++++----- backends/hip-gen/ceed-hip-gen-operator-build.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backends/cuda-gen/ceed-cuda-gen-operator-build.cpp b/backends/cuda-gen/ceed-cuda-gen-operator-build.cpp index 2fa119a93a..28583b103b 100644 --- a/backends/cuda-gen/ceed-cuda-gen-operator-build.cpp +++ b/backends/cuda-gen/ceed-cuda-gen-operator-build.cpp @@ -549,16 +549,16 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C // Input and output buffers code << "\n // -- QFunction inputs and outputs\n"; code << " // ---- Inputs\n"; - code << " CeedScalar* in[" << num_input_fields << "];\n"; + code << " CeedScalar *inputs[" << CeedIntMax(num_input_fields, 1) << "];\n"; for (CeedInt i = 0; i < num_input_fields; i++) { code << " // ------ Input field " << i << "\n"; - code << " in[" << i << "] = r_s_in_" << i << ";\n"; + code << " inputs[" << i << "] = r_s_in_" << i << ";\n"; } code << " // ---- Outputs\n"; - code << " CeedScalar* out[" << num_output_fields << "];\n"; + code << " CeedScalar *outputs[" << CeedIntMax(num_output_fields, 1) << "];\n"; for (CeedInt i = 0; i < num_output_fields; i++) { code << " // ------ Output field " << i << "\n"; - code << " out[" << i << "] = r_s_out_" << i << ";\n"; + code << " outputs[" << i << "] = r_s_out_" << i << ";\n"; } // Apply QFunction @@ -569,7 +569,7 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C } else { code << "Q_1d"; } - code << ", in, out);\n"; + code << ", inputs, outputs);\n"; // Copy or apply transpose grad, if needed if (use_3d_slices) { diff --git a/backends/hip-gen/ceed-hip-gen-operator-build.cpp b/backends/hip-gen/ceed-hip-gen-operator-build.cpp index 055486928a..623c3deb9a 100644 --- a/backends/hip-gen/ceed-hip-gen-operator-build.cpp +++ b/backends/hip-gen/ceed-hip-gen-operator-build.cpp @@ -576,16 +576,16 @@ static int CeedOperatorBuildKernelQFunction_Hip_gen(std::ostringstream &code, Ce // Input and output buffers code << "\n // -- QFunction inputs and outputs\n"; code << " // ---- Inputs\n"; - code << " CeedScalar* in[" << num_input_fields << "];\n"; + code << " CeedScalar *inputs[" << CeedIntMax(num_input_fields, 1) << "];\n"; for (CeedInt i = 0; i < num_input_fields; i++) { code << " // ------ Input field " << i << "\n"; - code << " in[" << i << "] = r_s_in_" << i << ";\n"; + code << " inputs[" << i << "] = r_s_in_" << i << ";\n"; } code << " // ---- Outputs\n"; - code << " CeedScalar* out[" << num_output_fields << "];\n"; + code << " CeedScalar *outputs[" << CeedIntMax(num_output_fields, 1) << "];\n"; for (CeedInt i = 0; i < num_output_fields; i++) { code << " // ------ Output field " << i << "\n"; - code << " out[" << i << "] = r_s_out_" << i << ";\n"; + code << " outputs[" << i << "] = r_s_out_" << i << ";\n"; } // Apply QFunction @@ -596,7 +596,7 @@ static int CeedOperatorBuildKernelQFunction_Hip_gen(std::ostringstream &code, Ce } else { code << "Q_1d"; } - code << ", in, out);\n"; + code << ", inputs, outputs);\n"; // Copy or apply transpose grad, if needed if (use_3d_slices) {