panfrost: Separate core ID range from core count
To query the core count, the hardware has a SHADERS_PRESENT register containing a mask of shader cores connected. The core count equals the number of 1-bits, regardless of placement. This value is useful for public consumption (like in clinfo). However, internally we are interested in the range of core IDs. We usually query core count to determine how many cores to allocate various per-core buffers for (performance counters, occlusion queries, and the stack). In each case, the hardware writes at the index of its core ID, so we have to allocate enough for entire range of core IDs. If the core mask is discontiguous, this necessarily overallocates. Rename the existing core_count to core_id_range, better reflecting its definition and purpose, and repurpose core_count for the actual core count. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17265>
This commit is contained in:
committed by
Marge Bot
parent
5aa740bc8e
commit
6f3eea5ddb
@@ -1585,7 +1585,7 @@ panfrost_emit_shared_memory(struct panfrost_batch *batch,
|
||||
panfrost_batch_get_scratchpad(batch,
|
||||
ss->info.tls_size,
|
||||
dev->thread_tls_alloc,
|
||||
dev->core_count);
|
||||
dev->core_id_range);
|
||||
info.tls.ptr = bo->ptr.gpu;
|
||||
}
|
||||
|
||||
@@ -1593,7 +1593,7 @@ panfrost_emit_shared_memory(struct panfrost_batch *batch,
|
||||
unsigned size =
|
||||
pan_wls_adjust_size(info.wls.size) *
|
||||
pan_wls_instances(&info.wls.dim) *
|
||||
dev->core_count;
|
||||
dev->core_id_range;
|
||||
|
||||
struct panfrost_bo *bo =
|
||||
panfrost_batch_get_shared_memory(batch, size, 1);
|
||||
@@ -2732,7 +2732,7 @@ emit_tls(struct panfrost_batch *batch)
|
||||
panfrost_batch_get_scratchpad(batch,
|
||||
batch->stack_size,
|
||||
dev->thread_tls_alloc,
|
||||
dev->core_count):
|
||||
dev->core_id_range):
|
||||
NULL;
|
||||
struct pan_tls_info tls = {
|
||||
.tls = {
|
||||
@@ -2754,7 +2754,7 @@ emit_fbd(struct panfrost_batch *batch, const struct pan_fb_info *fb)
|
||||
panfrost_batch_get_scratchpad(batch,
|
||||
batch->stack_size,
|
||||
dev->thread_tls_alloc,
|
||||
dev->core_count):
|
||||
dev->core_id_range):
|
||||
NULL;
|
||||
struct pan_tls_info tls = {
|
||||
.tls = {
|
||||
|
||||
@@ -869,7 +869,7 @@ panfrost_begin_query(struct pipe_context *pipe, struct pipe_query *q)
|
||||
case PIPE_QUERY_OCCLUSION_COUNTER:
|
||||
case PIPE_QUERY_OCCLUSION_PREDICATE:
|
||||
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE: {
|
||||
unsigned size = sizeof(uint64_t) * dev->core_count;
|
||||
unsigned size = sizeof(uint64_t) * dev->core_id_range;
|
||||
|
||||
/* Allocate a resource for the query results to be stored */
|
||||
if (!query->rsrc) {
|
||||
@@ -953,7 +953,7 @@ panfrost_get_query_result(struct pipe_context *pipe,
|
||||
|
||||
if (query->type == PIPE_QUERY_OCCLUSION_COUNTER) {
|
||||
uint64_t passed = 0;
|
||||
for (int i = 0; i < dev->core_count; ++i)
|
||||
for (int i = 0; i < dev->core_id_range; ++i)
|
||||
passed += result[i];
|
||||
|
||||
if (dev->arch <= 5 && !query->msaa)
|
||||
|
||||
@@ -388,11 +388,11 @@ struct panfrost_bo *
|
||||
panfrost_batch_get_scratchpad(struct panfrost_batch *batch,
|
||||
unsigned size_per_thread,
|
||||
unsigned thread_tls_alloc,
|
||||
unsigned core_count)
|
||||
unsigned core_id_range)
|
||||
{
|
||||
unsigned size = panfrost_get_total_stack_size(size_per_thread,
|
||||
thread_tls_alloc,
|
||||
core_count);
|
||||
core_id_range);
|
||||
|
||||
if (batch->scratchpad) {
|
||||
assert(batch->scratchpad->size >= size);
|
||||
|
||||
@@ -251,7 +251,7 @@ void
|
||||
panfrost_batch_adjust_stack_size(struct panfrost_batch *batch);
|
||||
|
||||
struct panfrost_bo *
|
||||
panfrost_batch_get_scratchpad(struct panfrost_batch *batch, unsigned size, unsigned thread_tls_alloc, unsigned core_count);
|
||||
panfrost_batch_get_scratchpad(struct panfrost_batch *batch, unsigned size, unsigned thread_tls_alloc, unsigned core_id_range);
|
||||
|
||||
struct panfrost_bo *
|
||||
panfrost_batch_get_shared_memory(struct panfrost_batch *batch, unsigned size, unsigned workgroup_count);
|
||||
|
||||
Reference in New Issue
Block a user