Skip to content

Commit

Permalink
Added oneAPI extension and Buildkite CI (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Churavy <[email protected]>
Co-authored-by: Christian Guinard <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent b027bdd commit aaefe62
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 9 deletions.
18 changes: 18 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,21 @@ steps:
if: build.message !~ /\[skip tests\]/
timeout_in_minutes: 15

- label: "oneAPI.jl"
plugins:
- JuliaCI/julia#v1:
version: "1.10"
command: |
julia -e 'using Pkg
println("--- :julia: Instantiating environment")
Pkg.add("oneAPI")
Pkg.develop(PackageSpec(name="Atomix", path="."))
println("+++ :julia: Running tests")
Pkg.test("Atomix", test_args=["--oneAPI"])'
agents:
queue: "juliagpu"
intel: "*"
if: build.message !~ /\[skip tests\]/
timeout_in_minutes: 15
21 changes: 12 additions & 9 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
name = "Atomix"
uuid = "a9b6321e-bd34-4604-b9c9-b65b8de01458"
authors = ["Takafumi Arakaki <[email protected]> and contributors"]
version = "0.2.0"
version = "1.0.0"

[deps]
UnsafeAtomics = "013be700-e6cd-48c3-b4a1-df204f14c38f"

[compat]
CUDA = "5"
Metal = "1"
UnsafeAtomics = "0.1, 0.2"
julia = "1.10"
[weakdeps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
oneAPI = "8f75cd03-7ff8-4ecb-9b8f-daf728133b1b"

[extensions]
AtomixCUDAExt = "CUDA"
AtomixMetalExt = "Metal"
AtomixoneAPIExt = "oneAPI"

[weakdeps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
[compat]
CUDA = "5"
Metal = "1"
oneAPI = "1"
UnsafeAtomics = "0.1, 0.2"
julia = "1.10"
58 changes: 58 additions & 0 deletions ext/AtomixoneAPIExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# TODO: respect ordering
module AtomixoneAPIExt

using Atomix: Atomix, IndexableRef
using oneAPI: oneAPI, oneDeviceArray

const oneIndexableRef{Indexable<:oneDeviceArray} = IndexableRef{Indexable}

function Atomix.get(ref::oneIndexableRef, order)
error("not implemented")
end

function Atomix.set!(ref::oneIndexableRef, v, order)
error("not implemented")
end

@inline function Atomix.replace!(
ref::oneIndexableRef,
expected,
desired,
success_ordering,
failure_ordering,
)
ptr = Atomix.pointer(ref)
expected = convert(eltype(ref), expected)
desired = convert(eltype(ref), desired)
begin
old = oneAPI.atomic_cmpxchg!(ptr, expected, desired)
end
return (; old = old, success = old === expected)
end

@inline function Atomix.modify!(ref::oneIndexableRef, op::OP, x, order) where {OP}
x = convert(eltype(ref), x)
ptr = Atomix.pointer(ref)
begin
old = if op === (+)
oneAPI.atomic_add!(ptr, x)
elseif op === (-)
oneAPI.atomic_sub!(ptr, x)
elseif op === (&)
oneAPI.atomic_and!(ptr, x)
elseif op === (|)
oneAPI.atomic_or!(ptr, x)
elseif op === xor
oneAPI.atomic_xor!(ptr, x)
elseif op === min
oneAPI.atomic_min!(ptr, x)
elseif op === max
oneAPI.atomic_max!(ptr, x)
else
error("not implemented")
end
end
return old => op(old, x)
end

end # module AtomixoneAPIExt

2 comments on commit aaefe62

@maleadt
Copy link
Member

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/120157

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 v1.0.0 -m "<description of version>" aaefe62aa92b778fcb97e1ec628400299580cdfe
git push origin v1.0.0

Please sign in to comment.