xref: /libCEED/rust/libceed-sys/c-src/backends/xsmm/ceed-xsmm.h (revision 318af0d1a760765edef6872663e190e11f82cd8e)
18d713cf6Sjeremylt // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
28d713cf6Sjeremylt // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
38d713cf6Sjeremylt // All Rights reserved. See files LICENSE and NOTICE for details.
48d713cf6Sjeremylt //
58d713cf6Sjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software
68d713cf6Sjeremylt // libraries and APIs for efficient high-order finite element and spectral
78d713cf6Sjeremylt // element discretizations for exascale applications. For more information and
88d713cf6Sjeremylt // source code availability see http://github.com/ceed.
98d713cf6Sjeremylt //
108d713cf6Sjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
118d713cf6Sjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office
128d713cf6Sjeremylt // of Science and the National Nuclear Security Administration) responsible for
138d713cf6Sjeremylt // the planning and preparation of a capable exascale ecosystem, including
148d713cf6Sjeremylt // software, applications, hardware, advanced system engineering and early
158d713cf6Sjeremylt // testbed platforms, in support of the nation's exascale computing imperative.
168d713cf6Sjeremylt 
173d576824SJeremy L Thompson #ifndef _ceed_xsmm_h
183d576824SJeremy L Thompson #define _ceed_xsmm_h
193d576824SJeremy L Thompson 
20*318af0d1SJeremy L Thompson #define LIBXSMM_VERSION_GE(major, minor, update, patch)                           \
21*318af0d1SJeremy L Thompson   (LIBXSMM_VERSION_MAJOR > major ||                                               \
22*318af0d1SJeremy L Thompson    (LIBXSMM_VERSION_MAJOR == major &&                                             \
23*318af0d1SJeremy L Thompson     (LIBXSMM_VERSION_MINOR > minor ||                                             \
24*318af0d1SJeremy L Thompson      (LIBXSMM_VERSION_MINOR == minor &&                                           \
25*318af0d1SJeremy L Thompson       (LIBXSMM_VERSION_UPDATE > update ||                                         \
26*318af0d1SJeremy L Thompson        (LIBXSMM_VERSION_UPDATE == update && LIBXSMM_VERSION_PATCH >= patch ))))))
27*318af0d1SJeremy L Thompson 
28*318af0d1SJeremy L Thompson #if LIBXSMM_VERSION_GE(1, 17, 0, 0)
29*318af0d1SJeremy L Thompson # define LIBXSMM_MMFUNCTION_KERNEL(a, b, c) kernel(a, b, c)
30*318af0d1SJeremy L Thompson #else
31*318af0d1SJeremy L Thompson # define LIBXSMM_MMFUNCTION_KERNEL(a, b, c) kernel(a, b, c, NULL, NULL, NULL)
32*318af0d1SJeremy L Thompson #endif
33*318af0d1SJeremy L Thompson 
34ec3da8bcSJed Brown #include <ceed/ceed.h>
35ec3da8bcSJed Brown #include <ceed/backend.h>
36ec3da8bcSJed Brown #include <ceed/hash.h>
373d0fd664Sjeremylt #include <libxsmm.h>
388d713cf6Sjeremylt 
3920aaa365SJeremy L Thompson // Instantiate khash structs and methods
4080a9ef05SNatalie Beams CeedHashIJKLMInit(f32, libxsmm_smmfunction)
4180a9ef05SNatalie Beams CeedHashIJKLMInit(f64, libxsmm_dmmfunction)
4220aaa365SJeremy L Thompson 
433d0fd664Sjeremylt typedef struct {
44d1d35e2fSjeremylt   bool is_tensor;
4520aaa365SJeremy L Thompson   CeedInt P, Q, dim;
4680a9ef05SNatalie Beams   khash_t(f32) *lookup_f32;
4780a9ef05SNatalie Beams   khash_t(f64) *lookup_f64;
483d0fd664Sjeremylt } CeedTensorContract_Xsmm;
493d0fd664Sjeremylt 
5080a9ef05SNatalie Beams CEED_INTERN int CeedTensorContractCreate_f32_Xsmm(CeedBasis basis,
5180a9ef05SNatalie Beams     CeedTensorContract contract);
5280a9ef05SNatalie Beams 
5380a9ef05SNatalie Beams CEED_INTERN int CeedTensorContractCreate_f64_Xsmm(CeedBasis basis,
54c71e1dcdSjeremylt     CeedTensorContract contract);
553d576824SJeremy L Thompson 
563d576824SJeremy L Thompson #endif // _ceed_xsmm_h
57