1 // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3 // 4 // SPDX-License-Identifier: BSD-2-Clause 5 // 6 // This file is part of CEED: http://github.com/ceed 7 8 #ifndef _ceed_xsmm_h 9 #define _ceed_xsmm_h 10 11 #include <ceed.h> 12 #include <ceed/backend.h> 13 #include <ceed/hash.h> 14 #include <libxsmm.h> 15 16 #if !defined(LIBXSMM_VERSION_GE) 17 #define LIBXSMM_VERSION_GE(major, minor, update, patch) \ 18 (LIBXSMM_VERSION_MAJOR > major || \ 19 (LIBXSMM_VERSION_MAJOR == major && \ 20 (LIBXSMM_VERSION_MINOR > minor || (LIBXSMM_VERSION_MINOR == minor && \ 21 (LIBXSMM_VERSION_UPDATE > update || (LIBXSMM_VERSION_UPDATE == update && LIBXSMM_VERSION_PATCH >= patch)))))) 22 #endif 23 24 #if LIBXSMM_VERSION_GE(1, 17, 0, 0) 25 #define LIBXSMM_MMFUNCTION_KERNEL(a, b, c) kernel(a, b, c) 26 #else 27 #define LIBXSMM_MMFUNCTION_KERNEL(a, b, c) kernel(a, b, c, NULL, NULL, NULL) 28 #endif 29 30 // Instantiate khash structs and methods 31 CeedHashIJKLMInit(f32, libxsmm_smmfunction) CeedHashIJKLMInit(f64, libxsmm_dmmfunction) 32 33 typedef struct { 34 bool is_tensor; 35 CeedInt P, Q, dim; 36 khash_t(f32) * lookup_f32; 37 khash_t(f64) * lookup_f64; 38 } CeedTensorContract_Xsmm; 39 40 CEED_INTERN int CeedTensorContractCreate_f32_Xsmm(CeedBasis basis, CeedTensorContract contract); 41 42 CEED_INTERN int CeedTensorContractCreate_f64_Xsmm(CeedBasis basis, CeedTensorContract contract); 43 44 #endif // _ceed_xsmm_h 45