Skip to content

Commit 34ef8bb

Browse files
authored
Add some device overrides for Bumper.jl (#149)
* Update quirks.jl * Update Project.toml
1 parent b11a0f7 commit 34ef8bb

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StaticCompiler"
22
uuid = "81625895-6c0f-48fc-b932-11a18313743c"
33
authors = ["Tom Short and contributors"]
4-
version = "0.6.1"
4+
version = "0.6.2"
55

66
[deps]
77
Clang_jll = "0ee61d77-7f21-5576-8119-9fcc46b10100"

src/quirks.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,15 @@ end
4444
# trig.jl
4545
@device_override @noinline Base.Math.sincos_domain_error(x) =
4646
@print_and_throw c"sincos(x) is only defined for finite x."
47+
48+
@static if isdefined(StaticTools, :Bumper)
49+
Bumper = StaticTools.Bumper
50+
@device_override @noinline Bumper.AllocBufferImpl.oom_error() =
51+
@print_and_throw c"alloc: Buffer out of memory. This might be a sign of a memory leak."
52+
@device_override @noinline Bumper.Internals.esc_err() =
53+
@print_and_throw c"Tried to return a PtrArray from a `no_escape` block. If you really want to do this, evaluate Bumper.allow_ptrarray_to_escape() = true"
54+
55+
# Just to make the compiler's life a little easier, let's not make it fetch and elide the current task
56+
# since tasks don't actually exist on-device.
57+
@device_override Bumper.Internals.get_task() = 0
58+
end

0 commit comments

Comments
 (0)