This project is read-only.

"TypeOf expressions are not supported." In v1.12

Feb 1, 2013 at 3:48 PM
Sorry for my poor English.

I run the "CudafyByExample" code. In "simple_kernel.cs",show the message:"TypeOf expressions are not supported.".
The expressions in this line:
CudafyModule km = CudafyTranslator.Cudafy();

why?Could you help me?Thank you very much!

All message like this:
捕捉到 Cudafy.CudafyLanguageException
Message=TypeOf expressions are not supported.
Source=Cudafy.NET
StackTrace:
   在 Cudafy.Translator.CUDAOutputVisitor.VisitTypeOfExpression(TypeOfExpression typeOfExpression, Object data)
   在 ICSharpCode.NRefactory.CSharp.TypeOfExpression.AcceptVisitor[T,S](IAstVisitor`2 visitor, T data)
   在 Cudafy.Translator.CUDAOutputVisitor.WriteCommaSeparatedList(IEnumerable`1 list)
   在 Cudafy.Translator.CUDAOutputVisitor.WriteCommaSeparatedListInParenthesis(IEnumerable`1 list, Boolean spaceWithin)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitInvocationExpression(InvocationExpression invocationExpression, Object data)
   在 ICSharpCode.NRefactory.CSharp.InvocationExpression.AcceptVisitor[T,S](IAstVisitor`2 visitor, T data)
   在 Cudafy.Translator.CUDAOutputVisitor.WriteCommaSeparatedList(IEnumerable`1 list)
   在 Cudafy.Translator.CUDAOutputVisitor.WriteCommaSeparatedListInParenthesis(IEnumerable`1 list, Boolean spaceWithin)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitInvocationExpression(InvocationExpression invocationExpression, Object data)
   在 ICSharpCode.NRefactory.CSharp.InvocationExpression.AcceptVisitor[T,S](IAstVisitor`2 visitor, T data)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitAssignmentExpression(AssignmentExpression assignmentExpression, Object data)
   在 ICSharpCode.NRefactory.CSharp.AssignmentExpression.AcceptVisitor[T,S](IAstVisitor`2 visitor, T data)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitExpressionStatement(ExpressionStatement expressionStatement, Object data)
   在 ICSharpCode.NRefactory.CSharp.ExpressionStatement.AcceptVisitor[T,S](IAstVisitor`2 visitor, T data)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitBlockStatement(BlockStatement blockStatement, Object data)
   在 Cudafy.Translator.CUDAOutputVisitor.WriteEmbeddedStatement(Statement embeddedStatement)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitIfElseStatement(IfElseStatement ifElseStatement, Object data)
   在 ICSharpCode.NRefactory.CSharp.IfElseStatement.AcceptVisitor[T,S](IAstVisitor`2 visitor, T data)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitBlockStatement(BlockStatement blockStatement, Object data)
   在 Cudafy.Translator.CUDAOutputVisitor.WriteMethodBody(BlockStatement body)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitMethodDeclaration(MethodDeclaration methodDeclaration, Object data)
   在 ICSharpCode.NRefactory.CSharp.MethodDeclaration.AcceptVisitor[T,S](IAstVisitor`2 visitor, T data)
   在 Cudafy.Translator.CUDAOutputVisitor.VisitCompilationUnit(CompilationUnit compilationUnit, Object data)
   在 ICSharpCode.NRefactory.CSharp.CompilationUnit.AcceptVisitor[T,S](IAstVisitor`2 visitor, T data)
   在 Cudafy.Translator.CUDAAstBuilder.GenerateCode(ITextOutput output)
   在 Cudafy.Translator.CUDALanguage.RunTransformsAndGenerateCode(CUDAAstBuilder astBuilder, ITextOutput output, DecompilationOptions options, Int32[] lastDims)
   在 Cudafy.Translator.CUDALanguage.DecompileMethod(MethodDefinition method, ITextOutput output, DecompilationOptions options)
   在 Cudafy.Translator.CudafyTranslator.Cudafy(eGPUCodeGenerator mode, Type[] types)
   在 Cudafy.Translator.CudafyTranslator.Cudafy(ePlatform platform, eArchitecture arch, Version cudaVersion, Boolean compile, Type[] types)
   在 Cudafy.Translator.CudafyTranslator.Cudafy(ePlatform platform, eArchitecture arch, Type[] types)
   在 Cudafy.Translator.CudafyTranslator.Cudafy()
   在 CudafyByExample.simple_kernel.Execute() 位置 E:\using\CUDA\CudafyV1.12\CudafyByExample\chapter03\simple_kernel.cs:行号 21
   在 CudafyByExample.Program.Main(String[] args) 位置 E:\using\CUDA\CudafyV1.12\CudafyByExample\Program.cs:行号 35
InnerException:
Feb 7, 2013 at 10:35 AM
Did you modify anything in the code? What language is the Windows you are using?
Feb 20, 2013 at 1:13 AM
I am not modify the code.
My windows language is Chinese.
Feb 25, 2013 at 12:02 PM
diyer03th, from what I can tell from your stack trace, you changed the function

[Cudafy] public static void thekernel() {} in file CudafyByExample\chapter03\simple_kernel.cs

and added some code to it that contained a "typeof" statement, which isn't supported by cudafy.
That's why nick asked you if you did "modify anything in the code".
Feb 25, 2013 at 3:11 PM
Thank pedritolo1.
I was wrong.

This is my code:
public class simple_kernel
{
    public static void Execute()
    {
        CudafyModule km = CudafyTranslator.Cudafy();

        GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target);
        gpu.LoadModule(km);
        gpu.Launch().kernel(); // or gpu.Launch(1, 1, "kernel"); 
        Console.WriteLine("Hello, World!");
    }

    [Cudafy]
    public static void kernel()
    {
    }
}
In "CudafyV1.9",it is ok.But in"CudafyV1.12",it can not run.
It will stop in "CudafyModule km = CudafyTranslator.Cudafy();",and can not catch any exception.
I think my driver is all right.

Thank you very much!

pedritolo1 wrote:
diyer03th, from what I can tell from your stack trace, you changed the function

[Cudafy] public static void thekernel() {} in file CudafyByExample\chapter03\simple_kernel.cs

and added some code to it that contained a "typeof" statement, which isn't supported by cudafy.
That's why nick asked you if you did "modify anything in the code".