/* * Copyright 2018 Red Hat Inc. * * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
*/ #include"gf100.h" #include"ctxgf100.h"
staticint
gv100_gr_scg_estimate_perf(struct gf100_gr *gr, unsignedlong *gpc_tpc_mask,
u32 disable_gpc, u32 disable_tpc, int *perf)
{ const u32 scale_factor = 512UL; /* Use fx23.9 */ const u32 pix_scale = 1024*1024UL; /* Pix perf in [29:20] */ const u32 world_scale = 1024UL; /* World performance in [19:10] */ const u32 tpc_scale = 1; /* TPC balancing in [9:0] */
u32 scg_num_pes = 0;
u32 min_scg_gpc_pix_perf = scale_factor; /* Init perf as maximum */
u32 average_tpcs = 0; /* Average of # of TPCs per GPC */
u32 deviation; /* absolute diff between TPC# and average_tpcs, averaged across GPCs */
u32 norm_tpc_deviation; /* deviation/max_tpc_per_gpc */
u32 tpc_balance;
u32 scg_gpc_pix_perf;
u32 scg_world_perf;
u32 gpc;
u32 pes; int diff; bool tpc_removed_gpc = false; bool tpc_removed_pes = false;
u32 max_tpc_gpc = 0;
u32 num_tpc_mask;
u32 *num_tpc_gpc; int ret = -EINVAL;
if (!(num_tpc_gpc = kcalloc(gr->gpc_nr, sizeof(*num_tpc_gpc), GFP_KERNEL))) return -ENOMEM;
/* Calculate pix-perf-reduction-rate per GPC and find bottleneck TPC */ for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
num_tpc_mask = gpc_tpc_mask[gpc];
if ((gpc == disable_gpc) && num_tpc_mask & BIT(disable_tpc)) { /* Safety check if a TPC is removed twice */ if (WARN_ON(tpc_removed_gpc)) goto done;
/* Remove logical TPC from set */
num_tpc_mask &= ~BIT(disable_tpc);
tpc_removed_gpc = true;
}
/* track balancing of tpcs across gpcs */
num_tpc_gpc[gpc] = hweight32(num_tpc_mask);
average_tpcs += num_tpc_gpc[gpc];
/* save the maximum numer of gpcs */
max_tpc_gpc = num_tpc_gpc[gpc] > max_tpc_gpc ? num_tpc_gpc[gpc] : max_tpc_gpc;
/* * Calculate ratio between TPC count and post-FS and post-SCG * * ratio represents relative throughput of the GPC
*/
scg_gpc_pix_perf = scale_factor * num_tpc_gpc[gpc] / gr->tpc_nr[gpc]; if (min_scg_gpc_pix_perf > scg_gpc_pix_perf)
min_scg_gpc_pix_perf = scg_gpc_pix_perf;
/* Calculate # of surviving PES */ for (pes = 0; pes < gr->ppc_nr[gpc]; pes++) { /* Count the number of TPC on the set */
num_tpc_mask = gr->ppc_tpc_mask[gpc][pes] & gpc_tpc_mask[gpc];
if ((gpc == disable_gpc) && (num_tpc_mask & BIT(disable_tpc))) { if (WARN_ON(tpc_removed_pes)) goto done;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.