etnaviv: Add a bunch of new params for NPUs

Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25714>
This commit is contained in:
Tomeu Vizoso 2023-11-16 12:16:20 +01:00 committed by Marge Bot
parent 9e05550888
commit 30a8c071e9
4 changed files with 77 additions and 1 deletions

View file

@ -74,7 +74,16 @@ enum etna_param_id {
ETNA_GPU_BUFFER_SIZE = 0x17,
ETNA_GPU_INSTRUCTION_COUNT = 0x18,
ETNA_GPU_NUM_CONSTANTS = 0x19,
ETNA_GPU_NUM_VARYINGS = 0x1a
ETNA_GPU_NUM_VARYINGS = 0x1a,
ETNA_SOFTPIN_START_ADDR = 0x1b,
ETNA_GPU_PRODUCT_ID = 0x1c,
ETNA_GPU_CUSTOMER_ID = 0x1d,
ETNA_GPU_ECO_ID = 0x1e,
ETNA_GPU_NN_CORE_COUNT = 0x1f,
ETNA_GPU_NN_MAD_PER_CORE = 0x20,
ETNA_GPU_TP_CORE_COUNT = 0x21,
ETNA_GPU_ON_CHIP_SRAM_SIZE = 0x22,
ETNA_GPU_AXI_SRAM_SIZE = 0x23,
};
/* bo flags: */

View file

@ -163,6 +163,33 @@ int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param,
case ETNA_GPU_NUM_VARYINGS:
*value = get_param(dev, core, ETNA_GPU_NUM_VARYINGS);
return 0;
case ETNA_SOFTPIN_START_ADDR:
*value = get_param(dev, core, ETNA_SOFTPIN_START_ADDR);
return 0;
case ETNA_GPU_PRODUCT_ID:
*value = get_param(dev, core, ETNA_GPU_PRODUCT_ID);
return 0;
case ETNA_GPU_CUSTOMER_ID:
*value = get_param(dev, core, ETNA_GPU_CUSTOMER_ID);
return 0;
case ETNA_GPU_ECO_ID:
*value = get_param(dev, core, ETNA_GPU_ECO_ID);
return 0;
case ETNA_GPU_NN_CORE_COUNT:
*value = get_param(dev, core, ETNA_GPU_NN_CORE_COUNT);
return 0;
case ETNA_GPU_NN_MAD_PER_CORE:
*value = get_param(dev, core, ETNA_GPU_NN_MAD_PER_CORE);
return 0;
case ETNA_GPU_TP_CORE_COUNT:
*value = get_param(dev, core, ETNA_GPU_TP_CORE_COUNT);
return 0;
case ETNA_GPU_ON_CHIP_SRAM_SIZE:
*value = get_param(dev, core, ETNA_GPU_ON_CHIP_SRAM_SIZE);
return 0;
case ETNA_GPU_AXI_SRAM_SIZE:
*value = get_param(dev, core, ETNA_GPU_AXI_SRAM_SIZE);
return 0;
default:
ERROR_MSG("invalid param id: %d", param);

View file

@ -143,6 +143,16 @@ struct etna_specs {
unsigned pixel_pipes;
/* number of constants */
unsigned num_constants;
/* number of NN cores */
unsigned nn_core_count;
/* number of MAD units per NN core */
unsigned nn_mad_per_core;
/* number of TP cores */
unsigned tp_core_count;
/* Size of on-chip SRAM */
unsigned on_chip_sram_size;
/* Size of SRAM behind AXI */
unsigned axi_sram_size;
};
/* Compiled Gallium state. All the different compiled state atoms are woven

View file

@ -898,6 +898,36 @@ etna_get_specs(struct etna_screen *screen)
}
screen->specs.max_varyings = MAX2(val, ETNA_NUM_VARYINGS);
if (etna_gpu_get_param(screen->gpu, ETNA_GPU_NN_CORE_COUNT, &val)) {
DBG("could not get ETNA_GPU_NN_CORE_COUNT");
goto fail;
}
screen->specs.nn_core_count = val;
if (etna_gpu_get_param(screen->gpu, ETNA_GPU_NN_MAD_PER_CORE, &val)) {
DBG("could not get ETNA_GPU_NN_MAD_PER_CORE");
goto fail;
}
screen->specs.nn_mad_per_core = val;
if (etna_gpu_get_param(screen->gpu, ETNA_GPU_TP_CORE_COUNT, &val)) {
DBG("could not get ETNA_GPU_TP_CORE_COUNT");
goto fail;
}
screen->specs.tp_core_count = val;
if (etna_gpu_get_param(screen->gpu, ETNA_GPU_ON_CHIP_SRAM_SIZE, &val)) {
DBG("could not get ETNA_GPU_ON_CHIP_SRAM_SIZE");
goto fail;
}
screen->specs.on_chip_sram_size = val;
if (etna_gpu_get_param(screen->gpu, ETNA_GPU_AXI_SRAM_SIZE, &val)) {
DBG("could not get ETNA_GPU_AXI_SRAM_SIZE");
goto fail;
}
screen->specs.axi_sram_size = val;
/* Figure out gross GPU architecture. See rnndb/common.xml for a specific
* description of the differences. */
if (VIV_FEATURE(screen, chipMinorFeatures5, HALTI5))