| 1 | =======================================
|
| 2 | Peak Tops Limiter (PTL) sysfs Interface
|
| 3 | =======================================
|
| 4 |
|
| 5 | Overview
|
| 6 | --------
|
| 7 | The Peak Tops Limiter (PTL) sysfs interface enables users to control and
|
| 8 | configure the PTL feature for each GPU individually. All PTL-related
|
| 9 | sysfs files are located under `/sys/class/drm/cardX/device/ptl/`, where
|
| 10 | `X` is the GPU index. Through these files, users can enable or disable
|
| 11 | PTL, set preferred data formats, and query supported formats for each GPU.
|
| 12 |
|
| 13 | PTL sysfs files
|
| 14 | ----------------
|
| 15 | The following files are available under `/sys/class/drm/cardX/device/ptl/`:
|
| 16 |
|
| 17 | - `ptl_enable`
|
| 18 | - `ptl_format`
|
| 19 | - `ptl_supported_formats`
|
| 20 |
|
| 21 | PTL Enable/Disable
|
| 22 | ------------------
|
| 23 | File: `ptl_enable`
|
| 24 | Type: Read/Write (rw)
|
| 25 |
|
| 26 | Read: Returns the current PTL status as a string: `enabled` if PTL
|
| 27 | is active, or `disabled` if inactive.
|
| 28 |
|
| 29 | Write:
|
| 30 |
|
| 31 | - Write `1` or `enabled` to enable PTL
|
| 32 | - Write `0` or `disabled` to disable PTL
|
| 33 |
|
| 34 | Examples::
|
| 35 |
|
| 36 | # Query PTL status
|
| 37 | cat /sys/class/drm/card1/device/ptl/ptl_enable
|
| 38 | # Output: enabled
|
| 39 |
|
| 40 | # Enable PTL
|
| 41 | sudo bash -c "echo 1 > /sys/class/drm/card1/device/ptl/ptl_enable"
|
| 42 |
|
| 43 | # Disable PTL
|
| 44 | sudo bash -c "echo 0 > /sys/class/drm/card1/device/ptl/ptl_enable"
|
| 45 |
|
| 46 | PTL Format (Preferred Data Formats)
|
| 47 | -----------------------------------
|
| 48 | File: `ptl_format`
|
| 49 | Type: Read/Write (rw)
|
| 50 |
|
| 51 | Read: Returns the two preferred formats, e.g. `I8,F32`.
|
| 52 |
|
| 53 | Write: Accepts two formats separated by a comma, e.g. `I8,F32`.
|
| 54 |
|
| 55 | - Both formats must be supported and different.
|
| 56 | - If an invalid format is provided (not supported, or both formats are the
|
| 57 | same), the driver will return "write error: Invalid argument".
|
| 58 |
|
| 59 | Examples::
|
| 60 |
|
| 61 | # Query PTL formats
|
| 62 | cat /sys/class/drm/card1/device/ptl/ptl_format
|
| 63 | # Output: I8,F32
|
| 64 |
|
| 65 | # Set PTL formats
|
| 66 | sudo bash -c "echo I8,F32 > /sys/class/drm/card1/device/ptl/ptl_format"
|
| 67 |
|
| 68 | Supported Formats
|
| 69 | -----------------
|
| 70 | File: `ptl_supported_formats`
|
| 71 | Type: Read-only (r)
|
| 72 |
|
| 73 | Read: Returns a comma-separated list of supported formats, e.g.
|
| 74 | `I8,F16,BF16,F32,F64`.
|
| 75 |
|
| 76 | Example::
|
| 77 |
|
| 78 | # Check supported formats
|
| 79 | cat /sys/class/drm/card1/device/ptl/ptl_supported_formats
|
| 80 | # Output: I8,F16,BF16,F32,F64
|
| 81 |
|
| 82 | Behavioral Notes
|
| 83 | ----------------
|
| 84 | - PTL formats can only be set when PTL is enabled.
|
| 85 | - If PTL is disabled, `ptl_format` returns `N/A`.
|
| 86 | - Only two formats can be set at a time, and they must be from the supported set and different..
|
| 87 | - All commands support per-GPU targeting.
|
| 88 | - Root permission is required to enable/disable PTL or change formats.
|
| 89 | - If the hardware does not support PTL, the PTL sysfs directory will not
|
| 90 | be created.
|
| 91 |
|
| 92 | Implementation
|
| 93 | --------------
|
| 94 | The PTL sysfs nodes are implemented in `drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c`.
|