[llvm] [SPIR-V] Complete SPV_INTEL_16bit_atomics extension support (PR #184312)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 4 02:47:32 PST 2026
================
@@ -1622,10 +1622,44 @@ void addInstrRequirements(const MachineInstr &MI,
assert(InstrPtr->getOperand(1).isReg() && "Unexpected operand in atomic");
Register TypeReg = InstrPtr->getOperand(1).getReg();
SPIRVTypeInst TypeDef = MRI.getVRegDef(TypeReg);
+ unsigned Op = MI.getOpcode();
+
if (TypeDef->getOpcode() == SPIRV::OpTypeInt) {
unsigned BitWidth = TypeDef->getOperand(1).getImm();
if (BitWidth == 64)
Reqs.addCapability(SPIRV::Capability::Int64Atomics);
+ else if (BitWidth == 16) {
+ if (!ST.canUseExtension(SPIRV::Extension::SPV_INTEL_16bit_atomics))
+ report_fatal_error(
+ "16-bit integer atomic operations require the following SPIR-V "
+ "extension: SPV_INTEL_16bit_atomics",
+ false);
----------------
MrSidims wrote:
> Is it not implied by https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_16bit_atomics.asciidoc#validation-rules?
It would be slightly odd to justify an error added for a vanilla SPIR-V in an extension implementation using this extension specification, we need another reference :)
> These rules are in the client API environment specs. See:
https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Env.html#validation-rules:
Should we then check the environment for which we generate SPIR-V and only emit an error if it's OpenCL?
https://github.com/llvm/llvm-project/pull/184312
More information about the llvm-commits
mailing list