From f28f67d988158d6c46f7ffe967152f98d32a37b2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 30 Jun 2025 14:32:50 -0700 Subject: Add MLP training examples. (#7550) * Add MLP training examples. * Formatting fix. * Fix. * Improve documentation on coopvector. * Improve doc. * Update doc. * Fix typo. * Cleanup shader. * Cleanup. * Fix test. * Fix type check recursion. * Fix. * Fix. * Fix override check. --- source/slang/slang-check-decl.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 1a70e25d7..0dd859bb2 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -2914,9 +2914,9 @@ bool SemanticsVisitor::trySynthesizeDifferentialAssociatedTypeRequirementWitness context->parentDecl->findLastDirectMemberDeclOfName(requirementDeclRef.getName())) { // Remove the `ToBeSynthesizedModifier`. - if (as(existingDecl->modifiers.first)) + if (auto mod = existingDecl->modifiers.findModifier()) { - existingDecl->modifiers.first = existingDecl->modifiers.first->next; + removeModifier(existingDecl, mod); } else { @@ -3133,14 +3133,9 @@ bool SemanticsVisitor::trySynthesizeDifferentialAssociatedTypeRequirementWitness addModifier(aggTypeDecl, m_astBuilder->create()); - // The visibility of synthesized decl should be the min of the parent decl and the requirement. - if (requirementDeclRef.getDecl()->findModifier()) - { - auto requirementVisibility = getDeclVisibility(requirementDeclRef.getDecl()); - auto thisVisibility = getDeclVisibility(context->parentDecl); - auto visibility = Math::Min(thisVisibility, requirementVisibility); - addVisibilityModifier(aggTypeDecl, visibility); - } + // The visibility of synthesized decl should be the same of the parent decl. + auto thisVisibility = getDeclVisibility(context->parentDecl); + addVisibilityModifier(aggTypeDecl, thisVisibility); // Synthesize the rest of IDifferential method conformances by recursively checking // conformance on the synthesized decl. @@ -4149,8 +4144,12 @@ bool SemanticsVisitor::doesVarMatchRequirement( return false; } - auto satisfyingVal = - tryConstantFoldDeclRef(satisfyingMemberDeclRef, ConstantFoldingKind::LinkTime, nullptr); + IntVal* satisfyingVal = nullptr; + if (isValidCompileTimeConstantType(satisfyingType)) + { + satisfyingVal = + tryConstantFoldDeclRef(satisfyingMemberDeclRef, ConstantFoldingKind::LinkTime, nullptr); + } if (satisfyingVal) { witnessTable->add(requiredMemberDeclRef.getDecl(), RequirementWitness(satisfyingVal)); @@ -5125,9 +5124,9 @@ void SemanticsVisitor::markOverridingDecl( return; } + memberDecl = maybeGetInner(memberDecl); if (hasDefaultImpl(requiredMemberDeclRef)) { - memberDecl = maybeGetInner(memberDecl); // If the required member has a default implementation, // we need to make sure the member we found is marked as 'override'. if (!memberDecl->hasModifier()) @@ -14290,6 +14289,9 @@ void SemanticsDeclCapabilityVisitor::visitFunctionDeclBase(FunctionDeclBase* fun } else { + auto declaredCapModifier = m_astBuilder->create(); + declaredCapModifier->declaredCapabilityRequirements = declaredCaps; + addModifier(funcDecl, declaredCapModifier); if (vis == DeclVisibility::Public) { // For public decls, we need to enforce that the function -- cgit v1.2.3