Skip to content

Commit

Permalink
Small bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellen Wittingen committed Dec 7, 2023
1 parent 99eacd7 commit 05ce6ad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
9 changes: 9 additions & 0 deletions src/rewrite/vct/rewrite/lang/LangCPPToCol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ case object LangCPPToCol {
decl.o.messageInContext(s"This declaration has a type that is not supported.")
}

case class LambdaDefinitionUnsupported(lambda: CPPLambdaDefinition[_]) extends UserError {
override def text: String = lambda.o.messageInContext("Lambda expressions are only supported as parameters for invocations of SYCL's submit and parallel_for methods.")
override def code: String = "unsupportedLambdaDefinition"
}

private case class CPPDoubleContracted(decl: CPPGlobalDeclaration[_], defn: CPPFunctionDefinition[_]) extends UserError {
override def code: String = "multipleContracts"
override def text: String =
Expand Down Expand Up @@ -491,6 +496,10 @@ case class LangCPPToCol[Pre <: Generation](rw: LangSpecificToCol[Pre]) extends L
rw.variables.declare(v)
}

def rewriteLambdaDefinition(lambda: CPPLambdaDefinition[Pre]): Expr[Post] = {
throw LambdaDefinitionUnsupported(lambda)
}

def checkPredicateFoldingAllowed(predRes: Expr[Pre]): Unit = predRes match {
case CPPInvocation(CPPLocal("sycl::buffer::exclusive_hostData_access", Seq()), _, _, _) => throw SYCLPredicateFoldingNotAllowed(predRes)
case _ =>
Expand Down
2 changes: 1 addition & 1 deletion src/rewrite/vct/rewrite/lang/LangSpecificToCol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ case class LangSpecificToCol[Pre <: Generation](veymontGeneratePermissions: Bool
case deref: CPPClassMethodOrFieldAccess[Pre] => cpp.deref(deref)
case inv: CPPInvocation[Pre] => cpp.invocation(inv)
case preAssign@PreAssignExpression(local@CPPLocal(_, _), _) => cpp.preAssignExpr(preAssign, local)
case _: CPPLambdaDefinition[Pre] => ???
case lambda: CPPLambdaDefinition[Pre] => cpp.rewriteLambdaDefinition(lambda)
case arrSub@AmbiguousSubscript(_, _) => cpp.rewriteSubscript(arrSub)
case unfolding: Unfolding[Pre] => {
cpp.checkPredicateFoldingAllowed(unfolding.res)
Expand Down
9 changes: 4 additions & 5 deletions src/rewrite/vct/rewrite/lang/ReplaceSYCLTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ case object ReplaceSYCLTypes extends RewriterBuilder {
}

case class ReplaceSYCLTypes[Pre <: Generation]() extends Rewriter[Pre] {
// override def dispatch(t: Type[Pre]): Type[Post] = t match {
// case _: CPPTLambda[Pre] => TRef()
// case _: SYCLTClass[Pre] => TRef()
// case _ => rewriteDefault(t)
// }
override def dispatch(t: Type[Pre]): Type[Post] = t match {
case _: SYCLTClass[Pre] => TRef()
case _ => rewriteDefault(t)
}
}

0 comments on commit 05ce6ad

Please sign in to comment.