Attempt to provide a better error for undef sret
I was thinking if we can find which values weren't initalized by Enzyme for the shadow
sret we could fix them up with fictious values instead of Julia throwing an error, but
I haven't found a solution yet since for some values we can't take a pointer Symbol...
x-ref: #347
Codecov Report
Merging #422 (88b4ce2) into main (0f3233d) will decrease coverage by
0.46%. The diff coverage is22.22%.
@@ Coverage Diff @@
## main #422 +/- ##
==========================================
- Coverage 76.33% 75.87% -0.47%
==========================================
Files 17 17
Lines 4226 4244 +18
==========================================
- Hits 3226 3220 -6
- Misses 1000 1024 +24
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/compiler.jl | 74.47% <22.22%> (-0.32%) |
:arrow_down: |
| src/compiler/orcv2.jl | 61.90% <0.00%> (-10.48%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
I think the better soution would be to zero-initialize the sret (instead of undef as it is currently) and then define something like.
zeroof(::Symbol) = :Zero
So I thought about this a bit more, and I think there's a reasonably nice solution here. Namely, this error can only occur if an active input value contains an allocatedinline value for whom bits of 0's are not legal.
Since we know the proper julia type, and this only is an issue on the outermost level where there's an ABI interface from Enzyme to Julia (already wrapped), prior to returning from the llvmcall we create, we can initialize any allocatedinline types with placeholders of choice.
Zero init'ing the sret wouldn't be sufficient, you'd need to post copying the result from the Enzyme struct, or alternatively only copy the relevant parts of the LLVM struct.
we can initialize any allocatedinline types with placeholders of choice.
Can you implement that?