Skip to content

Commit

Permalink
sycl - even more
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Sep 17, 2024
1 parent d94da85 commit b28e4ae
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions backends/sycl-ref/ceed-sycl-ref-operator.sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static int CeedOperatorSetupFields_Sycl(CeedQFunction qf, CeedOperator op, bool
Ceed ceed;
CeedSize q_size;
bool is_strided, skip_restriction;
CeedInt dim, size;
CeedInt size;
CeedOperatorField *op_fields;
CeedQFunctionField *qf_fields;

Expand All @@ -136,7 +136,6 @@ static int CeedOperatorSetupFields_Sycl(CeedQFunction qf, CeedOperator op, bool
CeedEvalMode eval_mode;
CeedVector vec;
CeedElemRestriction elem_rstr;
CeedBasis basis;

CeedCallBackend(CeedQFunctionFieldGetEvalMode(qf_fields[i], &eval_mode));

Expand Down Expand Up @@ -186,20 +185,21 @@ static int CeedOperatorSetupFields_Sycl(CeedQFunction qf, CeedOperator op, bool
CeedCallBackend(CeedVectorCreate(ceed, q_size, &q_vecs[i]));
break;
case CEED_EVAL_GRAD:
CeedCallBackend(CeedOperatorFieldGetBasis(op_fields[i], &basis));
CeedCallBackend(CeedQFunctionFieldGetSize(qf_fields[i], &size));
CeedCallBackend(CeedBasisGetDimension(basis, &dim));
CeedCallBackend(CeedBasisDestroy(&basis));
q_size = (CeedSize)num_elem * Q * size;
CeedCallBackend(CeedVectorCreate(ceed, q_size, &q_vecs[i]));
break;
case CEED_EVAL_WEIGHT: // Only on input fields
CeedCallBackend(CeedOperatorFieldGetBasis(op_fields[i], &basis));
case CEED_EVAL_WEIGHT: {
CeedBasis basis;

// Note: only on input fields
q_size = (CeedSize)num_elem * Q;
CeedCallBackend(CeedVectorCreate(ceed, q_size, &q_vecs[i]));
CeedCallBackend(CeedOperatorFieldGetBasis(op_fields[i], &basis));
CeedCallBackend(CeedBasisApply(basis, num_elem, CEED_NOTRANSPOSE, CEED_EVAL_WEIGHT, CEED_VECTOR_NONE, q_vecs[i]));
CeedCallBackend(CeedBasisDestroy(&basis));
break;
}
case CEED_EVAL_DIV:
break; // TODO: Not implemented
case CEED_EVAL_CURL:
Expand Down Expand Up @@ -466,8 +466,8 @@ static int CeedOperatorApplyAdd_Sycl(CeedOperator op, CeedVector in_vec, CeedVec
// Restrict
CeedCallBackend(CeedOperatorFieldGetVector(op_output_fields[i], &vec));
is_active = vec == CEED_VECTOR_ACTIVE;
CeedCallBackend(CeedOperatorFieldGetElemRestriction(op_output_fields[i], &elem_rstr));
if (is_active) vec = out_vec;
CeedCallBackend(CeedOperatorFieldGetElemRestriction(op_output_fields[i], &elem_rstr));
CeedCallBackend(CeedElemRestrictionApply(elem_rstr, CEED_TRANSPOSE, impl->e_vecs[i + impl->num_e_in], vec, request));
if (!is_active) CeedCallBackend(CeedVectorDestroy(&vec));
CeedCallBackend(CeedElemRestrictionDestroy(&elem_rstr));
Expand Down Expand Up @@ -667,13 +667,14 @@ static inline int CeedOperatorAssembleDiagonalSetup_Sycl(CeedOperator op) {
CeedCheck(!rstr_in || rstr_in == elem_rstr, ceed, CEED_ERROR_BACKEND,
"Backend does not implement multi-field non-composite operator diagonal assembly");
if (!rstr_in) CeedCallBackend(CeedElemRestrictionReferenceCopy(elem_rstr, &rstr_in));
CeedCallBackend(CeedElemRestrictionDestroy(&elem_rstr));
CeedCallBackend(CeedOperatorFieldGetBasis(op_fields[i], &basis));
CeedCheck(!basis_in || basis_in == basis, ceed, CEED_ERROR_BACKEND,
"Backend does not implement operator diagonal assembly with multiple active bases");
if (!basis_in) CeedCallBackend(CeedBasisReferenceCopy(basis, &basis_in));
CeedCallBackend(CeedBasisDestroy(&basis));
CeedCallBackend(CeedBasisGetNumComponents(basis_in, &num_comp));
CeedCallBackend(CeedBasisGetDimension(basis_in, &dim));
CeedCallBackend(CeedBasisDestroy(&basis));
CeedCallBackend(CeedQFunctionFieldGetEvalMode(qf_fields[i], &eval_mode));
switch (eval_mode) {
case CEED_EVAL_NONE:
Expand Down Expand Up @@ -713,6 +714,7 @@ static inline int CeedOperatorAssembleDiagonalSetup_Sycl(CeedOperator op) {
CeedCheck(!rstr_out || rstr_out == elem_rstr, ceed, CEED_ERROR_BACKEND,
"Backend does not implement multi-field non-composite operator diagonal assembly");
if (!rstr_out) CeedCallBackend(CeedElemRestrictionReferenceCopy(elem_rstr, &rstr_out));
CeedCallBackend(CeedElemRestrictionDestroy(&elem_rstr));
CeedCallBackend(CeedOperatorFieldGetBasis(op_fields[i], &basis));
CeedCheck(!basis_out || basis_out == basis, ceed, CEED_ERROR_BACKEND,
"Backend does not implement operator diagonal assembly with multiple active bases");
Expand Down Expand Up @@ -1082,7 +1084,7 @@ static int CeedSingleOperatorAssembleSetup_Sycl(CeedOperator op) {

CeedCallBackend(CeedOperatorFieldGetElemRestriction(output_fields[i], &elem_rstr));
if (!rstr_out) CeedCallBackend(CeedElemRestrictionReferenceCopy(elem_rstr, &rstr_out));
CeedCheck(!rstr_out || rstr_out == rstr_in, ceed, CEED_ERROR_BACKEND, "Backend does not implement multi-field non-composite operator assembly");
CeedCheck(rstr_out == rstr_in, ceed, CEED_ERROR_BACKEND, "Backend does not implement multi-field non-composite operator assembly");
CeedCallBackend(CeedElemRestrictionDestroy(&elem_rstr));
CeedCallBackend(CeedOperatorFieldGetBasis(output_fields[i], &basis));
CeedCheck(!basis_out || basis_out == basis, ceed, CEED_ERROR_BACKEND,
Expand Down

0 comments on commit b28e4ae

Please sign in to comment.