-
Notifications
You must be signed in to change notification settings - Fork 103
Containers need to use hsa devices for ROCM #384
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
Conversation
Signed-off-by: Daniel J Walsh <[email protected]>
Reviewer's GuideThis PR extends the SELinux container policy to allow containerized workloads to access AMD ROCm HSA devices by defining a new device type for HSA and granting the container domains the needed permissions. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @rhatdan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request updates the SELinux policy for containers to grant them the necessary permissions to access HSA (Heterogeneous System Architecture) devices. This change is specifically aimed at enabling and improving support for ROCm (Radeon Open Compute platform) within containerized environments, ensuring applications can properly interact with GPU hardware.
Highlights
- SELinux Policy Version Bump: The
container
SELinux policy module version has been incremented from2.238.0
to2.239.0
. - ROCm/HSA Device Access for Containers: A new
optional_policy
rule has been added to allowcontainer_domain
read and write permissions (rw_chr_file_perms
) to character files of typehsa_device_t
. This change is essential for enabling ROCm (Radeon Open Compute platform) functionality within containers by granting them access to Heterogeneous System Architecture (HSA) devices.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request adds SELinux rules to allow containers to access HSA devices for ROCm. For better security and consistency, the new rule should be controlled by a tunable boolean. I've suggested this improvement.
optional_policy(` | ||
require { | ||
type hsa_device_t; | ||
} | ||
|
||
allow container_domain hsa_device_t:chr_file rw_chr_file_perms; | ||
') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with other device access rules in this policy and for better security, this new permission should be controlled by a tunable boolean. This allows administrators to explicitly enable HSA device access when needed, instead of granting it by default on systems with ROCm support. Please wrap this policy in a tunable_policy
block and add a corresponding gen_tunable
definition1.
tunable_policy(`container_use_hsa_devices',`
optional_policy(`
require {
type hsa_device_t;
}
allow container_domain hsa_device_t:chr_file rw_chr_file_perms;
')
`)
Style Guide References
Footnotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I don't want to wrap this in a boolean, it is needed in general for ROCM accelerators, so I want it on by default.
@lsm5 Can't get this merged because the tests are blocked? |
Let me check on this and get back in a bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lsm5, rhatdan, sourcery-ai[bot] The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Bypassed rules and merged. Packit jobs are blocked on https://status.packit.dev/issues/2025-06-30-fedora-infra-migration/ |
Summary by Sourcery
Enhancements: