@@ -244,6 +244,67 @@ Reserved Resource Types
244244 to the program described in the jobspec, unless otherwise specified
245245 in the ``exclusive `` field of the associated resource.
246246
247+ When multiple ``slot `` resources appear as siblings at the same hierarchical
248+ level (referred to informally as "or-slots"), they represent alternative slot
249+ configurations. The flexible traverser MAY select any one of the sibling slots
250+ to satisfy the request. This form is useful when alternatives share the same
251+ task slot label and live at the same jobspec level. The traverser uses a
252+ dynamic-programming approach to choose the slot configuration that yields the
253+ largest total number of satisfiable slot matches. Once a slot shape has been
254+ selected, concrete resources for each matched slot are chosen according to
255+ the active match policy.
256+
257+ **xor_slot **
258+ A resource type of ``type: xor_slot `` SHALL indicate an exclusive alternative
259+ resource grouping that is expanded into distinct jobspec branches before
260+ traversal. Each ``xor_slot `` is converted into a normal ``slot `` candidate
261+ internally, and the flexible traverser tries the expanded branches sequentially
262+ until a match is found (first-match strategy).
263+
264+ An ``xor_slot `` SHALL follow the same structural requirements as ``slot ``,
265+ including the requirement for a ``label `` key and at least one edge specified
266+ using ``with: ``.
267+
268+ This type is particularly useful when alternatives carry different subtree
269+ prefixes (e.g., different hierarchical paths from the root) or when exclusive
270+ same-level alternatives are needed. Unlike sibling ``slot `` resources which
271+ are evaluated during traversal, ``xor_slot `` resources are expanded into
272+ separate candidate jobspecs before matching begins.
273+
274+ Nested ``xor_slot `` resources are supported. When processing nested xor-slots,
275+ the expansion produces all combinations of the xor branches, and each
276+ combination is tried as a separate candidate jobspec.
277+
278+ Support for ``xor_slot `` requires the use of a flexible traverser
279+ implementation. The expansion of ``xor_slot `` alternatives MAY be subject
280+ to implementation-defined limits to prevent combinatorial explosion.
281+
282+ Or-Slots vs Xor-Slots
283+ ---------------------
284+
285+ The following table summarizes the differences between or-slots (sibling
286+ ``slot `` resources) and xor-slots (``xor_slot `` resources):
287+
288+ .. list-table ::
289+ :widths: 30 35 35
290+ :header-rows: 1
291+
292+ * - Feature
293+ - Or-slots (sibling ``slot ``)
294+ - Xor-slots (``xor_slot ``)
295+ * - Expansion timing
296+ - During traversal
297+ - Before traversal
298+ * - Selection algorithm
299+ - Dynamic programming (optimal)
300+ - First-match (sequential)
301+ * - Use case
302+ - Same-level alternatives with shared label
303+ - Different hierarchy prefixes, exclusive same-level alternatives
304+ * - Nesting support
305+ - No
306+ - Yes
307+
247308Tasks
248309=====
249310
@@ -721,6 +782,144 @@ Jobspec YAML
721782 .. literalinclude :: data/spec_14/use_case_2.9.yaml
722783 :language: yaml
723784
785+ Section 3: Alternative Resource Configurations
786+ ===============================================
787+
788+ The following use cases demonstrate or-slots and xor-slots, which allow
789+ expressing alternative resource configurations within a single jobspec.
790+ These require the use of a flexible traverser implementation.
791+
792+ Use Case 3.1
793+ Request alternative slot configurations (or-slots)
794+
795+ Specific Example
796+ Request either a GPU-capable slot with 8 cores or a larger CPU-only
797+ slot with 10 cores. Sibling ``slot `` resources at the same level
798+ represent alternatives that are evaluated during traversal using
799+ dynamic programming to maximize the number of satisfiable slots.
800+
801+ Jobspec YAML
802+ .. code-block :: yaml
803+
804+ version : 1
805+ resources :
806+ - type : slot
807+ count : 1
808+ label : default
809+ with :
810+ - type : core
811+ count : 8
812+ - type : gpu
813+ count : 1
814+ - type : slot
815+ count : 1
816+ label : default
817+ with :
818+ - type : core
819+ count : 10
820+ attributes :
821+ system :
822+ duration : 3600
823+ tasks :
824+ - command : [ "app" ]
825+ slot : default
826+ count :
827+ per_slot : 1
828+
829+ Use Case 3.2
830+ Request exclusive alternative branches (xor-slots)
831+
832+ Specific Example
833+ Request either a socket-local GPU configuration or a node-scoped
834+ memory configuration. The ``xor_slot `` type causes these alternatives
835+ to be expanded into separate candidate jobspecs before matching begins.
836+ The flexible traverser tries each candidate sequentially until one matches.
837+
838+ Jobspec YAML
839+ .. code-block :: yaml
840+
841+ version : 1
842+ resources :
843+ - type : xor_slot
844+ count : 1
845+ label : default
846+ with :
847+ - type : socket
848+ count : 1
849+ with :
850+ - type : core
851+ count : 8
852+ - type : gpu
853+ count : 1
854+ - type : xor_slot
855+ count : 1
856+ label : default
857+ with :
858+ - type : node
859+ count : 1
860+ with :
861+ - type : socket
862+ count : 1
863+ with :
864+ - type : core
865+ count : 6
866+ - type : memory
867+ count : 2
868+ attributes :
869+ system :
870+ duration : 3600
871+ tasks :
872+ - command : [ "app" ]
873+ slot : default
874+ count :
875+ per_slot : 1
876+
877+ Use Case 3.3
878+ Nested xor-slots with multiple hierarchy levels
879+
880+ Specific Example
881+ Request a slot with nested xor alternatives. This demonstrates
882+ that ``xor_slot `` resources can be nested, allowing complex
883+ alternative resource hierarchies to be expressed.
884+
885+ Jobspec YAML
886+ .. code-block :: yaml
887+
888+ version : 1
889+ resources :
890+ - type : node
891+ count : 1
892+ with :
893+ - type : xor_slot
894+ count : 1
895+ label : default
896+ with :
897+ - type : socket
898+ count : 2
899+ with :
900+ - type : xor_slot
901+ count : 1
902+ label : accel
903+ with :
904+ - type : core
905+ count : 4
906+ - type : gpu
907+ count : 1
908+ - type : xor_slot
909+ count : 1
910+ label : accel
911+ with :
912+ - type : core
913+ count : 8
914+ attributes :
915+ system :
916+ duration : 3600
917+ tasks :
918+ - command : [ "app" ]
919+ slot : default
920+ count :
921+ per_slot : 1
922+
724923 References
725924**********
726925
0 commit comments