Skip to content

Commit

Permalink
WIP Support Adapt.AbstractGPUDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
oschulz committed Jun 2, 2022
1 parent 99967b7 commit 432e88c
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit 432e88c

Please sign in to comment.