1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
384a01de5SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
584a01de5SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed
784a01de5SJeremy L Thompson
849aac155SJeremy L Thompson #include <ceed.h>
9ec3da8bcSJed Brown #include <ceed/backend.h>
103d576824SJeremy L Thompson #include <stdbool.h>
113d576824SJeremy L Thompson #include <string.h>
122b730f8bSJeremy L Thompson
1384a01de5SJeremy L Thompson #include "ceed-avx.h"
1484a01de5SJeremy L Thompson
15f10650afSjeremylt //------------------------------------------------------------------------------
16f10650afSjeremylt // Backend Init
17f10650afSjeremylt //------------------------------------------------------------------------------
CeedInit_Avx(const char * resource,Ceed ceed)1884a01de5SJeremy L Thompson static int CeedInit_Avx(const char *resource, Ceed ceed) {
19ad70ee2cSJeremy L Thompson Ceed ceed_ref;
20ad70ee2cSJeremy L Thompson
216574a04fSJeremy L Thompson CeedCheck(!strcmp(resource, "/cpu/self") || !strcmp(resource, "/cpu/self/avx/serial"), ceed, CEED_ERROR_BACKEND,
226574a04fSJeremy L Thompson "AVX backend cannot use resource: %s", resource);
232b730f8bSJeremy L Thompson CeedCallBackend(CeedSetDeterministic(ceed, true));
2484a01de5SJeremy L Thompson
25ea61e9acSJeremy L Thompson // Create reference Ceed that implementation will be dispatched through unless overridden
262b730f8bSJeremy L Thompson CeedCallBackend(CeedInit("/cpu/self/opt/serial", &ceed_ref));
272b730f8bSJeremy L Thompson CeedCallBackend(CeedSetDelegate(ceed, ceed_ref));
289bc66399SJeremy L Thompson CeedCallBackend(CeedDestroy(&ceed_ref));
2984a01de5SJeremy L Thompson
30c8a55531SSebastian Grimberg CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "TensorContractCreate", CeedTensorContractCreate_Avx));
31e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS;
3284a01de5SJeremy L Thompson }
3384a01de5SJeremy L Thompson
34f10650afSjeremylt //------------------------------------------------------------------------------
35f10650afSjeremylt // Backend Register
36f10650afSjeremylt //------------------------------------------------------------------------------
CeedRegister_Avx_Serial(void)372b730f8bSJeremy L Thompson CEED_INTERN int CeedRegister_Avx_Serial(void) { return CeedRegister("/cpu/self/avx/serial", CeedInit_Avx, 35); }
382a86cc9dSSebastian Grimberg
39f10650afSjeremylt //------------------------------------------------------------------------------
40