Files
TheRock/rocm-systems/projects/rocprofiler-systems/examples/hipfile/README.md
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

73 lines
2.9 KiB
Markdown

# hipFILE Example
## Overview
This example demonstrates ROCm Systems Profiler tracing of the hipFILE (GPU-direct storage) API. Unlike the decode benchmarks, it is a deliberately minimal workload whose sole purpose is to exercise the hipFILE API so the calls are captured in the trace under the `rocm_hipfile_api` category. It invokes only host-side hipFILE driver APIs — version query, error-string lookup, parameter get/set, and driver open/close — so it runs on any system with the hipFILE runtime, without needing a valid GPU file mapping or storage device.
## Source Files
- `hipfile_trace.cpp` - Minimal hipFILE workload that calls host-side hipFILE driver APIs (`hipFileGetVersion`, `hipFileGetOpErrorString`, `hipFileGetParameter*` / `hipFileSetParameter*`, `hipFileDriverOpen` / `hipFileDriverGetProperties` / `hipFileDriverClose`) to generate hipFILE API trace records.
## Prerequisites
- CMake 3.25+
- HIP runtime
- hipFILE runtime library (`hipfile.h` and `libhipfile`)
- ROCProfiler-SDK 1.3.5 or later — required for hipFILE API tracing. The example builds and runs without it, but the `hipfile_api` tracing domain is only available when profiling against ROCProfiler-SDK 1.3.5 or newer.
## Building
**Standalone build:**
```bash
cmake -B <build_dir> -S <project_root>/examples/hipfile -DCMAKE_PREFIX_PATH=/opt/rocm
cmake --build <build_dir>
```
**As part of the examples suite:**
```bash
cmake -B <build_dir> -S <project_root>/examples/ -DCMAKE_PREFIX_PATH=/opt/rocm
cmake --build <build_dir> --target hipfile-trace
```
## Running
```bash
# Run the minimal hipFILE workload (no arguments required)
./hipfile-trace
```
The program prints the detected hipFILE version and exercises the host-side hipFILE driver APIs:
```text
hipFILE version: X.Y.Z
```
## Profiling with rocprofiler-systems
Add `hipfile_api` to `ROCPROFSYS_ROCM_DOMAINS` (shorthand: `hipfile`) to capture the hipFILE API:
```bash
rocprof-sys-run -e ROCPROFSYS_ROCM_DOMAINS=hipfile_api -- ./hipfile-trace
```
The captured hipFILE API calls appear in the Perfetto trace and the RocPD database under the `rocm_hipfile_api` category.
### Recommended Configuration
| Variable | Value | Purpose |
| ---------- | ------- | --------- |
| `ROCPROFSYS_ROCM_DOMAINS` | `hip_runtime_api,kernel_dispatch,memory_copy,hipfile_api` | Trace HIP API, GPU operations, and the hipFILE API (shorthand: `hipfile`) |
| `ROCPROFSYS_TRACE` | `true` | Generate Perfetto trace for timeline analysis |
| `ROCPROFSYS_PROFILE` | `true` | Generate call-stack profile |
```bash
rocprof-sys-run \
-e ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy,hipfile_api \
-e ROCPROFSYS_TRACE=true \
-- ./hipfile-trace
```
> **Note:** Requesting the `hipfile_api` domain against a ROCProfiler-SDK older than 1.3.5 (which does not expose the hipFILE tracing domain) results in an `unsupported ROCPROFSYS_ROCM_DOMAINS value: hipfile_api` error, the same as any other unavailable domain.