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
99
100
101
102
103
104
105
106
107
108
|
/*
* Copyright (c) 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef GEN_L3_CONFIG_H
#define GEN_L3_CONFIG_H
#include <stdio.h>
#include "dev/gen_device_info.h"
/**
* Chunk of L3 cache reserved for some specific purpose.
*/
enum gen_l3_partition {
/** Shared local memory. */
GEN_L3P_SLM = 0,
/** Unified return buffer. */
GEN_L3P_URB,
/** Union of DC and RO. */
GEN_L3P_ALL,
/** Data cluster RW partition. */
GEN_L3P_DC,
/** Union of IS, C and T. */
GEN_L3P_RO,
/** Instruction and state cache. */
GEN_L3P_IS,
/** Constant cache. */
GEN_L3P_C,
/** Texture cache. */
GEN_L3P_T,
/** Number of supported L3 partitions. */
GEN_NUM_L3P
};
/**
* L3 configuration represented as the number of ways allocated for each
* partition. \sa get_l3_way_size().
*/
struct gen_l3_config {
unsigned n[GEN_NUM_L3P];
};
/**
* L3 configuration represented as a vector of weights giving the desired
* relative size of each partition. The scale is arbitrary, only the ratios
* between weights will have an influence on the selection of the closest L3
* configuration.
*/
struct gen_l3_weights {
float w[GEN_NUM_L3P];
};
float gen_diff_l3_weights(struct gen_l3_weights w0, struct gen_l3_weights w1);
struct gen_l3_weights
gen_get_default_l3_weights(const struct gen_device_info *devinfo,
bool needs_dc, bool needs_slm);
struct gen_l3_weights
gen_get_l3_config_weights(const struct gen_l3_config *cfg);
const struct gen_l3_config *
gen_get_default_l3_config(const struct gen_device_info *devinfo);
const struct gen_l3_config *
gen_get_l3_config(const struct gen_device_info *devinfo,
struct gen_l3_weights w0);
unsigned
gen_get_l3_config_urb_size(const struct gen_device_info *devinfo,
const struct gen_l3_config *cfg);
void gen_dump_l3_config(const struct gen_l3_config *cfg, FILE *fp);
enum gen_urb_deref_block_size {
GEN_URB_DEREF_BLOCK_SIZE_32 = 0,
GEN_URB_DEREF_BLOCK_SIZE_PER_POLY = 1,
GEN_URB_DEREF_BLOCK_SIZE_8 = 2,
};
void gen_get_urb_config(const struct gen_device_info *devinfo,
const struct gen_l3_config *l3_cfg,
bool tess_present, bool gs_present,
const unsigned entry_size[4],
unsigned entries[4], unsigned start[4],
enum gen_urb_deref_block_size *deref_block_size);
#endif /* GEN_L3_CONFIG_H */
|