-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #374 from JuliaGPU/jps/tls-queue
Switch to task-focused synchronization model
- Loading branch information
Showing
62 changed files
with
4,681 additions
and
1,555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ | |
*.jl.mem | ||
|
||
docs/build | ||
docs/Manifest.toml | ||
Manifest.toml | ||
LocalPreferences.toml |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Documenter, AMDGPU | ||
|
||
using AMDGPU | ||
using Documenter | ||
|
||
function main() | ||
ci = get(ENV, "CI", "") == "true" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,52 @@ | ||
# Devices/Agents | ||
|
||
In AMDGPU, all GPU devices (also known as "agents" in HSA parlance) are | ||
auto-detected by the runtime, if they're supported. There are three classes of | ||
devices: CPU, GPU, and DSP. In AMDGPU, we only support compilation and | ||
execution on GPU devices, so we will henceforth limit discussion to those; | ||
auto-detected by the runtime, if they're supported. | ||
There are three classes of devices: | ||
- CPU | ||
- GPU | ||
- DSP | ||
|
||
In AMDGPU, we only support compilation and execution on **GPU** devices, | ||
so we will henceforth limit discussion to those; | ||
however, you may see a `kind` `Symbol` available in the APIs of many device | ||
access functions, which defaults to `:gpu`, but could also be `:cpu` or `:dsp`. | ||
|
||
AMDGPU maintains a global default device. The default device is relevant for | ||
all kernel and GPUArray operations; if one is not specified via `@roc` or an | ||
equivalent interface, then the default device is used for those operations, | ||
AMDGPU maintains a global default device. | ||
The default device is relevant for all kernel and GPUArray operations; | ||
if one is not specified via `@roc` or an equivalent interface, | ||
then the default device is used for those operations, | ||
which affects compilation and kernel launch. | ||
|
||
The default device is accessible via `AMDGPU.get_default_agent()`. This | ||
function returns an `ROCDevice`, which is a handle that references the device. | ||
The list of available devices can be queried with `AMDGPU.get_agents()` to get | ||
a list of all known and potentially usable devices. If you have an `ROCDevice` | ||
object, you can also switch the default device via | ||
`AMDGPU.set_default_agent!(agent)`. | ||
!!! note "Task-Local Storage" | ||
Since AMDGPU.jl relies on Task-Local Storage, this means that | ||
default devices are default only within a given task. | ||
Other tasks migh have different default devices if the user switched them. | ||
|
||
The default device is accessible via [`AMDGPU.device()`](@ref). | ||
This function returns a [`ROCDevice`](@ref), which is a handle that references the device. | ||
The list of available devices can be queried with [`AMDGPU.devices`](@ref) to get | ||
a list of all known and potentially usable devices. | ||
|
||
If you have a [`ROCDevice`](@ref) object, you can also switch | ||
the default device via [`AMDGPU.device!`](@ref). | ||
This will switch it only within the task it is called from. | ||
|
||
To select default device for newly created tasks, | ||
use [`AMDGPU.default_device!`](@ref). | ||
|
||
Additionally, devices have an associated numeric ID. The default device ID can | ||
be queried with `AMDGPU.device()`, which returns an `Int`. This value is | ||
bounded between `1` and `length(AMDGPU.get_agents())`, and device `1` is the | ||
default device when AMDGPU is first loaded. The default device may be switched | ||
with `AMDGPU.device!(idx)`. | ||
Additionally, devices have an associated numeric ID. | ||
The default device ID can be queried with [`AMDGPU.default_device_id`](@ref), | ||
which returns an `Int`. | ||
This value is bounded between `1` and `length(AMDGPU.devices())`, | ||
and device `1` is the default device when AMDGPU is first loaded. | ||
|
||
```@docs | ||
AMDGPU.get_agents | ||
AMDGPU.get_default_agent | ||
AMDGPU.set_default_agent! | ||
AMDGPU.devices | ||
AMDGPU.device | ||
AMDGPU.device! | ||
AMDGPU.default_device | ||
AMDGPU.default_device! | ||
AMDGPU.default_device_id | ||
AMDGPU.default_device_id! | ||
``` |
Oops, something went wrong.