diff --git a/src/gallium/drivers/ethosu/ethosu_cmd.c b/src/gallium/drivers/ethosu/ethosu_cmd.c index 479dc7cd910..f3bd3463e8f 100644 --- a/src/gallium/drivers/ethosu/ethosu_cmd.c +++ b/src/gallium/drivers/ethosu/ethosu_cmd.c @@ -15,7 +15,6 @@ #include "ethosu_registers.h" #include "ethosu_sched.h" -#define MAX_BLOCKDEP 3 #define MAX_OUTSTANDING_DMA_OPS 2 #define MAX_OUTSTANDING_NPU_OPS 2 @@ -685,12 +684,13 @@ calc_blockdep(struct ethosu_subgraph *subgraph, struct ethosu_operation *prev_op if (ifm_overlaps || ifm2_overlaps) return 0; - return MAX_BLOCKDEP; + return ethosu_screen(subgraph->base.context->screen)->max_concurrent_blocks; /* TODO: Check if there is actually overlap between the FMs */ } void ethosu_emit_cmdstream(struct ethosu_subgraph *subgraph) { + struct ethosu_screen *screen = ethosu_screen(subgraph->base.context->screen); struct ethosu_operation *prev_op = NULL; struct util_dynarray outstanding_dma_ops; struct util_dynarray outstanding_npu_ops; @@ -706,7 +706,7 @@ ethosu_emit_cmdstream(struct ethosu_subgraph *subgraph) /* Compile */ - if (ethosu_is_u65(ethosu_screen(subgraph->base.context->screen))) + if (ethosu_is_u65(screen)) EMIT0(NPU_SET_PARALLEL_MODE, 0x0); util_dynarray_foreach (&subgraph->operations, struct ethosu_operation, operation) { @@ -733,7 +733,7 @@ ethosu_emit_cmdstream(struct ethosu_subgraph *subgraph) if (operation->type != ETHOSU_OPERATION_TYPE_DMA) { unsigned blockdep = calc_blockdep(subgraph, prev_op, operation); - blockdep = MIN2(blockdep, MAX_BLOCKDEP); + blockdep = MIN2(blockdep, screen->max_concurrent_blocks); EMIT0(NPU_SET_BLOCKDEP, blockdep); prev_op = operation; diff --git a/src/gallium/drivers/ethosu/ethosu_device.c b/src/gallium/drivers/ethosu/ethosu_device.c index 392717f85a3..c9442991fb8 100644 --- a/src/gallium/drivers/ethosu/ethosu_device.c +++ b/src/gallium/drivers/ethosu/ethosu_device.c @@ -233,6 +233,12 @@ ethosu_screen_create(int fd, if (DBG_ENABLED(ETHOSU_DBG_DISABLE_SRAM)) ethosu_screen->info.sram_size = 0; + if (ethosu_is_u65(ethosu_screen)) { + ethosu_screen->max_concurrent_blocks = 3; + } else { + ethosu_screen->max_concurrent_blocks = 7; + } + screen->get_screen_fd = ethosu_screen_get_fd; screen->destroy = ethosu_destroy_screen; screen->context_create = ethosu_create_context; diff --git a/src/gallium/drivers/ethosu/ethosu_device.h b/src/gallium/drivers/ethosu/ethosu_device.h index b121661baad..3d5ebcb8e76 100644 --- a/src/gallium/drivers/ethosu/ethosu_device.h +++ b/src/gallium/drivers/ethosu/ethosu_device.h @@ -38,6 +38,7 @@ struct ethosu_screen { int fd; struct drm_ethosu_npu_info info; + unsigned max_concurrent_blocks; }; static inline struct ethosu_screen *