It appears that the SubgroupSize execution mode is being translated to the attribute intel_reqd_sub_group_size. This is surprising, as SubgroupSize is a core part of SPIR-V (since version 1.1), while the intel_reqd_sub_group_size annotation is part of a (non-core) OpenCL vendor extension.
Attached are an example SPIR-V assembly kernel, along with the llvm IR that the translator emits by default. The pertinent sections are:
SPIR-V:
OpEntryPoint Kernel %11 "kernel"
OpExecutionMode %11 ContractionOff
; CHECK: !intel_reqd_sub_group_size [[METADATA:\![0-9]+]]
; CHECK: [[METADATA]] = !{i32 42}
OpExecutionMode %11 SubgroupSize 42
LLVM:
; Function Attrs: nounwind
define spir_kernel void @kernel(...) ... !intel_reqd_sub_group_size !15
...
!15 = !{i32 42}
Is this intended behaviour? I'm aware that a consumer of SPIR-V may not always go through the translator, but for consumers who do, it seems odd to translate to a vendor-specific OpenCL extension for a core language feature.
My opinion is that this should be changed so that it translates to a vendor-agnostic attribute, which vendors (or consumers) can translate into internal representations (such as intel's existing attribute), or implement directly.
I'd be keen to hear any background or rationale for the current implementation.
subgroup_size.spvasm.txt
subgroup_size_.spvasm.tmp.ll.txt
It appears that the
SubgroupSizeexecution mode is being translated to the attributeintel_reqd_sub_group_size. This is surprising, asSubgroupSizeis a core part of SPIR-V (since version 1.1), while theintel_reqd_sub_group_sizeannotation is part of a (non-core) OpenCL vendor extension.Attached are an example SPIR-V assembly kernel, along with the llvm IR that the translator emits by default. The pertinent sections are:
SPIR-V:
LLVM:
Is this intended behaviour? I'm aware that a consumer of SPIR-V may not always go through the translator, but for consumers who do, it seems odd to translate to a vendor-specific OpenCL extension for a core language feature.
My opinion is that this should be changed so that it translates to a vendor-agnostic attribute, which vendors (or consumers) can translate into internal representations (such as intel's existing attribute), or implement directly.
I'd be keen to hear any background or rationale for the current implementation.
subgroup_size.spvasm.txt
subgroup_size_.spvasm.tmp.ll.txt