@@ -1418,12 +1418,9 @@ LLVMToSPIRVBase::getLoopControl(const BranchInst *Branch,
14181418 // PartialCount must not be used with the DontUnroll bit
14191419 else if (S == " llvm.loop.unroll.count" &&
14201420 !(LoopControl & LoopControlDontUnrollMask)) {
1421- if (BM->isAllowedToUseVersion (VersionNumber::SPIRV_1_4)) {
1422- BM->setMinSPIRVVersion (VersionNumber::SPIRV_1_4);
1423- size_t I = getMDOperandAsInt (Node, 1 );
1424- ParametersToSort.emplace_back (spv::LoopControlPartialCountMask, I);
1425- LoopControl |= spv::LoopControlPartialCountMask;
1426- }
1421+ size_t I = getMDOperandAsInt (Node, 1 );
1422+ ParametersToSort.emplace_back (spv::LoopControlPartialCountMask, I);
1423+ LoopControl |= spv::LoopControlPartialCountMask;
14271424 } else if (S == " llvm.loop.ivdep.enable" )
14281425 LoopControl |= spv::LoopControlDependencyInfiniteMask;
14291426 else if (S == " llvm.loop.ivdep.safelen" ) {
@@ -2484,10 +2481,10 @@ bool LLVMToSPIRVBase::transDecoration(Value *V, SPIRVValue *BV) {
24842481
24852482 if (auto BVO = dyn_cast_or_null<OverflowingBinaryOperator>(V)) {
24862483 if (BVO->hasNoSignedWrap ()) {
2487- BV->setNoIntegerDecorationWrap <DecorationNoSignedWrap> (true );
2484+ BV->setNoSignedWrap (true );
24882485 }
24892486 if (BVO->hasNoUnsignedWrap ()) {
2490- BV->setNoIntegerDecorationWrap <DecorationNoUnsignedWrap> (true );
2487+ BV->setNoUnsignedWrap (true );
24912488 }
24922489 }
24932490
@@ -4613,34 +4610,43 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46134610 }
46144611 } break ;
46154612 case spv::ExecutionModeNoGlobalOffsetINTEL: {
4616- if (! BM->isAllowedToUseExtension (
4617- ExtensionID::SPV_INTEL_kernel_attributes))
4618- break ;
4619- BF-> addExecutionMode (BM-> add (
4620- new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode))) );
4621- BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes );
4622- BM-> addCapability (CapabilityKernelAttributesINTEL);
4613+ if (BM->isAllowedToUseExtension (
4614+ ExtensionID::SPV_INTEL_kernel_attributes)) {
4615+ BF-> addExecutionMode (BM-> add (
4616+ new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode))));
4617+ BM-> addExtension (ExtensionID::SPV_INTEL_kernel_attributes );
4618+ BM->addCapability (CapabilityKernelAttributesINTEL );
4619+ }
46234620 } break ;
46244621 case spv::ExecutionModeVecTypeHint:
46254622 case spv::ExecutionModeSubgroupSize:
4626- case spv::ExecutionModeSubgroupsPerWorkgroup:
4627- AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4628- break ;
4623+ case spv::ExecutionModeSubgroupsPerWorkgroup: {
4624+ unsigned X;
4625+ N.get (X);
4626+ BF->addExecutionMode (BM->add (
4627+ new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode), X)));
4628+ } break ;
46294629 case spv::ExecutionModeNumSIMDWorkitemsINTEL:
46304630 case spv::ExecutionModeSchedulerTargetFmaxMhzINTEL:
46314631 case spv::ExecutionModeMaxWorkDimINTEL:
46324632 case spv::internal::ExecutionModeStreamingInterfaceINTEL: {
4633- if (!BM->isAllowedToUseExtension (
4634- ExtensionID::SPV_INTEL_kernel_attributes))
4635- break ;
4636- AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4637- BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes);
4638- BM->addCapability (CapabilityFPGAKernelAttributesINTEL);
4633+ if (BM->isAllowedToUseExtension (
4634+ ExtensionID::SPV_INTEL_kernel_attributes)) {
4635+ unsigned X;
4636+ N.get (X);
4637+ BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4638+ BF, static_cast <ExecutionMode>(EMode), X)));
4639+ BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes);
4640+ BM->addCapability (CapabilityFPGAKernelAttributesINTEL);
4641+ }
46394642 } break ;
46404643 case spv::ExecutionModeSharedLocalMemorySizeINTEL: {
46414644 if (!BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_vector_compute))
46424645 break ;
4643- AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4646+ unsigned SLMSize;
4647+ N.get (SLMSize);
4648+ BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4649+ BF, static_cast <ExecutionMode>(EMode), SLMSize)));
46444650 } break ;
46454651 case spv::ExecutionModeNamedBarrierCountINTEL: {
46464652 if (!BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_vector_compute))
@@ -4658,14 +4664,12 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46584664 case spv::ExecutionModeSignedZeroInfNanPreserve:
46594665 case spv::ExecutionModeRoundingModeRTE:
46604666 case spv::ExecutionModeRoundingModeRTZ: {
4661- if (BM->isAllowedToUseVersion (VersionNumber::SPIRV_1_4)) {
4662- BM->setMinSPIRVVersion (VersionNumber::SPIRV_1_4);
4663- AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4664- } else if (BM->isAllowedToUseExtension (
4665- ExtensionID::SPV_KHR_float_controls)) {
4666- BM->addExtension (ExtensionID::SPV_KHR_float_controls);
4667- AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4668- }
4667+ if (!BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_float_controls))
4668+ break ;
4669+ unsigned TargetWidth;
4670+ N.get (TargetWidth);
4671+ BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4672+ BF, static_cast <ExecutionMode>(EMode), TargetWidth)));
46694673 } break ;
46704674 case spv::ExecutionModeRoundingModeRTPINTEL:
46714675 case spv::ExecutionModeRoundingModeRTNINTEL:
@@ -4674,7 +4678,10 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46744678 if (!BM->isAllowedToUseExtension (
46754679 ExtensionID::SPV_INTEL_float_controls2))
46764680 break ;
4677- AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4681+ unsigned TargetWidth;
4682+ N.get (TargetWidth);
4683+ BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4684+ BF, static_cast <ExecutionMode>(EMode), TargetWidth)));
46784685 } break ;
46794686 case spv::internal::ExecutionModeFastCompositeKernelINTEL: {
46804687 if (BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_fast_composite))
0 commit comments