Skip to content

Commit

Permalink
gpu - fix min size of QF inputs for gen
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Aug 13, 2024
1 parent 11ee294 commit dddbd88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions backends/cuda-gen/ceed-cuda-gen-operator-build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions backends/hip-gen/ceed-hip-gen-operator-build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit dddbd88

Please sign in to comment.