IntelLabs / ParallelAccelerator.jl

The ParallelAccelerator package, part of the High Performance Scripting project at Intel Labs
BSD 2-Clause "Simplified" License
294 stars 32 forks source link

OptFramework failed to optimize function error ErrorException("type Union has no field types") #154

Open ig0xb opened 7 years ago

ig0xb commented 7 years ago

Below is the message which i receive when i run the function

OptFramework failed to optimize function ##predictModelKNearest#732 in optimization pass ParallelAccelerator.Driver.toDomainIR with error ErrorException("type Union has no field types")

@code_warntype does have #732 line but does not help in identifying the issue which we could fix.

fs::Tuple{###predictModelKNearest#732,Tuple{DataType,DataType,DataType},Void} = (Core.tuple)(Main.##predictModelKNearest#732, call_sig_arg_tuple::Tuple{DataType,DataType,DataType}, nothing)::Tuple{###predictModelKNearest#732,Tuple{DataType,DataType,DataType},Void} # line 699: SSAValue(0) = CompilerTools.OptFramework.gOptFrameworkDict

Below is my function were i pass a composite datatype, shared array and an Integer. function predictModelKNearest(nn::NearestNeighbor,Xvalues::SharedArray{Float64,2},k::Int64)

Did go through the Documentation, however couldn't find any information on how to fix such issues. Kindly let me know if there is any document suggesting how to fix the issue.

DrTodd13 commented 6 years ago

Hard to tell from this message. One thing I'm noticing is the "type Union." Again, if you're using the C backend then you don't want any type Unions. With the C backend, every variable should be type stable to a single type. Try looking for variables that may change type and consider using different variables if possible or using the native threading backend.