Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

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

Open
ig0xb opened this issue Jul 14, 2017 · 1 comment

Comments

@ig0xb
Copy link

ig0xb commented Jul 14, 2017

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
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants