-
Notifications
You must be signed in to change notification settings - Fork 90
Try checking for intermediate nans #2952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/compiler.jl b/src/compiler.jl
index 0c3e82d0..88780d2b 100644
--- a/src/compiler.jl
+++ b/src/compiler.jl
@@ -1446,23 +1446,23 @@ function julia_sanitize(
bad = BasicBlock(fn, "bad")
position!(builder, entry)
inp, sval = collect(parameters(fn))
- cmp = nothing
- @show value_type(inp), isa(value_type(inp), LLVM.ArrayType)
-
- if isa(value_type(inp), LLVM.ArrayType)
- nelem = length(value_type(inp))
- for i in 1:nelem
- e0 = extract_value!(builder, inp, i - 1)
- cmp0 = fcmp!(builder, LLVM.API.LLVMRealUNO, e0, e0)
- if cmp == nothing
- cmp = cmp0
- else
- cmp = or!(builder, cmp, cmp0)
- end
- end
- else
- cmp = fcmp!(builder, LLVM.API.LLVMRealUNO, inp, inp)
- end
+ cmp = nothing
+ @show value_type(inp), isa(value_type(inp), LLVM.ArrayType)
+
+ if isa(value_type(inp), LLVM.ArrayType)
+ nelem = length(value_type(inp))
+ for i in 1:nelem
+ e0 = extract_value!(builder, inp, i - 1)
+ cmp0 = fcmp!(builder, LLVM.API.LLVMRealUNO, e0, e0)
+ if cmp == nothing
+ cmp = cmp0
+ else
+ cmp = or!(builder, cmp, cmp0)
+ end
+ end
+ else
+ cmp = fcmp!(builder, LLVM.API.LLVMRealUNO, inp, inp)
+ end
br!(builder, cmp, bad, good)
@@ -1475,17 +1475,17 @@ function julia_sanitize(
unreachable!(builder)
dispose(builder)
end
- if LLVM.API.LLVMVerifyFunction(fn, LLVM.API.LLVMReturnStatusAction) != 0
- msg = sprint() do io
- println(
- io,
- LLVM.API.LLVMVerifyFunction(fn, LLVM.API.LLVMPrintMessageAction),
- )
- println(io, string(fn))
- println(io, "Broken julia.sanitize")
- end
- throw(LLVM.LLVMException(msg))
- end
+ if LLVM.API.LLVMVerifyFunction(fn, LLVM.API.LLVMReturnStatusAction) != 0
+ msg = sprint() do io
+ println(
+ io,
+ LLVM.API.LLVMVerifyFunction(fn, LLVM.API.LLVMPrintMessageAction),
+ )
+ println(io, string(fn))
+ println(io, "Broken julia.sanitize")
+ end
+ throw(LLVM.LLVMException(msg))
+ end
end
# val =
call!(B, FT, fn, LLVM.Value[val, globalstring_ptr!(B, stringv)]) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2952 +/- ##
==========================================
- Coverage 66.76% 66.70% -0.06%
==========================================
Files 65 65
Lines 21522 21539 +17
==========================================
- Hits 14369 14368 -1
- Misses 7153 7171 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Benchmark Results
Benchmark PlotsA plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/21551963631/artifacts/5330725041. |
@ptiede