1 /* ************************************************************************ 2 * Copyright 2013 Advanced Micro Devices, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * ************************************************************************/ 16 17 18 /* 19 * Memory usage pattern related definitions 20 */ 21 22 #ifndef MEMPAT_H_ 23 #define MEMPAT_H_ 24 25 #include <solver.h> 26 27 enum { 28 MAX_MEMORY_PATTERNS = 16 29 }; 30 31 /** 32 * @internal 33 * @brief Memory level identifiers 34 * 35 * @ingroup SOLVERIF 36 */ 37 typedef enum CLMemLevel { 38 CLMEM_LEVEL_LDS = 0x01, /**< Local data storage */ 39 CLMEM_LEVEL_L1 = 0x02, /**< L1 cache */ 40 CLMEM_LEVEL_L2 = 0x04 /**< L2 cache */ 41 } CLMemLevel; 42 43 /** 44 * @internal 45 * @brief Memory type identifiers 46 * 47 * @ingroup SOLVERIF 48 */ 49 typedef enum CLMemType { 50 CLMEM_GLOBAL_MEMORY, 51 CLMEM_LOCAL_MEMORY, 52 CLMEM_IMAGE, 53 // FIXME: it's for backward compatibility, remove after blkmul deprecation 54 CLMEM_BUFFER = CLMEM_LOCAL_MEMORY 55 } CLMemType; 56 57 // memory levels set 58 typedef unsigned int meml_set_t; 59 60 /* 61 * FIXME: deprecate cuLevel and thLevel 62 */ 63 64 /** 65 * @internal 66 * @brief Solver memory pattern description structure 67 * 68 * The structure decribes memory using features and used 69 * by frontend at choosing of solving strategy and decomposition 70 * block sizes 71 * 72 * @ingroup SOLVERIF 73 */ 74 typedef struct MemoryPattern { 75 const char *name; /**< Pattern's name */ 76 unsigned int nrLevels; /**< Decomposition levels number */ 77 /** Level a problem is decomposed among compute units at */ 78 int cuLevel; 79 /** Level a problem is decomposed among threads within single compute unit */ 80 int thLevel; 81 SolverOps *sops; /**< Solver operations */ 82 /** extra information specific for the application field */ 83 void *extra; 84 } MemoryPattern; 85 86 #endif /* MEMPAT_H_ */ 87