<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Justification: To address a hardware bug causing stability issues when RCS and multiple CCS operate simultaneously in dynamic load balancing mode, CCG limited the CCS count to 1 as a software workaround. Many ECG customers run compute-only workloads without
 requiring rendering tasks. Therefore, it is important to provide customers with a runtime configuration option to increase the CCS count for compute-only workloads, in order to meet the performance requirements.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: <span style="font-family: Calibri, Arial, Helvetica, sans-serif;">Usharani Ayyalasomayajula <usharani.ayyalasomayajula@intel.com></span></div>
<div class="elementToProof" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div class="elementToProof" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Usha.</div>
<hr style="display: inline-block; width: 98%;">
<span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><b>From:</b> Andi Shyti<br>
<b>Sent:</b> Monday, March 24, 2025 18:59<br>
<b>To:</b> intel-gfx; dri-devel<br>
<b>Cc:</b> Tvrtko Ursulin; Joonas Lahtinen; Chris Wilson; Simona Vetter; Mehmood, Arshad; Mrozek, Michal; Andi Shyti; Andi Shyti<br>
<b>Subject:</b> [PATCH v4 00/15] CCS static load balance </span>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-size: 11pt;">Hi,<br>
<br>
Back in v3, this patch series was turned down due to community<br>
policies regarding i915 GEM development. Since then, I have<br>
received several requests from userspace developers, which I<br>
initially declined in order to respect those policies.<br>
<br>
However, with the latest request from UMD users, I decided to<br>
give this series another chance. I believe that when a feature<br>
is genuinely needed, our goal should be to support it, not to<br>
dismiss user and customer needs blindly.<br>
<br>
Here is the link to the userspace counterpart, which depends on<br>
this series to function properly[*].<br>
<br>
I've been refreshing and testing the series together with Arshad.<br>
<br>
This patchset introduces static load balancing for GPUs with<br>
multiple compute engines. It's a relatively long series.<br>
<br>
To help with review, I've broken the work down as much as<br>
possible in multiple patches.<br>
<br>
To summarise:<br>
- Patches 1 to 14 introduce no functional changes, aside from<br>
  adding the 'num_cslices' interface.<br>
- Patch 15 contains the core of the CCS mode setting, building<br>
  on the earlier groundwork.<br>
<br>
The updated approach focuses on managing the UABI engine list,<br>
which controls which engines are exposed to userspace. Instead<br>
of manipulating physical engines and their memory directly, we<br>
now control exposure via this list.<br>
<br>
Since v3, I've kept the changes in v4 to a minimum because there<br>
wasn't a real technical review on the previous posting. I would<br>
really appreciate it if this time all technical concerns could be<br>
raised and discussed on the mailing list.<br>
<br>
IGT tests for this work exist but haven't been submitted yet.<br>
<br>
Thanks to Chris for the reviews, to Arshad for the work we've<br>
done together over the past few weeks, and to Michal for his<br>
invaluable input from the userspace side.<br>
<br>
Thanks, <br>
Andi<br>
<br>
[*] <a href="https://github.com/intel/compute-runtime" id="OWA2e6aef7c-7fd5-0d1c-0a12-c8b20bf1fe82" class="OWAAutoLink" data-auth="NotApplicable">
https://github.com/intel/compute-runtime</a><br>
<br>
Changelog:<br>
==========<br>
PATCHv3 -> PATCHv4<br>
------------------<br>
 - Rebase on top of the latest drm-tip<br>
 - Do not call functions inside GEM_BUG_ONs, but call them<br>
   explicitly (thanks Arshad).<br>
<br>
PATCHv2 -> PATCHv3<br>
------------------<br>
 - Fix a NULL pointer dereference during module unload.<br>
   In i915_gem_driver_remove() I was accessing the gt after the<br>
   gt was removed. Use the dev_priv, instead (obviously!).<br>
 - Fix a lockdep issue: Some of the uabi_engines_mutex unlocks<br>
   were not correctly placed in the exit paths.<br>
 - Fix a checkpatch error for spaces after and before parenthesis<br>
   in the for_each_enabled_engine() definition.<br>
