@@ -244,6 +244,72 @@ 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 alternative
259+ resource grouping that is expanded into distinct jobspec branches before
260+ traversal. Exactly one of the xor-slot alternatives will be allocated or
261+ reserved. Each ``xor_slot `` is converted into a normal ``slot `` candidate
262+ internally, and the flexible traverser tries the expanded branches sequentially
263+ until a match is found (first-match strategy).
264+
265+ An ``xor_slot `` SHALL follow the same structural requirements as ``slot ``,
266+ including the requirement for a ``label `` key and at least one edge specified
267+ using ``with: ``.
268+
269+ This type is particularly useful when alternatives carry different subtree
270+ prefixes (e.g., different hierarchical paths from the root) or when exclusive
271+ same-level alternatives are needed. Unlike sibling ``slot `` resources which
272+ are evaluated during traversal, ``xor_slot `` resources are expanded into
273+ separate candidate jobspecs before matching begins. The order of xor-slots
274+ effectively encodes preference, with earlier alternatives being tried first.
275+
276+ Nested ``xor_slot `` resources are supported. When processing nested xor-slots,
277+ the expansion produces all combinations of the xor branches, and each
278+ combination is tried as a separate candidate jobspec. To limit the number of
279+ candidates and prevent combinatorial explosion, implementations SHALL provide
280+ a configuration option (typically ``max-xor-candidates ``) that sets the
281+ maximum allowed number of candidate jobspecs.
282+
283+ Support for ``xor_slot `` requires the use of a flexible traverser
284+ implementation. The expansion of ``xor_slot `` alternatives MAY be subject
285+ to implementation-defined limits to prevent combinatorial explosion.
286+
287+ Or-Slots vs Xor-Slots
288+ ---------------------
289+
290+ The following table summarizes the differences between or-slots (sibling
291+ ``slot `` resources) and xor-slots (``xor_slot `` resources):
292+
293+ .. list-table ::
294+ :widths: 30 35 35
295+ :header-rows: 1
296+
297+ * - Feature
298+ - Or-slots (sibling ``slot ``)
299+ - Xor-slots (``xor_slot ``)
300+ * - Expansion timing
301+ - During traversal
302+ - Before traversal
303+ * - Selection algorithm
304+ - Dynamic programming (optimal)
305+ - First-match (sequential)
306+ * - Use case
307+ - Same-level alternatives with shared label
308+ - Different hierarchy prefixes, exclusive same-level alternatives
309+ * - Nesting support
310+ - No
311+ - Yes
312+
247313Tasks
248314=====
249315
@@ -721,6 +787,144 @@ Jobspec YAML
721787 .. literalinclude :: data/spec_14/use_case_2.9.yaml
722788 :language: yaml
723789
790+ Section 3: Alternative Resource Configurations
791+ ===============================================
792+
793+ The following use cases demonstrate or-slots and xor-slots, which allow
794+ expressing alternative resource configurations within a single jobspec.
795+ These require the use of a flexible traverser implementation.
796+
797+ Use Case 3.1
798+ Request alternative slot configurations (or-slots)
799+
800+ Specific Example
801+ Request either a GPU-capable slot with 8 cores or a larger CPU-only
802+ slot with 10 cores. Sibling ``slot `` resources at the same level
803+ represent alternatives that are evaluated during traversal using
804+ dynamic programming to maximize the number of satisfiable slots.
805+
806+ Jobspec YAML
807+ .. code-block :: yaml
808+
809+ version : 1
810+ resources :
811+ - type : slot
812+ count : 1
813+ label : default
814+ with :
815+ - type : core
816+ count : 8
817+ - type : gpu
818+ count : 1
819+ - type : slot
820+ count : 1
821+ label : default
822+ with :
823+ - type : core
824+ count : 10
825+ attributes :
826+ system :
827+ duration : 3600
828+ tasks :
829+ - command : [ "app" ]
830+ slot : default
831+ count :
832+ per_slot : 1
833+
834+ Use Case 3.2
835+ Request exclusive alternative branches (xor-slots)
836+
837+ Specific Example
838+ Request either a socket-local GPU configuration or a node-scoped
839+ memory configuration. The ``xor_slot `` type causes these alternatives
840+ to be expanded into separate candidate jobspecs before matching begins.
841+ The flexible traverser tries each candidate sequentially until one matches.
842+
843+ Jobspec YAML
844+ .. code-block :: yaml
845+
846+ version : 1
847+ resources :
848+ - type : xor_slot
849+ count : 1
850+ label : default
851+ with :
852+ - type : socket
853+ count : 1
854+ with :
855+ - type : core
856+ count : 8
857+ - type : gpu
858+ count : 1
859+ - type : xor_slot
860+ count : 1
861+ label : default
862+ with :
863+ - type : node
864+ count : 1
865+ with :
866+ - type : socket
867+ count : 1
868+ with :
869+ - type : core
870+ count : 6
871+ - type : memory
872+ count : 2
873+ attributes :
874+ system :
875+ duration : 3600
876+ tasks :
877+ - command : [ "app" ]
878+ slot : default
879+ count :
880+ per_slot : 1
881+
882+ Use Case 3.3
883+ Nested xor-slots with multiple hierarchy levels
884+
885+ Specific Example
886+ Request a slot with nested xor alternatives. This demonstrates
887+ that ``xor_slot `` resources can be nested, allowing complex
888+ alternative resource hierarchies to be expressed.
889+
890+ Jobspec YAML
891+ .. code-block :: yaml
892+
893+ version : 1
894+ resources :
895+ - type : node
896+ count : 1
897+ with :
898+ - type : xor_slot
899+ count : 1
900+ label : default
901+ with :
902+ - type : socket
903+ count : 2
904+ with :
905+ - type : xor_slot
906+ count : 1
907+ label : accel
908+ with :
909+ - type : core
910+ count : 4
911+ - type : gpu
912+ count : 1
913+ - type : xor_slot
914+ count : 1
915+ label : accel
916+ with :
917+ - type : core
918+ count : 8
919+ attributes :
920+ system :
921+ duration : 3600
922+ tasks :
923+ - command : [ "app" ]
924+ slot : default
925+ count :
926+ per_slot : 1
927+
724928 References
725929**********
726930
0 commit comments