Skip to content

Expand on device and driver documentation, notably for ROCm. - #20112

Merged
ScottTodd merged 6 commits into
iree-org:mainfrom
ScottTodd:docs-listing-devices
Feb 26, 2025
Merged

ScottTodd merged 6 commits into
iree-org:mainfrom
ScottTodd:docs-listing-devices

Conversation

@ScottTodd

@ScottTodd ScottTodd commented Feb 26, 2025 •

Copy link
Copy Markdown
Member

Progress on #18174. Fixes #17977.

Changes included

  • Update support status for ROCm compiler target
    • Drop "experimental" status from one page
    • Sort ahead of CUDA (I'm biased as an AMD employee, but that reflects the current backend maturity level)
  • Refresh sections on enumerating drivers and devices
    • Suggest running status checks after installing packages or building tools from source, not before
    • Suggest using iree-run-module --dump_devices in a few places
    • Mention Python APIs and show example outputs
  • Highlight ROCm/CUDA/Vulkan target selection
    • Promote these sections from "tips" to their own subsections that appear in the table of contents and can be linked to
    • Add some one-liners for getting the HIP target, e.g. gfx1100 using different tools. We could do something similar for Vulkan, CUDA, and CPU

Not included but would be nice to add soon

@ScottTodd ScottTodd added documentation ✏️ Improvements or additions to documentation compiler/tools IREE's compiler tooling (iree-compile, iree-opt, etc) runtime/tools IREE's runtime tooling (iree-run-module, iree-benchmark-module, etc) labels Feb 26, 2025
@ScottTodd
ScottTodd requested review from benvanik and kuhar February 26, 2025 20:17

@kuhar kuhar left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great cleanup, thanks for continuing to improve our docs, @ScottTodd!

Comment on lines +140 to +142
$ iree-compile --iree-llvmcpu-list-targets

Registered Targets:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should add this for rocm/vulkan -- seems handy

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah! Here's the code for it:

void LLVMCPUTargetCLOptions::bindOptions(OptionsBinder &binder) {
// Initialize LLVM targets prior to the iree-llvmcpu-list-targets CLI opt.
initializeLLVMTargets();
static llvm::cl::OptionCategory category("LLVMCPU HAL Target");
// General flags.
binder.opt<bool>(
"iree-llvmcpu-list-targets", listTargets, llvm::cl::cat(category),
llvm::cl::desc("Lists all registered targets that the LLVM backend can "
"generate code for."),
llvm::cl::ValueDisallowed, llvm::cl::callback([&](const bool &) {
llvm::TargetRegistry::printRegisteredTargetsForVersion(llvm::outs());
exit(0);
}));


```shell hl_lines="5-6"
# See the section below for information about HIP targets.
IREE_HIP_TARGET=$(rocm_agent_enumerator | sed -n '2 p') # e.g. gfx1100

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of making this a variable, could we suggest to run the command and copy the output? This way the user has a chance of understanding the surrounding context IMO instead of blindly executing commands.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, would it make sense to show the --dump_devices version here instead of using two different methods to find the target?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Made a few adjustments. How's this look now? I did want to keep the example working with just copy/paste but I added another section showing --dump_devices output and elaborated on what rocm_agent_enumerator does.

--8<-- "docs/website/docs/guides/deployment-configurations/snippets/_iree-import-onnx-mobilenet.md"

Then run the following command to compile with the `rocm` target:
Then run the following command to compile with the `rocm` target backend:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The flag says hip target backend. Should we try to stay consistent? Personally, I still don't understand the exact distinction between hip and rocm, and would assume it's even more confusing for newcomers.

What do you think of calling it a hip target and then linking to https://rocm.docs.amd.com/projects/HIP/en/docs-develop/what_is_hip.html?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What do you think of calling it a hip target

I think we should finish the discussions on #18477 and pick names we are happy with, then update the docs to reflect that.

is the most general.
#### Choosing HIP targets

A HIP target (`iree-hip-target`) matching the LLVM AMDGPU backend is needed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here it's hip instead of rocm.

@ScottTodd
ScottTodd requested a review from kuhar February 26, 2025 21:05

@kuhar kuhar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ScottTodd
ScottTodd merged commit b804314 into iree-org:main Feb 26, 2025
@ScottTodd
ScottTodd deleted the docs-listing-devices branch February 26, 2025 21:41
ScottTodd added a commit that referenced this pull request Feb 27, 2025
geomin12 pushed a commit to geomin12/iree that referenced this pull request Mar 5, 2025
@ScottTodd ScottTodd mentioned this pull request Mar 14, 2025
5 of 6 tasks
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
Progress on #18174. Fixes
#17977.

### Changes included

* Update support status for ROCm compiler target
  * Drop "experimental" status from one page
* Sort ahead of CUDA (I'm biased as an AMD employee, but that reflects
the current backend maturity level)
* Refresh sections on enumerating drivers and devices
* Suggest running status checks _after_ installing packages or building
tools from source, not before
  * Suggest using `iree-run-module --dump_devices` in a few places
  * Mention Python APIs and show example outputs
* Highlight ROCm/CUDA/Vulkan target selection
* Promote these sections from "tips" to their own subsections that
appear in the table of contents and can be linked to
* Add some one-liners for getting the HIP target, e.g. `gfx1100` using
different tools. We could do something similar for Vulkan, CUDA, and CPU

### Not included but would be nice to add soon

* Discuss multi-device support
* Switch documentation to recommend `--iree-hal-target-device` instead
of `--iree-hal-target-backends` (or at least explain the difference)
* Mention `HIP_VISIBLE_DEVICES`
(https://rocm.docs.amd.com/en/latest/conceptual/gpu-isolation.html)
* Link to pages like
https://rocm.blogs.amd.com/software-tools-optimization/compute-memory-modes/README.html
for advanced usage
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler/tools IREE's compiler tooling (iree-compile, iree-opt, etc) documentation ✏️ Improvements or additions to documentation runtime/tools IREE's runtime tooling (iree-run-module, iree-benchmark-module, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mention iree-run-module --dump_devices in docs

2 participants