153 lines · plain
1=========================================2I915 GuC Submission/DRM Scheduler Section3=========================================4 5Upstream plan6=============7For upstream the overall plan for landing GuC submission and integrating the8i915 with the DRM scheduler is:9 10* Merge basic GuC submission11 * Basic submission support for all gen11+ platforms12 * Not enabled by default on any current platforms but can be enabled via13 modparam enable_guc14 * Lots of rework will need to be done to integrate with DRM scheduler so15 no need to nit pick everything in the code, it just should be16 functional, no major coding style / layering errors, and not regress17 execlists18 * Update IGTs / selftests as needed to work with GuC submission19 * Enable CI on supported platforms for a baseline20 * Rework / get CI heathly for GuC submission in place as needed21* Merge new parallel submission uAPI22 * Bonding uAPI completely incompatible with GuC submission, plus it has23 severe design issues in general, which is why we want to retire it no24 matter what25 * New uAPI adds I915_CONTEXT_ENGINES_EXT_PARALLEL context setup step26 which configures a slot with N contexts27 * After I915_CONTEXT_ENGINES_EXT_PARALLEL a user can submit N batches to28 a slot in a single execbuf IOCTL and the batches run on the GPU in29 paralllel30 * Initially only for GuC submission but execlists can be supported if31 needed32* Convert the i915 to use the DRM scheduler33 * GuC submission backend fully integrated with DRM scheduler34 * All request queues removed from backend (e.g. all backpressure35 handled in DRM scheduler)36 * Resets / cancels hook in DRM scheduler37 * Watchdog hooks into DRM scheduler38 * Lots of complexity of the GuC backend can be pulled out once39 integrated with DRM scheduler (e.g. state machine gets40 simpler, locking gets simpler, etc...)41 * Execlists backend will minimum required to hook in the DRM scheduler42 * Legacy interface43 * Features like timeslicing / preemption / virtual engines would44 be difficult to integrate with the DRM scheduler and these45 features are not required for GuC submission as the GuC does46 these things for us47 * ROI low on fully integrating into DRM scheduler48 * Fully integrating would add lots of complexity to DRM49 scheduler50 * Port i915 priority inheritance / boosting feature in DRM scheduler51 * Used for i915 page flip, may be useful to other DRM drivers as52 well53 * Will be an optional feature in the DRM scheduler54 * Remove in-order completion assumptions from DRM scheduler55 * Even when using the DRM scheduler the backends will handle56 preemption, timeslicing, etc... so it is possible for jobs to57 finish out of order58 * Pull out i915 priority levels and use DRM priority levels59 * Optimize DRM scheduler as needed60 61TODOs for GuC submission upstream62=================================63 64* Need an update to GuC firmware / i915 to enable error state capture65* Open source tool to decode GuC logs66* Public GuC spec67 68New uAPI for basic GuC submission69=================================70No major changes are required to the uAPI for basic GuC submission. The only71change is a new scheduler attribute: I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP.72This attribute indicates the 2k i915 user priority levels are statically mapped73into 3 levels as follows:74 75* -1k to -1 Low priority76* 0 Medium priority77* 1 to 1k High priority78 79This is needed because the GuC only has 4 priority bands. The highest priority80band is reserved with the kernel. This aligns with the DRM scheduler priority81levels too.82 83Spec references:84----------------85* https://www.khronos.org/registry/EGL/extensions/IMG/EGL_IMG_context_priority.txt86* https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap5.html#devsandqueues-priority87* https://spec.oneapi.com/level-zero/latest/core/api.html#ze-command-queue-priority-t88 89New parallel submission uAPI90============================91The existing bonding uAPI is completely broken with GuC submission because92whether a submission is a single context submit or parallel submit isn't known93until execbuf time activated via the I915_SUBMIT_FENCE. To submit multiple94contexts in parallel with the GuC the context must be explicitly registered with95N contexts and all N contexts must be submitted in a single command to the GuC.96The GuC interfaces do not support dynamically changing between N contexts as the97bonding uAPI does. Hence the need for a new parallel submission interface. Also98the legacy bonding uAPI is quite confusing and not intuitive at all. Furthermore99I915_SUBMIT_FENCE is by design a future fence, so not really something we should100continue to support.101 102The new parallel submission uAPI consists of 3 parts:103 104* Export engines logical mapping105* A 'set_parallel' extension to configure contexts for parallel106 submission107* Extend execbuf2 IOCTL to support submitting N BBs in a single IOCTL108 109Export engines logical mapping110------------------------------111Certain use cases require BBs to be placed on engine instances in logical order112(e.g. split-frame on gen11+). The logical mapping of engine instances can change113based on fusing. Rather than making UMDs be aware of fusing, simply expose the114logical mapping with the existing query engine info IOCTL. Also the GuC115submission interface currently only supports submitting multiple contexts to116engines in logical order which is a new requirement compared to execlists.117Lastly, all current platforms have at most 2 engine instances and the logical118order is the same as uAPI order. This will change on platforms with more than 2119engine instances.120 121A single bit will be added to drm_i915_engine_info.flags indicating that the122logical instance has been returned and a new field,123drm_i915_engine_info.logical_instance, returns the logical instance.124 125A 'set_parallel' extension to configure contexts for parallel submission126------------------------------------------------------------------------127The 'set_parallel' extension configures a slot for parallel submission of N BBs.128It is a setup step that must be called before using any of the contexts. See129I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE or I915_CONTEXT_ENGINES_EXT_BOND for130similar existing examples. Once a slot is configured for parallel submission the131execbuf2 IOCTL can be called submitting N BBs in a single IOCTL. Initially only132supports GuC submission. Execlists supports can be added later if needed.133 134Add I915_CONTEXT_ENGINES_EXT_PARALLEL_SUBMIT and135drm_i915_context_engines_parallel_submit to the uAPI to implement this136extension.137 138.. c:namespace-push:: rfc139 140.. kernel-doc:: include/uapi/drm/i915_drm.h141 :functions: i915_context_engines_parallel_submit142 143.. c:namespace-pop::144 145Extend execbuf2 IOCTL to support submitting N BBs in a single IOCTL146-------------------------------------------------------------------147Contexts that have been configured with the 'set_parallel' extension can only148submit N BBs in a single execbuf2 IOCTL. The BBs are either the last N objects149in the drm_i915_gem_exec_object2 list or the first N if I915_EXEC_BATCH_FIRST is150set. The number of BBs is implicit based on the slot submitted and how it has151been configured by 'set_parallel' or other extensions. No uAPI changes are152required to the execbuf2 IOCTL.153