File: getCacheOpts.h

package info (click to toggle)
intel-graphics-compiler2 2.28.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792,744 kB
  • sloc: cpp: 5,761,745; ansic: 466,928; lisp: 312,143; python: 114,790; asm: 44,736; pascal: 10,930; sh: 8,033; perl: 7,914; ml: 3,625; awk: 3,523; yacc: 2,747; javascript: 2,667; lex: 1,898; f90: 1,028; cs: 573; xml: 474; makefile: 344; objc: 162
file content (98 lines) | stat: -rw-r--r-- 3,274 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*========================== begin_copyright_notice ============================

Copyright (C) 2021 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

/**
 * @file getCacheOpts.h
 *
 * @section DESCRIPTION
 *
 * This file contains declarations of utility functions which return the cache options
 * for a given load or store instruction.
 */
#pragma once

#include "visa_igc_common_header.h" // for LSC_L1_L3_CC

#include "common/LLVMWarningsPush.hpp" // for suppressing LLVM warnings
#include <optional>                    // for Optional
#include "llvm/IR/Instructions.h"      // for llvm::StoreInst, llvm::LoadInst
#include "common/LLVMWarningsPop.hpp"  // for suppressing LLVM warnings

#include "Compiler/CodeGenPublic.h"

namespace IGC {
/**
 * @param Ptr        Pointer to memory
 * @param Ctx        Context
 *
 * @return  Optional containing the cache options for that particular store instruction
 *          if the RTRegion is RTAsynctack, SWStack, SWHotZone, RTSynctack
 *          or empty Optional if the RTRegion cannot be known, or if it is a RTGlobals or LocalArgs
 */
std::optional<LSC_L1_L3_CC> getCacheOptsStorePolicy(const llvm::Value *Ptr, const CodeGenContext &Ctx);

/**
 * @param storeInst  LLVM IR store instruction
 * @param Ctx        Context
 *
 * @return  Optional containing the cache options for that particular store instruction
 *          if the RTRegion is RTAsynctack, SWStack, SWHotZone, RTSynctack
 *          or empty Optional if the RTRegion cannot be known, or if it is a RTGlobals or LocalArgs
 */
std::optional<LSC_L1_L3_CC> getCacheOptsStorePolicy(const llvm::StoreInst &storeInst, const CodeGenContext &Ctx);

/**
 * @param Ptr       Pointer to memory
 * @param Ctx        Context
 *
 * @return  Optional containing the cache options for that particular load instruction
 *          if the RTRegion is RTAsynctack, SWStack, SWHotZone, RTSynctack
 *          or empty Optional if the RTRegion cannot be known, or if it is a RTGlobals or LocalArgs
 */
std::optional<LSC_L1_L3_CC> getCacheOptsLoadPolicy(const llvm::Value *Ptr, const CodeGenContext &Ctx);

/**
 * @param loadInst  LLVM IR load instruction
 * @param Ctx        Context
 *
 * @return  Optional containing the cache options for that particular load instruction
 *          if the RTRegion is RTAsynctack, SWStack, SWHotZone, RTSynctack
 *          or empty Optional if the RTRegion cannot be known, or if it is a RTGlobals or LocalArgs
 */
std::optional<LSC_L1_L3_CC> getCacheOptsLoadPolicy(const llvm::LoadInst &loadInst, const CodeGenContext &Ctx);

/**
 * @return the store cache policy for the RTStack
 */
LSC_L1_L3_CC RTStackStorePolicy();

/**
 * @return the store cache policy for the SWHotZone
 */
LSC_L1_L3_CC SWHotZoneStorePolicy();

/**
 * @return the store cache policy for the SWStack
 */
LSC_L1_L3_CC SWStackStorePolicy(const CodeGenContext &Ctx);

/**
 * @return the load cache policy for the RTStack
 */
LSC_L1_L3_CC RTStackLoadPolicy();

/**
 * @return the load cache policy for the SWHotZone
 */
LSC_L1_L3_CC SWHotZoneLoadPolicy();

/**
 * @return the load cache policy for the SWStack
 */
LSC_L1_L3_CC SWStackLoadPolicy(const CodeGenContext &Ctx);
} // namespace IGC