<br>
PATCHv1 -> PATCHv2<br>
------------------<br>
 - Use uabi_mutex to protect the uabi_engines, not the engine<br>
   itself. Rename it to uabi_engines_mutex.<br>
 - Use kobject_add/kobject_del for adding and removing<br>
   interfaces, this way we don't need to destroy and recreate the<br>
   engines, anymore. Refactor intel_engine_add_single_sysfs() to<br>
   reflect this scenario.<br>
 - After adding engines to the rb_tree check that they have been<br>
   added correctly.<br>
 - Fix rb_find_add() compare function to take into accoung also<br>
   the class, not just the instance.<br>
<br>
RFCv2 -> PATCHv1<br>
----------------<br>
 - Removed gt->ccs.mutex<br>
 - Rename m -> width, ccs_id -> engine in<br>
   intel_gt_apply_ccs_mode().<br>
 - In the CCS register value calculation<br>
   (intel_gt_apply_ccs_mode()) the engine (ccs_id) needs to move<br>
   along the ccs_mask (set by the user) instead of the<br>
   cslice_mask.<br>
 - Add GEM_BUG_ON after calculating the new ccs_mask<br>
   (update_ccs_mask()) to make sure all angines have been<br>
   evaluated (i.e. ccs_mask must be '0' at the end of the<br>
   algorithm).<br>
 - move wakeref lock before evaluating intel_gt_pm_is_awake() and<br>
   fix exit path accordingly.<br>
 - Use a more compact form in intel_gt_sysfs_ccs_init() and<br>
   add_uabi_ccs_engines() when evaluating sysfs_create_file(): no<br>
   need to store the return value to the err variable which is<br>
   unused. Get rid of err.<br>
 - Print a warnging instead of a debug message if we fail to<br>
   create the sysfs files.<br>
 - If engine files creation fails in<br>
   intel_engine_add_single_sysfs(), print a warning, not an<br>
   error.<br>
 - Rename gt->ccs.ccs_mask to gt->ccs.id_mask and add a comment<br>
   to explain its purpose.<br>
 - During uabi engine creation, in<br>
   intel_engines_driver_register(), the uabi_ccs_instance is<br>
   redundant because the ccs_instances is already tracked in<br>
   engine->uabi_instance.<br>
 - Mark add_uabi_ccs_engines() and remove_uabi_ccs_engines() as<br>
   __maybe_unused not to break bisectability. They wouldn't<br>
   compile in their own commit. They will be used in the next<br>
   patch and the __maybe_unused is removed.<br>
 - Update engine's workaround every time a new mode is set in<br>
   update_ccs_mask().<br>
 - Mark engines as valid or invalid using their status as<br>
   rb_node. Invalid engines are marked as invalid using<br>
   RB_CLEAR_NODE(). Execbufs will check for their validity when<br>
   selecting the engine to be combined to a context.<br>
 - Create for_each_enabled_engine() which skips the non valid<br>
   engines and use it in selftests.<br>
<br>
RFCv1 -> RFCv2<br>
--------------<br>
Compared to the first version I've taken a completely different<br>
approach to adding and removing engines. in v1 physical engines<br>
were directly added and removed, along with the memory allocated<br>
to them, each time the user changed the CCS mode (from the<br>
previous cover letter).<br>
<br>
Andi Shyti (15):<br>
  drm/i915/gt: Avoid using masked workaround for CCS_MODE setting<br>
  drm/i915/gt: Move the CCS mode variable to a global position<br>
  drm/i915/gt: Allow the creation of multi-mode CCS masks<br>
  drm/i915/gt: Refactor uabi engine class/instance list creation<br>
  drm/i915/gem: Mark and verify UABI engine validity<br>
  drm/i915/gt: Introduce for_each_enabled_engine() and apply it in<br>
    selftests<br>
  drm/i915/gt: Manage CCS engine creation within UABI exposure<br>
  drm/i915/gt: Remove cslices mask value from the CCS structure<br>
  drm/i915/gt: Expose the number of total CCS slices<br>
  drm/i915/gt: Store engine-related sysfs kobjects<br>
  drm/i915/gt: Store active CCS mask<br>
  drm/i915: Protect access to the UABI engines list with a mutex<br>
  drm/i915/gt: Isolate single sysfs engine file creation<br>
  drm/i915/gt: Implement creation and removal routines for CCS engines<br>
  drm/i915/gt: Allow the user to change the CCS mode through sysfs<br>
