Skip to content

Commit 7493267

Browse files
authored
Merge branch 'main' into gd/maxchunk
2 parents 9e18f03 + d735e42 commit 7493267

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Enzyme"
22
uuid = "7da242da-08ed-463a-9acd-ee780be4f1d9"
33
authors = ["William Moses <wmoses@mit.edu>", "Valentin Churavy <vchuravy@mit.edu>"]
4-
version = "0.13.104"
4+
version = "0.13.105"
55

66
[deps]
77
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"

src/compiler.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4804,6 +4804,7 @@ function no_type_setting(@nospecialize(specTypes::Type{<:Tuple}); world = nothin
48044804
end
48054805

48064806
const DumpPreCheck = Ref(false)
4807+
const DumpPostCheck = Ref(false)
48074808
const DumpPreOpt = Ref(false)
48084809

48094810
function GPUCompiler.compile_unhooked(output::Symbol, job::CompilerJob{<:EnzymeTarget})
@@ -4883,6 +4884,9 @@ function GPUCompiler.compile_unhooked(output::Symbol, job::CompilerJob{<:EnzymeT
48834884
end
48844885
interp = GPUCompiler.get_interpreter(job)
48854886
check_ir(interp, job, mod)
4887+
if DumpPostCheck[]
4888+
API.EnzymeDumpModuleRef(mod.ref)
4889+
end
48864890

48874891
disableFallback = String[]
48884892

src/compiler/validation.jl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,8 @@ function check_ir!(interp, @nospecialize(job::CompilerJob), errors::Vector{IRErr
786786
fname = ops[2]
787787

788788
if isa(flib, LLVM.LoadInst)
789-
op, _ = get_base_and_offset(operands(flib)[1]; offsetAllowed=false, inttoptr=true)
790-
789+
op, off = get_base_and_offset(operands(flib)[1]; inttoptr=true)
790+
791791
if isa(op, LLVM.LoadInst)
792792
pop, _ = get_base_and_offset(operands(op)[1]; offsetAllowed=false, inttoptr=true)
793793

@@ -796,7 +796,7 @@ function check_ir!(interp, @nospecialize(job::CompilerJob), errors::Vector{IRErr
796796

797797
rep = zop
798798
PT = value_type(rep)
799-
if isa(PT, LLVM.PointerType)
799+
if isa(PT, LLVM.PointerType)
800800
rep = LLVM.const_inttoptr(rep, LLVM.PointerType(eltype(PT)))
801801
rep = LLVM.const_addrspacecast(rep, PT)
802802
replace_uses!(pop, rep)
@@ -808,7 +808,10 @@ function check_ir!(interp, @nospecialize(job::CompilerJob), errors::Vector{IRErr
808808
end
809809

810810
if isa(op, ConstantInt)
811-
rep = reinterpret(Ptr{Cvoid}, convert(Csize_t, op) + 8)
811+
@static if VERSION < v"1.12"
812+
off += 8
813+
end
814+
rep = reinterpret(Ptr{Cvoid}, convert(Csize_t, op) + off)
812815
ld = unsafe_load(convert(Ptr{Ptr{Cvoid}}, rep))
813816
flib = Base.unsafe_pointer_to_objref(ld)
814817
end
@@ -830,8 +833,8 @@ function check_ir!(interp, @nospecialize(job::CompilerJob), errors::Vector{IRErr
830833
fname = String(map(Base.Fix1(convert, UInt8), collect(fname)[1:(end-1)]))
831834
end
832835

833-
if !isa(fname, String) || !isa(flib, String)
834-
return
836+
if !isa(fname, String) || !isa(flib, String)
837+
return
835838
end
836839

837840
found, replaceWith = try_import_llvmbc(mod, flib, fname, imported)
@@ -882,7 +885,7 @@ function check_ir!(interp, @nospecialize(job::CompilerJob), errors::Vector{IRErr
882885
fname,
883886
)
884887
end
885-
catch
888+
catch e
886889
nothing
887890
end
888891

0 commit comments

Comments
 (0)