Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Support Adapt.AbstractGPUDevice #233

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/agent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Utilities for working with HSA agents

mutable struct HSAAgent
mutable struct HSAAgent <: AbstractGPUDevice
agent::HSA.Agent

# Cached information
Expand All @@ -26,6 +26,14 @@ const DEFAULT_AGENT = Ref{HSAAgent}()
const ALL_AGENTS = Vector{HSAAgent}()
const AGENTS = IdDict{UInt64, HSAAgent}() # Map from agent handles to HSAAgent structs


# ToDo: This is not sufficient/general enough, doesn't handle multiple devices:
Adapt.adapt_storage(device::HSAAgent, x) = adapt_storage(ROCArray, x)

# ToDo: implement Sys.total_memory(dev::ROCDevice)
# ToDo: implement Sys.free_memory(dev::ROCDevice)


### @cfunction callbacks ###

function agent_iterate_isas_cb(isa::HSA.ISA, isas)
Expand Down