Skip to content

Commit

Permalink
Add some device overrides for Bumper.jl (#149)
Browse files Browse the repository at this point in the history
* Update quirks.jl

* Update Project.toml
  • Loading branch information
MasonProtter committed Nov 16, 2023
1 parent b11a0f7 commit 34ef8bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StaticCompiler"
uuid = "81625895-6c0f-48fc-b932-11a18313743c"
authors = ["Tom Short and contributors"]
version = "0.6.1"
version = "0.6.2"

[deps]
Clang_jll = "0ee61d77-7f21-5576-8119-9fcc46b10100"
Expand Down
12 changes: 12 additions & 0 deletions src/quirks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,15 @@ end
# trig.jl
@device_override @noinline Base.Math.sincos_domain_error(x) =
@print_and_throw c"sincos(x) is only defined for finite x."

@static if isdefined(StaticTools, :Bumper)
Bumper = StaticTools.Bumper
@device_override @noinline Bumper.AllocBufferImpl.oom_error() =
@print_and_throw c"alloc: Buffer out of memory. This might be a sign of a memory leak."
@device_override @noinline Bumper.Internals.esc_err() =
@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"

# Just to make the compiler's life a little easier, let's not make it fetch and elide the current task
# since tasks don't actually exist on-device.
@device_override Bumper.Internals.get_task() = 0
end

2 comments on commit 34ef8bb

@MasonProtter
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/95422

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.2 -m "<description of version>" 34ef8bbcaa507368a630f5a4ac297e1d40366754
git push origin v0.6.2

Please sign in to comment.