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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Mar 5, 2023

Description of changes

Part of NixOS/nixos-hardware#573

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@Kiskae
Copy link
Contributor

Kiskae commented Mar 5, 2023

OpenCL on intel is messy, I believe this is the support table as it currently exists:

pkg CPU GPU Notes
intel-compute-runtime no yes since Broadwell 5th gen, open source
intel-ocl yes no1 since Ivy Bridge 3rd gen, closed source, deprecated
beignet no yes since Ivy Bridge 3rd gen, open source, deprecated
intel-opencl-runtime yes2 no newer releases are only available as an SDK, not available in nixpkgs

Footnotes

  1. the source includes an icd for the GPU driver, but it does not implement the opencl-loader spec correctly.

  2. according to the arch wiki, it supports non-intel CPUs as well.

@Mic92
Copy link
Member Author

Mic92 commented Mar 6, 2023

Thanks for the table! Should we make intel-ocl opt-in if unfree packages are allowed and have an option that we can turn off in future?

@Kiskae
Copy link
Contributor

Kiskae commented Mar 6, 2023

That is probably the best approach, perhaps another option to use beignet on older GPUs?

@SuperSandro2000
Copy link
Member

That is probably the best approach, perhaps another option to use beignet on older GPUs?

That then belongs into nixos-hardware propably.

config = lib.mkIf config.hardware.intel.opencl.enable {
hardware.opengl.extraPackages = with pkgs; [
intel-compute-runtime
intel-ocl
Copy link
Member

Choose a reason for hiding this comment

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

Having that under video is not fully correct, as it also has parts that only use the CPU, it is more general intel hardware.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
Copy link
Contributor

@JohnRTitor JohnRTitor left a comment

Choose a reason for hiding this comment

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

@Mic92 could you rebase this and address the issues raised?

nixos/modules/hardware/cpu/intel-opencl.nix Outdated Show resolved Hide resolved
);
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.

@Mic92
Copy link
Member Author

Mic92 commented Jun 19, 2024

we should also update https://github.com/NixOS/nixpkgs/blob/6f558d3009c20cd2decc5b36057f78a033a6ff11/nixos/doc/manual/configuration/gpu-accel.chapter.md#intel-sec-gpu-accel-opencl-intel and possible

example = literalExpression "with pkgs; [ intel-media-driver intel-ocl vaapiIntel ]";

Done. Anything else?

Copy link
Contributor

@JohnRTitor JohnRTitor left a comment

Choose a reason for hiding this comment

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

LGTM, but this probably is too minimal to have its own module

I agree with NixOS/nixos-hardware#992 (comment) and I feel like small modules like this can be merged into a big and general intel module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants