2 * Copyright (c) 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 #ifndef GEN_L3_CONFIG_H
25 #define GEN_L3_CONFIG_H
29 #include "gen_device_info.h"
32 * Chunk of L3 cache reserved for some specific purpose.
34 enum gen_l3_partition
{
35 /** Shared local memory. */
37 /** Unified return buffer. */
39 /** Union of DC and RO. */
41 /** Data cluster RW partition. */
43 /** Union of IS, C and T. */
45 /** Instruction and state cache. */
47 /** Constant cache. */
51 /** Number of supported L3 partitions. */
56 * L3 configuration represented as the number of ways allocated for each
57 * partition. \sa get_l3_way_size().
59 struct gen_l3_config
{
60 unsigned n
[GEN_NUM_L3P
];
64 * L3 configuration represented as a vector of weights giving the desired
65 * relative size of each partition. The scale is arbitrary, only the ratios
66 * between weights will have an influence on the selection of the closest L3
69 struct gen_l3_weights
{
73 float gen_diff_l3_weights(struct gen_l3_weights w0
, struct gen_l3_weights w1
);
76 gen_get_default_l3_weights(const struct gen_device_info
*devinfo
,
77 bool needs_dc
, bool needs_slm
);
80 gen_get_l3_config_weights(const struct gen_l3_config
*cfg
);
82 const struct gen_l3_config
*
83 gen_get_default_l3_config(const struct gen_device_info
*devinfo
);
85 const struct gen_l3_config
*
86 gen_get_l3_config(const struct gen_device_info
*devinfo
,
87 struct gen_l3_weights w0
);
90 gen_get_l3_config_urb_size(const struct gen_device_info
*devinfo
,
91 const struct gen_l3_config
*cfg
);
93 void gen_dump_l3_config(const struct gen_l3_config
*cfg
, FILE *fp
);
95 void gen_get_urb_config(const struct gen_device_info
*devinfo
,
96 unsigned push_constant_bytes
, unsigned urb_size_bytes
,
97 bool tess_present
, bool gs_present
,
98 const unsigned entry_size
[4],
99 unsigned entries
[4], unsigned start
[4]);
101 #endif /* GEN_L3_CONFIG_H */