<br>
 drivers/gpu/drm/i915/gem/i915_gem_context.c   |   3 +<br>
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |  28 +-<br>
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     |  23 --<br>
 drivers/gpu/drm/i915/gt/intel_engine_types.h  |   2 +<br>
 drivers/gpu/drm/i915/gt/intel_engine_user.c   |  62 ++-<br>
 drivers/gpu/drm/i915/gt/intel_gt.c            |   3 +<br>
 drivers/gpu/drm/i915/gt/intel_gt.h            |  12 +<br>
 drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c   | 357 +++++++++++++++++-<br>
 drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.h   |   5 +-<br>
 drivers/gpu/drm/i915/gt/intel_gt_sysfs.c      |   2 +<br>
 drivers/gpu/drm/i915/gt/intel_gt_types.h      |  19 +-<br>
 drivers/gpu/drm/i915/gt/intel_workarounds.c   |   8 +-<br>
 drivers/gpu/drm/i915/gt/selftest_context.c    |   6 +-<br>
 drivers/gpu/drm/i915/gt/selftest_engine_cs.c  |   4 +-<br>
 .../drm/i915/gt/selftest_engine_heartbeat.c   |   6 +-<br>
 drivers/gpu/drm/i915/gt/selftest_engine_pm.c  |   6 +-<br>
 drivers/gpu/drm/i915/gt/selftest_execlists.c  |  52 +--<br>
 drivers/gpu/drm/i915/gt/selftest_gt_pm.c      |   2 +-<br>
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |  22 +-<br>
 drivers/gpu/drm/i915/gt/selftest_lrc.c        |  18 +-<br>
 drivers/gpu/drm/i915/gt/selftest_mocs.c       |   6 +-<br>
 drivers/gpu/drm/i915/gt/selftest_rc6.c        |   4 +-<br>
 drivers/gpu/drm/i915/gt/selftest_reset.c      |   8 +-<br>
 .../drm/i915/gt/selftest_ring_submission.c    |   2 +-<br>
 drivers/gpu/drm/i915/gt/selftest_rps.c        |  14 +-<br>
 drivers/gpu/drm/i915/gt/selftest_timeline.c   |  14 +-<br>
 drivers/gpu/drm/i915/gt/selftest_tlb.c        |   2 +-<br>
 .../gpu/drm/i915/gt/selftest_workarounds.c    |  14 +-<br>
 drivers/gpu/drm/i915/gt/sysfs_engines.c       |  80 ++--<br>
 drivers/gpu/drm/i915/gt/sysfs_engines.h       |   2 +<br>
 drivers/gpu/drm/i915/i915_cmd_parser.c        |   2 +<br>
 drivers/gpu/drm/i915/i915_debugfs.c           |   4 +<br>
 drivers/gpu/drm/i915/i915_drv.h               |   5 +<br>
 drivers/gpu/drm/i915/i915_gem.c               |   4 +<br>
 drivers/gpu/drm/i915/i915_perf.c              |   8 +-<br>
 drivers/gpu/drm/i915/i915_pmu.c               |  11 +-<br>
 drivers/gpu/drm/i915/i915_query.c             |  21 +-<br>
 37 files changed, 648 insertions(+), 193 deletions(-)<br>
<br>
--<br>
2.47.2<br>
</div>
</body>
</html>