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

nixos/hardware/intel: add opencl option #219657

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
15 changes: 8 additions & 7 deletions nixos/doc/manual/configuration/gpu-accel.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,17 @@ are supported by the Intel NEO OpenCL runtime that is provided by the
intel-compute-runtime package. The proprietary Intel OpenCL runtime, in
the intel-ocl package, is an alternative for Gen7 GPUs.

The intel-compute-runtime or intel-ocl package can be added to
[](#opt-hardware.graphics.extraPackages)
to enable OpenCL support. For example, for Gen8 and later GPUs, the following
configuration can be used:
Choose your runtime based on your Intel CPU/GPU generation:

- `intel-compute-runtime`: Since `Broadwell` 5th gen, open source, runs on GPU
- `intel-ocl`: Since `Ivy Bridge` 3rd gen, closed source, deprecated, runs on CPU
- `beignet`: Since `Ivy Bridge` 3rd gen, open source, deprecated, runs on GPU

i.e.

```nix
{
hardware.graphics.extraPackages = [
intel-compute-runtime
];
hardware.intel.opencl.runtime = "intel-compute-runtime";
}
```

Expand Down
31 changes: 31 additions & 0 deletions nixos/modules/hardware/cpu/intel-opencl.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
config,
lib,
pkgs,
...
}:
{
options.hardware.intel.opencl.runtime = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"intel-compute-runtime"
"intel-ocl"
"beignet"
]
);
default = null;
description = ''
Select the Intel OpenCL runtime to use. Choose your runtime based on your Intel CPU/GPU generation.
Copy link
Member Author

Choose a reason for hiding this comment

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

I consider this option documentation, also it's the same amount of code to add stuff to extraPackages, this one makes it easier to discover what needs to be done to get opencl running on a given Intel CPU.


- `intel-compute-runtime`: Since `Broadwell` 5th gen, open source, runs on GPU
- `intel-ocl`: Since `Ivy Bridge` 3rd gen, closed source, deprecated, runs on CPU
- `beignet`: Since `Ivy Bridge` 3rd gen, open source, deprecated, runs on GPU
'';
};

config = {
hardware.opengl.extraPackages = lib.mkIf (config.hardware.intel.opencl.runtime != null) [
pkgs.${config.hardware.intel.opencl.runtime}
];
};
}
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
./hardware/cpu/amd-microcode.nix
./hardware/cpu/amd-sev.nix
./hardware/cpu/amd-ryzen-smu.nix
./hardware/cpu/intel-opencl.nix
./hardware/cpu/intel-microcode.nix
./hardware/cpu/intel-sgx.nix
./hardware/cpu/x86-msr.nix
Expand Down