#include "api.h"
#include "backend.h"
+#include "knobs.h"
static struct pipe_surface *
swr_create_surface(struct pipe_context *pipe,
ctx->blendJIT =
new std::unordered_map<BLEND_COMPILE_STATE, PFN_BLEND_JIT_FUNC>;
+ ctx->max_draws_in_flight = KNOB_MAX_DRAWS_IN_FLIGHT;
+
SWR_CREATECONTEXT_INFO createInfo;
memset(&createInfo, 0, sizeof(createInfo));
createInfo.privateStateSize = sizeof(swr_draw_context);
createInfo.pfnClearTile = swr_StoreHotTileClear;
createInfo.pfnUpdateStats = swr_UpdateStats;
createInfo.pfnUpdateStatsFE = swr_UpdateStatsFE;
+
+ SWR_THREADING_INFO threadingInfo {0};
+
+ threadingInfo.MAX_WORKER_THREADS = KNOB_MAX_WORKER_THREADS;
+ threadingInfo.MAX_NUMA_NODES = KNOB_MAX_NUMA_NODES;
+ threadingInfo.MAX_CORES_PER_NUMA_NODE = KNOB_MAX_CORES_PER_NUMA_NODE;
+ threadingInfo.MAX_THREADS_PER_CORE = KNOB_MAX_THREADS_PER_CORE;
+ threadingInfo.SINGLE_THREADED = KNOB_SINGLE_THREADED;
+
+ // Use non-standard settings for KNL
+ if (swr_screen(p_screen)->is_knl)
+ {
+ if (nullptr == getenv("KNOB_MAX_THREADS_PER_CORE"))
+ threadingInfo.MAX_THREADS_PER_CORE = 2;
+
+ if (nullptr == getenv("KNOB_MAX_DRAWS_IN_FLIGHT"))
+ {
+ ctx->max_draws_in_flight = 2048;
+ createInfo.MAX_DRAWS_IN_FLIGHT = ctx->max_draws_in_flight;
+ }
+ }
+
+ createInfo.pThreadInfo = &threadingInfo;
+
ctx->swrContext = ctx->api.pfnSwrCreateContext(&createInfo);
ctx->api.pfnSwrInit();
util_cpu_detect();
+ bool is_knl = false;
+
if (!strlen(filename) &&
util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512er) {
#if HAVE_SWR_KNL
fprintf(stderr, "KNL ");
sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrKNL", UTIL_DL_EXT);
+ is_knl = true;
#else
fprintf(stderr, "KNL (not built) ");
#endif
struct pipe_screen *screen = swr_create_screen_internal(winsys);
swr_screen(screen)->pfnSwrGetInterface = (PFNSwrGetInterface)pApiProc;
+ swr_screen(screen)->is_knl = is_knl;
return screen;
}
ptr = ctx->api.pfnSwrAllocDrawContextMemory(ctx->swrContext, size, 4);
} else {
/* Allocate enough so that MAX_DRAWS_IN_FLIGHT sets fit. */
- unsigned int max_size_in_flight = size * KNOB_MAX_DRAWS_IN_FLIGHT;
+ uint32_t max_size_in_flight = size * ctx->max_draws_in_flight;
/* Need to grow space */
if (max_size_in_flight > space->current_size) {