@@ -398,6 +398,111 @@ An *OpVariable* in a SPIR-V module with the *BuiltIn* decoration represents
398398a built-in variable.
399399All built-in variables must be in the *Input* storage class.
400400
401+ The following table describes the required SPIR-V type for built-in variables.
402+ In this table, `size_t` is used as a generic type to represent:
403+
404+ * *OpTypeInt* with _Width_ equal to 32 if the _Addressing Model_ declared in *OpMemoryModel* is *Physical32*.
405+ * *OpTypeInt* with _Width_ equal to 64 if the _Addressing Model_ declared in *OpMemoryModel* is *Physical64*.
406+
407+ The mapping from an OpenCL C built-in function to the SPIR-V *BuiltIn* is informational and non-normative.
408+
409+ [cols="2,2,3",options="header"]
410+ |====
411+ |*OpenCL C Function*
412+ |*SPIR-V BuiltIn*
413+ |*Required SPIR-V Type*
414+
415+ | `get_work_dim`
416+ | *WorkDim*
417+ | *OpTypeInt* with _Width_ equal to 32
418+
419+ | `get_global_size`
420+ | *GlobalSize*
421+ | *OpTypeVector* of 3 components of `size_t`
422+
423+ | `get_global_id`
424+ | *GlobalInvocationId*
425+ | *OpTypeVector* of 3 components of `size_t`
426+
427+ | `get_local_size`
428+ | *WorkgroupSize*
429+ | *OpTypeVector* of 3 components of `size_t`
430+
431+ | `get_enqueued_local_size`
432+ | *EnqueuedWorkgroupSize*
433+ | *OpTypeVector* of 3 components of `size_t`
434+
435+ | `get_local_id`
436+ | *LocalInvocationId*
437+ | *OpTypeVector* of 3 components of `size_t`
438+
439+ | `get_num_groups`
440+ | *NumWorkgroups*
441+ | *OpTypeVector* of 3 components of `size_t`
442+
443+ | `get_group_id`
444+ | *WorkgroupId*
445+ | *OpTypeVector* of 3 components of `size_t`
446+
447+ | `get_global_offset`
448+ | *GlobalOffset*
449+ | *OpTypeVector* of 3 components of `size_t`
450+
451+ | `get_global_linear_id`
452+ | *GlobalLinearId*
453+ | `size_t`
454+
455+ | `get_local_linear_id`
456+ | *LocalInvocationIndex*
457+ | `size_t`
458+
459+ | `get_sub_group_size`
460+ | *SubgroupSize*
461+ | *OpTypeInt* with _Width_ equal to 32
462+
463+ | `get_max_sub_group_size`
464+ | *SubgroupMaxSize*
465+ | *OpTypeInt* with _Width_ equal to 32
466+
467+ | `get_num_sub_groups`
468+ | *NumSubgroups*
469+ | *OpTypeInt* with _Width_ equal to 32
470+
471+ | `get_enqueued_num_sub_groups`
472+ | *NumEnqueuedSubgroups*
473+ | *OpTypeInt* with _Width_ equal to 32
474+
475+ | `get_sub_group_id`
476+ | *SubgroupId*
477+ | *OpTypeInt* with _Width_ equal to 32
478+
479+ | `get_sub_group_local_id`
480+ | *SubgroupLocalInvocationId*
481+ | *OpTypeInt* with _Width_ equal to 32
482+
483+ // TODO: Ensure this is documented as part of the extension!
484+ //| `get_sub_group_eq_mask`
485+ // | *SubgroupEqMask*
486+ // | *OpTypeVector* of 4 components of *OpTypeInt* with _Width_ equal to 32
487+ //
488+ //| `get_sub_group_ge_mask`
489+ // | *SubgroupGeMask*
490+ // | *OpTypeVector* of 4 components of *OpTypeInt* with _Width_ equal to 32
491+ //
492+ //| `get_sub_group_gt_mask`
493+ // | *SubgroupGtMask*
494+ // | *OpTypeVector* of 4 components of *OpTypeInt* with _Width_ equal to 32
495+ //
496+ //| `get_sub_group_le_mask`
497+ // | *SubgroupLeMask*
498+ // | *OpTypeVector* of 4 components of *OpTypeInt* with _Width_ equal to 32
499+ //
500+ //| `get_sub_group_lt_mask`
501+ // | *SubgroupLtMask*
502+ // | *OpTypeVector* of 4 components of *OpTypeInt* with _Width_ equal to 32
503+
504+ |====
505+
401506=== Alignment of Types
402507
403508Objects of type *OpTypeInt*, *OpTypeFloat*, and *OpTypePointer* must be aligned
0 commit comments